From 297889a5c797ea504f1028afb550f59d39bac3a6 Mon Sep 17 00:00:00 2001 From: shfshanyue Date: Wed, 31 Jul 2019 22:30:15 +0800 Subject: [PATCH] Add typescript support --- next-env.d.ts | 2 ++ package-lock.json | 6 ++++++ package.json | 3 ++- pages/{index.js => index.tsx} | 0 tsconfig.json | 29 +++++++++++++++++++++++++++++ 5 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 next-env.d.ts rename pages/{index.js => index.tsx} (100%) create mode 100644 tsconfig.json diff --git a/next-env.d.ts b/next-env.d.ts new file mode 100644 index 0000000..7b7aa2c --- /dev/null +++ b/next-env.d.ts @@ -0,0 +1,2 @@ +/// +/// diff --git a/package-lock.json b/package-lock.json index b9b235e..95d7737 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8100,6 +8100,12 @@ "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=" }, + "typescript": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.5.3.tgz", + "integrity": "sha512-ACzBtm/PhXBDId6a6sDJfroT2pOWt/oOnk4/dElG5G33ZL776N3Y6/6bKZJBFpd+b05F3Ct9qDjMeJmRWtE2/g==", + "dev": true + }, "uglify-es": { "version": "3.3.9", "resolved": "https://registry.npmjs.org/uglify-es/-/uglify-es-3.3.9.tgz", diff --git a/package.json b/package.json index 818ec56..64a60e2 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,7 @@ "author": "", "license": "ISC", "devDependencies": { - "npm-check-updates": "^3.1.20" + "npm-check-updates": "^3.1.20", + "typescript": "^3.5.3" } } diff --git a/pages/index.js b/pages/index.tsx similarity index 100% rename from pages/index.js rename to pages/index.tsx diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..48ca14a --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,29 @@ +{ + "compilerOptions": { + "target": "es5", + "lib": [ + "dom", + "dom.iterable", + "esnext" + ], + "allowJs": true, + "skipLibCheck": true, + "strict": false, + "forceConsistentCasingInFileNames": true, + "noEmit": true, + "esModuleInterop": true, + "module": "esnext", + "moduleResolution": "node", + "resolveJsonModule": true, + "isolatedModules": true, + "jsx": "preserve" + }, + "exclude": [ + "node_modules" + ], + "include": [ + "next-env.d.ts", + "**/*.ts", + "**/*.tsx" + ] +}