Typescript: CodeFix for missing import should take into acount @types

Created on 22 Dec 2016  路  5Comments  路  Source: microsoft/TypeScript

image

Bug Fixed

Most helpful comment

Looks like there's an issue when it comes to using path mapping. Thanks!

All 5 comments

I do not repro though on my machine:

image

Can you post a sample code? Thanks

Sure, here is the the sample: https://github.com/wallverb/test
Clone, npm install and I get this:

image

Looks like it might be related to "baseUrl": "." in tsconfig.json

First screenshot was from project that had such tsconfig:

...
        "baseUrl": ".",
        "paths": {
            "base/*": [
                "base/*"
            ],
            "common/*": [
                "common/*"
            ],
            "*": [
                "node_modules/*"
            ]
        }

I feel like you need to change this to

            "*": [
                "node_modules/@types/*"
                "node_modules/*"
            ]

or just omit the entire "*" field if you're using "moduleResolution": "node"

@DanielRosenwasser - Thanks - first suggestion does the trick

If I omit entire '*' field and have "moduleResultion": "node" then I get this (I guess due to "baseUrl": "."):

image

Looks like there's an issue when it comes to using path mapping. Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kyasbal-1994 picture kyasbal-1994  路  3Comments

zhuravlikjb picture zhuravlikjb  路  3Comments

manekinekko picture manekinekko  路  3Comments

Antony-Jones picture Antony-Jones  路  3Comments

weswigham picture weswigham  路  3Comments