Understanding Typescript

Possibly save 1 hour of your time: Here are some reminders when using Typescript.

  • Resource Link – Create variable using let rather than var:

https://www.typescriptlang.org/docs/handbook/variable-declarations.html

  • Resource Link – Include other javascript by using node.js npm to install both the library itself and typed-definition for the library. In this example, I am installing mapbox-gl and its typed-definition. You can go to https://www.npmjs.com and find your typed-definition.

  npm install mapbox-gl

  npm install –save @types/mapbox-gl

If you cannot find it in npm package manager, you can try Typed definition in github.

 

 

Advertisements