next js with typescript code example

Example 1: create next app typescript

npx create-next-app --example with-typescript with-typescript-app
# or
yarn create next-app --example with-typescript with-typescript-app

Example 2: nextjs with typescrip example

npx create-next-app --example with-typescript with-typescript-app
# or
yarn create next-app --example with-typescript with-typescript-app

Example 3: next with typescript

yarn add --dev typescript @types/react @types/node

Example 4: next js typescript

// create a tsconfig
touch tsconfig.json

// run command `npm run dev` 
npm run dev