I have an npm package that is shipped with typings, file structure is similar to the following:
./typings/index.d.ts:
export { ISomeInterface } from './something';
./typings/something.d.ts:
/*
This interface is used by the package internally,
so I can't simply remove the export.
*/
export interface ISomeOtherInterface {
someField: number;
}
export interface ISomeInterface {
someObject: ISomeOtherInterface;
}
./package.json:
"typings": "./typings/index.d.ts"
The problem is whenever I type something like
const a: ISome...
VS Code's IntelliSense shows me two suggestions:
| Auto import ISomeInterface from 'my-package'
| Auto import ISomeOtherInterface from 'my-package/typings/something'
What is the correct way to prevent VS Code from auto suggesting the second import?
typescript@3.2.2, VSCode@1.30.2
UPD:
library tsconfig (the one used to generate typings for the library):
{
"compilerOptions": {
"target": "es5",
"module": "esnext",
"lib": ["dom", "es2016", "esnext"],
"jsx": "react",
"importHelpers": true,
"strict": true,
"noImplicitAny": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"strictBindCallApply": true,
"strictPropertyInitialization": true,
"noImplicitThis": true,
"alwaysStrict": true,
"noUnusedLocals": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"moduleResolution": "node",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"declaration": true,
"emitDeclarationOnly": true,
"rootDir": "src",
"outDir": "typings"
},
"include": [
"src/lib/**/*.ts",
"src/lib/**/*.tsx"
],
"exclude": [
"node_modules",
"dist",
"typings",
"src/**/*.spec.ts",
"src/**/*.spec.tsx"
]
}
project tsconfig (the one used in the project where the library is used):
{
"compilerOptions": {
"target": "es5",
"module": "esnext",
"lib": ["dom", "es2016", "esnext"],
"jsx": "react",
"importHelpers": true,
"strict": true,
"noImplicitAny": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"strictBindCallApply": true,
"alwaysStrict": true,
"noUnusedLocals": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"moduleResolution": "node",
"baseUrl": "./",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"paths": {
"*": ["node_modules/@types/*", "*"]
}
}
}