pmneo / ts-importer

MIT License
73 stars 8 forks source link

Importing from node_modules/@types is broken #30

Open iyegoroff opened 7 years ago

iyegoroff commented 7 years ago

If tsimporter.preferRelative is true import statement is not being added automatically when selecting symbol from drop-down menu.

pmneo commented 7 years ago

Please take a look into the dev console for any error outputs and paste in here.

iyegoroff commented 7 years ago

file: 'file:///Users/iyegoroff/Documents/dev/js/ts-test/test.ts' severity: 'Error' message: 'Cannot find name 'Component'.' at: '1,1' source: 'ts'

pmneo commented 7 years ago

Please provide a sample project.

iyegoroff commented 7 years ago

https://github.com/iyegoroff/ts-importer-bug

Autoimporting works only for Something symbol, but not for Component.

ts-importer symbols

{
    "knownSymbols": {
        "Component": [
            {
                "name": "Component",
                "module": "react",
                "isDefault": false
            }
        ],
        "Something": [
            {
                "name": "Something",
                "path": "/Users/iyegoroff/Documents/dev/js/ts-test/temp.ts",
                "type": "const",
                "isDefault": false
            }
        ]
    }
}
pmneo commented 7 years ago

This is currently not implemented. See Todo section:

Follow up /// declarations Process node_modules/*/.d.ts Process typings/*/.d.ts

Those can just be imported if a import statement exists in any ts file

k8w commented 7 years ago

So have this is implemented now?

pmneo commented 7 years ago

No ... This is hard work to do, because of the wildcard export feature like export * from './zone'; which may be nested too.