[英]Navigating through Typescript references in Webstorm using ES6 module syntax
We are using Typescript with Intellij Webstorm IDE. 我们在Intellij Webstorm IDE中使用Typescript。
The situation is we use ES6 import syntax and tsc
compiler 1.5.3 (set as custom compiler in Webstorm also with flag --module commonjs
) 情况是我们使用ES6导入语法和
tsc
编译器1.5.3(在Webstorm中也设置为自定义编译器,同时带有--module commonjs
标志)
The problem is it is imposible to click through (navigate to) method from module (file) 问题是无法从模块(文件)中单击(导航至)方法
// app.ts
import * as myModule from 'myModule';
myModule.myFunction();
// myModule.ts
export function myFunction() {
// implementation
}
When I click on .myFunction()
in app.ts
I expect to navigate to myModule.ts
file but this doesn't happen? 当我点击
.myFunction()
在app.ts
我期望导航到myModule.ts
文件,但这种情况不会发生?
EDIT: 编辑:
The way we exported functionality was bit different as in first example: 我们导出功能的方式与第一个示例有些不同:
export: {
myFunction1,
myFunction2,
// ...
};
When I click on .myFunction() in app.ts I expect to navigate to myModule.ts file but this doesn't happen
当我在app.ts中单击.myFunction()时,我希望导航到myModule.ts文件,但这不会发生
This is working fine in the current WebStorm release. 在当前的WebStorm版本中,此方法运行良好。
I found out the problem, my example in question was simplified too much. 我发现了问题,所讨论的示例简化得太多了。 In real code we are using:
在实际代码中,我们使用:
export: {
myFunction1,
myFunction2
// ...
};
and this really doesn't work. 这真的行不通。
I have to change it to: 我必须将其更改为:
export function myFunction1() { /* impl */ }
export function myFunction2() { /* impl */ }
then it works. 然后就可以了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.