Typescript - module import paths + code hints

Hey everyone,

I'm fairly new to WebStorm and Typescript (Flash refugee) and am running into some issues using the AMD module imports within WebStorm, but am assuming a) I'm doing it wrong or b) there is a configuration that is evading my grasp.  Here is the situation:

- Having previously created the project in FlashDevelop (no code-hinting), I used abolute paths for my import statements (import myModule = module ('app/view/ViewModule'))
- The project was compiled using tsc targetting a top level base class.  compiled and ran fine
- After moving over to WebStorm to get some tasty code hints, I was hit with many red squiggles informing me that it couldn't resolve the paths to my modules
- Changing all import statements to use relative paths fixed the warnings and re-enabled code-hinting. However, running the project as before caused runtimes errors with requirejs as the relative paths didnt jive with the way requirejs looks for files.

The options I've considered to fix the issue were either to flatten up my file structure, or create additional entries in my requirejs config to square up the various possible paths.  But neither of those are particularly desirable.

Is there something I am missing akin to setting a global class path within WebStorm for type-checking with Typescript?


Comment actions Permalink

On further inspection it seems like modifying the import paths to strictly relative paths (including just adding ./) allowed for both code hints and requirejs to behave.  I haven't run this through the optimizer, but so far so good.

It would still be great to be able to use a requirejs like baseUrl for the intellisense lookup though, as it seems necessary to be able to use path aliasing and shims for some external libraries.

Comment actions Permalink

Hi Brad,
We actually have some problems with TypeScript reference paths and import statements, but in progress of fixing them, including absolute paths. Please watch WEB-2033 to get notification when it is fixed.

Best regards,

Comment actions Permalink

great to hear, thank you!


Please sign in to leave a comment.