-
-
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 type" from TypeScript 3.8 not recognized #1667
Comments
3.8 is brand new, so we definitely need updates to work with it, probably on many rules. |
I think this PR may fix this specific issue with type imports: #1666 |
Just so we're all on the same page, I thought I'd confirm where we're all coming from. If I understand correctly:
Please correct me if I misunderstood either of you. |
Sorry, I was only speculating because I saw the plugin had support for |
No worries! I'm not seeing the string |
I was actually looking into this myself for a bit, but I don't see any other related PR. |
#1667 (comment) matches my understanding. a PR to do that, with tests, would be appreciated. |
Seems TypeScript ESLint currently ( For future reference, here's the test I was writing: context('TypeScript', function() {
getNonDefaultParsers().forEach((parser) => {
const parserConfig = {
parser: parser,
settings: {
'import/parsers': { [parser]: ['.ts'] },
'import/resolver': { 'eslint-import-resolver-typescript': true },
},
}
ruleTester.run('no-duplicates', rule, {
valid: [
// #1667: ignore duplicate if is a typescript type import
test(
{
code: "import type { x } from './foo'; import y from './foo'",
parser,
},
parserConfig,
),
],
invalid: [],
})
})
}) "@typescript-eslint/parser": "^2.22.0",
"eslint-import-resolver-typescript": "^2.0.0",
"typescript": "^3.8.3", As of these TypeScript ESLint package versions, it will produce the error:
|
Thanks, that makes sense. If you want to open a PR (which would fail until the new version is released) that'd still be appreciated. |
rule |
After upgrading to TypeScript 3.8.2 I also use the new "import type" feature https://www.typescriptlang.org/docs/handbook/modules.html#importing-types. Now I'm getting a warning from import/no-duplicates.
My affected code is e.g.:
The text was updated successfully, but these errors were encountered: