1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00
Commit graph

2 commits

Author SHA1 Message Date
Emmanuel Letallieur 82bdd43285 Fix custom-server-typescript not typechecking (#3954)
Hi

In the current version of the example __custom-server-typescript__, types are never checked.
For instance, change the following line :
```
const dev = process.env.NODE_ENV !== 'production'
```
by :
```
const dev: number = process.env.NODE_ENV !== 'production'
```
then run `npm run dev`. The application launches perfectly, no error is thrown.

In dev environnement, it is preferable to check types all the time, to get immediate feedback. This PR activates type checking. Only when using nodemon, so no impact on production.


Now the above code will (rightfully) refuse to compile : 
```
TSError: ⨯ Unable to compile TypeScript
server/index.ts (6,7): Type 'boolean' is not assignable to type 'number'
```
2018-09-04 17:35:34 +02:00
Ibrahim Ansari 99fb191286 Add custom-server-typescript example (see #3694) (#3838)
* Add custom-server-typescript example (see #3694)

* Fix linting errors in custom-server-typescript

* Provide proper arguments to ts-node.

* Fix import and fix all linting errors.

* Use import in server as well.

* Update nodemon.json
2018-02-22 16:29:47 +01:00