Tech Lead/Team Lead. Senior WebDev.
Intermediate Grade on Computer Systems-
High Grade on Web Application Development-
MBA (+Marketing+HHRR).
Studied a bit of law, economics and design
Location
Spain
Education
Higher Level Education Certificate on Web Application Development
Tech Lead/Team Lead. Senior WebDev.
Intermediate Grade on Computer Systems-
High Grade on Web Application Development-
MBA (+Marketing+HHRR).
Studied a bit of law, economics and design
Location
Spain
Education
Higher Level Education Certificate on Web Application Development
I find it funny because the "maybe", "unknown" and all those types are getting more visibility this days in the community plus I saw many posts about generics and so...
For me it's like... Dude, you're tired of defining all that BS. I get it. I understand it. Just use JS, you'll be fine 😅
Well, I do have to say that for one the Maybe monad is a thing I really like in functional programming. It's way better than having unhandled null values all over the place.
Also unknown is probably the best solution if you really don't know (or care) about a type. It forces the receiver of the type to actually test for the validity of a value (except of course the dev just resorts to as ... or worse @ts-ignore). And this is IMO the value of typescript: It forces you to think about what values you actually can expect and what possible error states you have to deal with.
But then, if you don't like using Typescript in strict mode, or tend to resort to the the easy way out (like any, as ... or @ts-ignore) you better don't use Typescript because it would only make things worse.
Tech Lead/Team Lead. Senior WebDev.
Intermediate Grade on Computer Systems-
High Grade on Web Application Development-
MBA (+Marketing+HHRR).
Studied a bit of law, economics and design
Location
Spain
Education
Higher Level Education Certificate on Web Application Development
// @ts-ignore
also does a great job 😂JK, the defined in your post is a valid option
Don't get me started on @ts-ignore or 'any'... 😂
I find it funny because the "maybe", "unknown" and all those types are getting more visibility this days in the community plus I saw many posts about generics and so...
For me it's like... Dude, you're tired of defining all that BS. I get it. I understand it. Just use JS, you'll be fine 😅
Well, I do have to say that for one the Maybe monad is a thing I really like in functional programming. It's way better than having unhandled
null
values all over the place.Also
unknown
is probably the best solution if you really don't know (or care) about a type. It forces the receiver of the type to actually test for the validity of a value (except of course the dev just resorts toas ...
or worse@ts-ignore
). And this is IMO the value of typescript: It forces you to think about what values you actually can expect and what possible error states you have to deal with.But then, if you don't like using Typescript in strict mode, or tend to resort to the the easy way out (like
any
,as ...
or@ts-ignore
) you better don't use Typescript because it would only make things worse.Indeed