Javascript 如果没有';新';在BSDatePicker中
“我在打开日期选择器类构造函数BehaviorSubject时遇到此错误,如果没有“new”(新建),则无法调用此对象。我刚刚找到了解决方案,说明了我所做的更改以及出现此错误的原因。这是由于tsconfig.json更改造成的。”Javascript 如果没有';新';在BSDatePicker中,javascript,angular,datepicker,Javascript,Angular,Datepicker,“我在打开日期选择器类构造函数BehaviorSubject时遇到此错误,如果没有“new”(新建),则无法调用此对象。我刚刚找到了解决方案,说明了我所做的更改以及出现此错误的原因。这是由于tsconfig.json更改造成的。” { "compileOnSave": false, "compilerOptions": { "importHelpers": true, "outDir": "./dist/out-tsc", "baseUrl": "src",
{
"compileOnSave": false,
"compilerOptions": {
"importHelpers": true,
"outDir": "./dist/out-tsc",
"baseUrl": "src",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es2018", //"target": "es5", => due to this change
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2018", //"es2016",, => due to this change
"dom"
]
},
"angularCompilerOptions": {
"preserveWhitespaces": false
}
}
你尝试过什么,你当前的代码是什么?请阅读。好的@KarlChelton,我是堆栈溢出的新手。现在要阅读你的文章,谢谢。我在从ngx引导程序(生产版本)打开datepicker时发现了这个错误。但是更改库和目标并没有解决它。当我将“aot”设置为false时,它消失了(并强制在angular.json的“build”部分下设置“buildOptimizer=false”)。但我将修复视为临时修复,因为它不涉及根本原因。