Commit 28b02053 authored by Resi Respati's avatar Resi Respati Committed by Luis Fernando Alvarez D

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

* [with-typescript] Remove obsolete TypeScript plugin and update readme
parent e6fb48ce
......@@ -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.
......@@ -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"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment