WebStorm-TypeScript和allowSyntheticDefaultImports标志 [英] WebStorm - TypeScript and allowSyntheticDefaultImports flag
问题描述
TypeScript 1.8添加了 allowSyntheticDefaultImports标志.
TypeScript 1.8 added allowSyntheticDefaultImports flag.
我有一个针对es6的TypeScript项目,之后将其与Babel移植到ES5.
I have a TypeScript project targeting es6, which afterwards gets transpiled with Babel to ES5.
当前,WebStorm的intellisense无法识别此标志,因此表示不允许从不导出默认值的模块中使用默认导入.这意味着我没有正确获得定义.
Currently, WebStorm's intellisense does not recognize this flag, and thus says that using default import from a module which does not export a default is disallowed. This means that I am not getting the definitions correctly..
由于我不想手动更新所有定义文件,因此在JetBrains正式发布支持该规则的新版本之前(我已经在此处提交了工单),还有其他方法可以教" WebStorm该规则./p>
Since I do not want to update all of the definition files manually, is there any other way to 'teach' WebStorm this rule, until JetBrains officially release a new version which supports it (I already submitted a ticket there).
推荐答案
WebStorm似乎没有使用TypeScript语言服务,所以我不知道有什么方法可以解决此问题.
WebStorm doesn't appear to use the TypeScript language service, so there isn't any way that I'm aware of to fix this.
与此同时,您可以使用非ES6样式的导入:
In the mean time you can use non-ES6 style imports:
import foo = require("foo");
基本上应该编译为:
var foo = require("foo");
这篇关于WebStorm-TypeScript和allowSyntheticDefaultImports标志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!