Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
bartmr2805y@kescherRant "any" disables typechecking for any flow the values goes throught. The correct form would be to use "unknown", where you can evaluate if it's truthy or not, but not access specific properties. Its useful for when you don't want to type all properties of an object right away.
-
-
bartmr2805y@Zagill You can do Union types. like:
type APIResponse {
--dynamicStuff: ({
------type: Enum.isNumber,
------data: number
----} | {
------type: Enum.isString,
------data: string
--})
}
Anything you use in the source code, you can type it. -
devJs13325yWhen you set excellent set of tslint rules so nobody could fu*k up the code! Feels great but also find this this all over the place after a while:
*/tslint:disable-line no-any */ -
bartmr2805y@AlgoRythm Actually, is really useful, sometimes even for React props. Like, if you have an input type for an InputBox, when you set the type prop to "password", you start to allow props related to password stuff, and when it isn't a password type, Typescript warns you those password related props are no longer useful.
-
bartmr2805y@AlgoRythm Also, I'm a super lazy developer, so I mostly do structure upfront, something humorously to https://github.com/EnterpriseQualit..., and then I like my programs to almost be written by the auto complete.
Related Rants
When someone does Typescript stuff using the "any" keyword
rant
wk172