DEV Community

Discussion on: Using Custom Types in JavaScript Docs

Collapse
 
4lch4 profile image
Devin W. Leaman

I've thought of using TypeScript for a while but am not too fond of having to learn a new language just for better intellisense/type information.

Is there a good resource you'd recommend to learn more about how to use it?

Collapse
 
anurbol profile image
Nurbol Alpysbayev • Edited

The beauty of Typescript is that it is designed with the "any Javascript is a Typescript" principle in mind. This means, that you can learn it gradually. You can simply rename an extension of your file from .js to .ts and add a first type you need. e.g.:

myJsFunction(youAlwaysForgetTheExactTypeOfThisArgument: number) {
  ...
}

And this was how I learned it: needed to describe a type, just tried to select a correct type intuitively first. If no success, then go to
typescriptlang.org/docs/home.html
typescriptlang.org/docs/handbook/b...
And of course, google, which in 95% cases directs you to the links listed above or to stackoverflow or sometimes:
basarat.gitbooks.io/typescript/con...