Skip to content

Latest commit

 

History

History
29 lines (22 loc) · 935 Bytes

20220608_check_ts_react.md

File metadata and controls

29 lines (22 loc) · 935 Bytes

Check TS-React code using separate tsconfig files for src and admin

The npm script check needs to run two checks with the associated tsconfig files for adapter src and admin src separately. Otherwise the check will fail with error TS17004: Cannot use JSX unless the '--jsx' flag is provided.

To make use of this, edit your package.json file in the "scripts" section as follows:

-    "check": "tsc --noEmit",
+    "check": "tsc --noEmit && tsc --noEmit -p admin/tsconfig.json",

Also update your main tsconfig.json file like:

        "include": [
-               "src/**/*.ts",
-               "admin/**/*.ts",
-               "admin/**/*.tsx"
+               "src/**/*.ts"
        ],

Also update your .eslintrc.js file (if present) to include both tsconfig files:

-               project: "./tsconfig.json",
+               project: ["./tsconfig.json", "./admin/tsconfig.json"],