У меня есть проект с такой структурой:
project/
├── package.config
├── node_modules/
│ ├── interactjs/
│ ├── ├── index.d.ts
├── src/
│ ├── browser/
│ | ├── tsconfig.json
│ | ├── index.ts
У меня есть следующее ./package.json
:
{
...
"dependencies": {
"interactjs": "1.3.4"
},
"devDependencies": {
"typescript": "3.2.2"
}
}
Мой ./src/browser/tsconfig.json
:
{
"compilerOptions": {
"target": "es5",
"module": "none",
"declaration": true,
"strict": true,
"strictNullChecks": false,
"outDir": "./out"
},
"typeRoots": [
"../../node_modules",
"../../node_modules/@types",
"../definitions"
],
"include": [
"./**/*"
]
}
Как вы можете видеть, я включаю также папку definitions
, так как есть некоторые ручные определения, которые я хочу включить во все файлы Typescript моего проекта.
Проблема
Следующая компиляция не удалась:
const p : interact.Position = { x: 1, y: 2 };
С ошибкой:
index.ts:9:11 - error TS2503: Cannot find namespace 'interact'.
9 const s : interact.Position = { x: 1, y: 2 };
~~~~~~~~
interact
не найден, хотя в node_modules/interactjs
файл index.d.ts
присутствует со всеми определениями.
В чем проблема?