我想为我的库创建类型,该库使用来自<script>
. 如果我构建库 ( ng build angular8-yandex-maps --prod
) 一切正常,但是当我尝试在 Angular 应用程序中导入构建的库时,它会失败 -Cannot find namespace 'ymaps'
等等Cannot find type definition file for 'yandex-maps'
。
声明的命名空间不包含在构建中,是否可以包含它?
dist/**/*.component.d.ts
Cannot find type definition file for 'yandex-maps'
/// <reference types="yandex-maps" />
再生产
打字/yandex-maps/index.d.ts
declare namespace ymaps {
...
}
tsconfig.lib.json
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "../../out-tsc/lib",
"target": "es2015",
"declaration": true,
"declarationMap": true,
"inlineSources": true,
"types": ["yandex-maps"],
"typeRoots": ["../../node_modules/@types", "src/lib/typings"],
"lib": ["dom", "es2018"]
},
"angularCompilerOptions": {
"skipTemplateCodegen": true,
"strictMetadataEmit": true,
"enableResourceInlining": true
},
"exclude": ["src/test.ts", "**/*.spec.ts"]
}