diff --git a/examples/with-typescript/README.md b/examples/with-typescript/README.md index 963af6bc83..f5a0476855 100644 --- a/examples/with-typescript/README.md +++ b/examples/with-typescript/README.md @@ -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. diff --git a/examples/with-typescript/package.json b/examples/with-typescript/package.json index b68860d652..0b390e7d93 100644 --- a/examples/with-typescript/package.json +++ b/examples/with-typescript/package.json @@ -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"