[with-typescript] Remove obsolete TypeScript plugin and updated readme (#7368)

* [with-typescript] Remove obsolete TypeScript plugin and update readme
This commit is contained in:
Resi Respati 2019-05-22 00:30:17 +07:00 committed by Luis Fernando Alvarez D
parent e6fb48cee8
commit 28b020538a
2 changed files with 16 additions and 3 deletions

View file

@ -35,6 +35,20 @@ yarn dev
## The idea behind the example
Use the [@zeit/next-typescript](https://github.com/zeit/next-plugins/tree/master/packages/next-typescript) plugin to inject [@babel/preset-typescript](https://github.com/babel/babel/tree/master/packages/babel-preset-typescript) into Next.js, allowing for fast TypeScript transpilation. It also implements a `tsconfig.json` as recommended by [the @zeit/next-typescript plugin page](https://github.com/zeit/next-plugins/tree/master/packages/next-typescript/#readme).
This example shows how to integrate the TypeScript type system into Next.js. Since TypeScript is supported out of the box with Next.js, all we have to do is to install TypeScript.
A `type-check` script is also added to `package.json`, which runs TypeScript's `tsc` CLI in `noEmit` mode to run type-checking separately. You can then include this in your `test` scripts, say, for your CI process.
```
npm install --save-dev typescript
```
To enable TypeScript's features, we install the type declaratons for React and Node.
```
npm install --save-dev @types/react @types/react-dom @types/node
```
When we run `next dev` the next time, Next.js will start looking for any `.ts` or `.tsx` files in our project and builds it. It even automatically creates a `tsconfig.json` file for our project with the recommended settings.
Next.js has built-in TypeScript declarations, so we'll get autocompletion for Next.js' modules straight away.
A `type-check` script is also added to `package.json`, which runs TypeScript's `tsc` CLI in `noEmit` mode to run type-checking separately. You can then include this, for example, in your `test` scripts.

View file

@ -8,7 +8,6 @@
"type-check": "tsc"
},
"dependencies": {
"@zeit/next-typescript": "^1.1.1",
"next": "^8.1.1-canary.28",
"react": "^16.7.0",
"react-dom": "^16.7.0"