Skip to content

acutmore/tsc-tips

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tsc-tips

Tips when using typescript

1.8 and 2.1 compatible tips in seperate folders

Setup

npm install

Use

  1. Start watching the files

    npm run watch-1.8

or

npm run watch-2.1
  1. Then when the files are modified the compiler will run and print any errors it finds

  2. Now uncomment code where instructed and see the errors that are caught by the compiler

Tip summary

Donts:

  • Type asserts: return <T>{}
  • Protected class properties: protected x
  • Adding default parameters of the same type: x = true, y = true
  • Function.bind: foo.bind(undefined, 1)

Dos:

  • Use Enums instead of booleans: enum Log { YES, NO, MAYBE }
  • Create types where types are important: arr is NonEmptyArray

About

Tips when using typescript

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published