VS Code Typescript Auto Import does not use index.ts in React

Viewed 156

I am using Auto Import in VS Code and it is working in some of my projects.

I also have a React project where Auto Import will not import from index.ts. It also does not show the option for the path to index.ts in the popup on Cmd-.

How do I get Auto Import to add the path without the file name on the end, eg.

import { numRelays } from './../redux/reducer'

instead of

import { numRelays } from './../redux/reducer/relayReducer'

tsconfig.json

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

enter image description here

0 Answers
Related