简体   繁体   中英

Navigating through Typescript references in Webstorm using ES6 module syntax

We are using Typescript with Intellij Webstorm IDE.

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 )

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?

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

This is working fine in the current WebStorm release.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM