Назовём пакет example
.
tsconfig.json
{
"compilerOptions": {
"baseUrl": "src",
"jsx": "react",
"target": "esnext",
"module": "esnext",
"declaration": true,
"outDir": "dist",
"strict": true,
"typeRoots": ["./node_modules/@types"]
},
"exclude": ["node_modules", "lib"],
"include": ["./src/**/*.ts", "./src/**/*.tsx"]
}
index.ts
export { platform } from 'utils/platform';
При сборке в папку dist
попадает файл index.d.ts
export { platform } from 'utils/platform';
Итог
/example
/dist
/utils
/platform.d.ts
/index.d.ts
/index.js
/src
/utils
/platform.ts
/index.ts
import { platform } from 'example';
platform.isIOS() <- Cannot find declaration to go to
Но вот если прописать относиьтельный путь, то будет работать (index.ts
)
export { platform } from './utils/platform'; <- относительный путь
Как мне быть если я не хочу везде писать относительные пути? (edited)