-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Import of Typescript interface is not recognised correctly #1120
Comments
Historically eslint (and thus, eslint plugins) have only supported Flow, not TypeScript. I think adding typescript support is a pretty massive effort, but if it can be done easily, that sounds fine. |
Just ran into this, too: import moment, {Moment} from 'moment'; error:
|
In that case, moment is CJS, so it only has a default export. |
TypeScript also pulls in the type information from it's https://github.com/moment/moment/blob/develop/moment.d.ts#L413 |
#1282 is nearly a duplicate of this, but this issue also includes types provides through external I'm not sure if it is possible to deal with this 100% correctly without a full type checker pass; a possible workaround is to check if there is a
|
After upgrading to |
Awesome, closing (happy to reopen if people are still experiencing it) |
Unfortunately, this issue still exists in 2.17.2 (using @typescript-eslint/parser as recommended in the Typescript section of eslint-plugin-import Readme [not the now deprecated typescript-eslint-parser mentioned in the configuration above]) |
@alesn would you mind opening a new issue and shading a minimal reproduction? |
Has this issue been resolved for anyone who uses @typescript-eslint/parser, which should now be used? |
I will double check that and let you know |
@alesn Sorry I forgot to answer you earlier. Yes I am running In .eslintrc.js I have parser: '@typescript-eslint/parser',
overrides: {
files: ['**/*.ts', '**/*.tsx'],
parser: '@typescript-eslint/parser',
rules: {
'import/namespace': 'off',
'import/no-duplicates': 'off',
'import/no-unresolved': 'off',
'no-restricted-globals': 'off',
'no-undef': 'off'
}
}, Hope that helps. |
For anyone arriving from Google - you can work around this with a tip from #1699
import type { unitOfTime } from 'moment'; |
Opening per @ljharb. A similar issue was reported in #726, but this is for Typescript interface imports.
Defined in react-select:
Imported:
Error:
Relevant packages:
The text was updated successfully, but these errors were encountered: