Skip to content

Commit

Permalink
Add documentation to typescript.md for when to declare a type on vari…
Browse files Browse the repository at this point in the history
…ables
  • Loading branch information
corwintines committed Aug 11, 2022
1 parent e36b2ba commit 148c697
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions docs/typescript.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,24 @@ When we reach the moment where the entire codebase is in TS, we will enable `noI

This is just starting, any suggestion is always welcomed and appreciated.

## Declaring types for variables

When declaring types for variables, you should only declare a type when it isn't obvious and the type can't be inferred.

```
// Do not use
const someVar: string = 'string'
// Use
const someVar = 'string'
```

Do declare a type for an unassigned variable when a type can not be inferred.

```
const someVar: string
```

## Migration guide & contribution opportunity 🎉

We'd love your help in migrating our codebase!
Expand Down

0 comments on commit 148c697

Please sign in to comment.