'Add import statement' context action ignores project settings for import paths

In my project settings for WebStorm, I have the "Use paths relative to tsconfig.json" unchecked. I expect that when I run the 'Add import statement' context action, it will then add an import using the relative path (e.g. "../path/to/file" instead of "src/path/to/file", assuming the file is in src/). Regardless of whether I have this setting checked or unchecked, WebStorm alway uses the absolute path ("src/...") instead of the relative path. 

0
3 comments

Do you have any path mappings defined in your tsconfig.json?

0

Path mappings look like this in my tsconfig.json:

 

"baseUrl": "./src",
"paths": {
"src/*": ["./src/*"]
}
0

this is expected then - the path mappings are used for auto-import unless the Use path mappings from tsconfig.json is disabled in Settings | Editor | Code Style | TypeScript | Imports

0

Please sign in to leave a comment.