Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError when importing from 'typescript' in file #47

Closed
qlonik opened this issue Jun 5, 2020 · 2 comments
Closed

TypeError when importing from 'typescript' in file #47

qlonik opened this issue Jun 5, 2020 · 2 comments

Comments

@qlonik
Copy link

qlonik commented Jun 5, 2020

Whenever I have imports from 'typescript' module, I get type error: TypeError: Cannot read property 'type' of null. I'm not sure if it is caused by this package or is coming from somewhere else. However, when I comment out the line 'import/resolver': { typescript: { alwaysTryTypes: true } }, in .eslintrc.js file, then the file gets properly linted.

I created a small reproduction here: https://github.com/qlonik/eslint-import-resolver-typescript-repro

@JounQin
Copy link
Collaborator

JounQin commented Jun 6, 2020

The error message is as following:

TypeError: Cannot read property 'type' of null
Occurred while linting /workspace/eslint-import-resolver-typescript-repro/src.ts:1
    at /workspace/eslint-import-resolver-typescript-repro/node_modules/eslint-plugin-import/lib/ExportMap.js:569:30
    at Array.forEach (<anonymous>)
    at /workspace/eslint-import-resolver-typescript-repro/node_modules/eslint-plugin-import/lib/ExportMap.js:565:32
    at Array.forEach (<anonymous>)
    at /workspace/eslint-import-resolver-typescript-repro/node_modules/eslint-plugin-import/lib/ExportMap.js:563:19
    at Array.forEach (<anonymous>)
    at Function.ExportMap.parse (/workspace/eslint-import-resolver-typescript-repro/node_modules/eslint-plugin-import/lib/ExportMap.js:477:12)
    at Function.ExportMap.for (/workspace/eslint-import-resolver-typescript-repro/node_modules/eslint-plugin-import/lib/ExportMap.js:361:25)
    at Function.ExportMap.get (/workspace/eslint-import-resolver-typescript-repro/node_modules/eslint-plugin-import/lib/ExportMap.js:316:23)
    at processBodyStatement (/workspace/eslint-import-resolver-typescript-repro/node_modules/eslint-plugin-import/lib/rules/namespace.js:67:47)

As you can see it comes from eslint-plugin-import, and if you lock "eslint-plugin-import": "~2.18.2", it will just work.

I've post a new issue at import-js/eslint-plugin-import#1801 instead.

@qlonik
Copy link
Author

qlonik commented Jun 12, 2020

Thank you for filing it upstream and resolving it with the maintainer of the upstream package. I really appreciate it 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants