我有以下课程
export abstract class Entity<K, L = any> implements IEntity<L> {
public static getInstances<T>(filterQuery?: IFilterQuery): Promise<Page<T>>;
}
这驻留在自定义模块中,并且代码已转换为javascript
然后在如下所示的有角度的应用程序中使用此特定模块
export class Country extends Entity<ICountry, ILocalizedCountry> implements
public static find<E extends IEntity = ICountry, L = ILocalizedCountry>(filterQuery?: IFilterQuery): Promise<Page<E & L>> {
return this.getInstances(filterQuery);
}
}
如果我从初始模块运行测试,这会很好。但是,如果启动我的角度应用程序,则会出现以下错误
ERROR in src/entities/Country.ts(29,15): error TS2339: Property 'getInstances' does not exist on type 'typeof Country'.
我的角度应用程序中的tsconfig文件在后面
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2017",
"dom"
]
}
}
下面是原始模块中的tsconfig文件
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"declaration": true,
"outDir": "./dist",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": [
"dom",
"es2015",
"es2017"
],
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"target": "es5",
"removeComments": false
},
"filesGlob": [
"./**/*.ts",
"!./node_modules/**/*.ts"
],
"exclude": [
"node_modules",
"dist",
"test"
]
}
关于为什么会发生这种情况的任何线索?如果我将打字稿文件直接导入到项目中,效果很好,但是我也希望转码的javascript文件能够正常工作,我认为tsconfig文件中有问题