Thanks to visit codestin.com
Credit goes to github.com

Skip to content

tsconfig.json extends doesn't seems to work #175

Closed
@shackra

Description

@shackra

moved an existing project to CRA, I noticed that the server was returning false positive diagnostics in regard to JSX:

frontend 4 /home/jorge/code/kue/fero/dev
 ⫶   index.tsx 4 src/
 ⫶  ⫶   [typescript] Module './App' was resolved to '/home/jorge/code/kue/fero/dev/frontend/src/App.tsx', but '--jsx' is not set. (5:16)
 ⫶  ⫶   [typescript] Cannot use JSX unless the '--jsx' flag is provided. (11:2)
 ⫶  ⫶   [typescript] Cannot use JSX unless the '--jsx' flag is provided. (12:4)
 ⫶  ⫶   [typescript] Cannot use JSX unless the '--jsx' flag is provided. (13:4)

the solution to This is changing jsx to "react", this can only be done on another .json file because CRA will override tsconfig.json when yarn start is ran.

{
  "extends": "./tsconfig.custom.json",
  "compilerOptions": {
    "target": "es5",
    "lib": [
      "dom",
      "dom.iterable",
      "esnext"
    ],
    "allowJs": true,
    "skipLibCheck": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "noFallthroughCasesInSwitch": true,
    "module": "esnext",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "noEmit": true,
    "jsx": "react-jsx"
  },
  "include": [
    "src"
  ]
}

tsconfig.custom.json having:

{
    "compilerOptions": {
        "pretty": false,
        "jsx": "react",
        "baseUrl": "src"
    }
}

so, to me, it seems the server is not correctly interpreting the tsconfig.json files or is ignoring the extends options on it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions