将lib添加到打字稿配置会导致编译中的回归
我添加
"lib": [
"ES2020.Promise",
],
到我的ts配置中,因为我需要使用Promise.allSettled()
,但是,这会导致我的编译时间检查回归,因为现在它在内置的JavaScript函数上失败了,例如
Property 'flat' does not exist on type 'ConditionalAttributeEntity[][]'
const conditionalAttributes = conditionalAttributesUnprocessed.flat();
Parameter 'component' implicitly has an 'any' type.
.filter(component => _.has(component, 'componentList'))
这些功能在这些功能上工作正常,
我config看起来像这样,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"forceConsistentCasingInFileNames": true,
"incremental": true,
"module": "commonjs",
"noErrorTruncation": true,
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"pretty": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": true,
"target": "ES2019",
"lib": [
"ES2020.Promise",
],
我可以做些什么来模块化使用promise.allsettled()
,同时保持编译时间相同?
i added
"lib": [
"ES2020.Promise",
],
to my ts config because i needed to use promise.allSettled()
, however, this caused a regression to my compile time checks as it's now failing on built in javascript functions like
Property 'flat' does not exist on type 'ConditionalAttributeEntity[][]'
const conditionalAttributes = conditionalAttributesUnprocessed.flat();
Parameter 'component' implicitly has an 'any' type.
.filter(component => _.has(component, 'componentList'))
before these worked fine
my config looks like this
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"forceConsistentCasingInFileNames": true,
"incremental": true,
"module": "commonjs",
"noErrorTruncation": true,
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"pretty": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": true,
"target": "ES2019",
"lib": [
"ES2020.Promise",
],
Is there anything i can do to more modularly use promise.allSettled()
while keeping compile time checks the same?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论