From 4f7bc2ec0259d44c1181713bba31b03ed0fe4bbc Mon Sep 17 00:00:00 2001 From: Ashraf Mehdaly Date: Sun, 14 Feb 2021 23:44:58 +0200 Subject: [PATCH] Solve the issue of casting using 'as' keyword in .tsx files --- docusaurus/docs/adding-typescript.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/docusaurus/docs/adding-typescript.md b/docusaurus/docs/adding-typescript.md index 6f4c86c6cc7..92337bfb484 100644 --- a/docusaurus/docs/adding-typescript.md +++ b/docusaurus/docs/adding-typescript.md @@ -32,7 +32,15 @@ npm install --save typescript @types/node @types/react @types/react-dom @types/j yarn add typescript @types/node @types/react @types/react-dom @types/jest ``` - +Next, add the following to `package.json` : +```json +"eslintConfig": { + "extends": [ + "react-app", + "react-app/jest" + ] + } +``` Next, rename any file to be a TypeScript file (e.g. `src/index.js` to `src/index.tsx`) and **restart your development server**! Type errors will show up in the same console as the build one. You'll have to fix these type errors before you continue development or build your project. For advanced configuration, [see here](advanced-configuration.md).