-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Labels
lang:typescriptIssues affecting TypeScript-specific constructs (not general JS issues)Issues affecting TypeScript-specific constructs (not general JS issues)locked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.Please open a new issue and fill out the template instead of commenting.type:testsIssues about tests that are not correct, should be added, or similarIssues about tests that are not correct, should be added, or similar
Description
Prettier 1.16.4
Due to inconsistency in reported ast by typescript parser, there is issue with some of typeParameters and typeArguments, in some cases parser outputs TSTypeParameterInstantiation
and TSTypeParameterDeclaration
with empty array of params
in PR https://github.com/typescript-eslint/typescript-eslint/pull/223i proposed change to make all occurrences of this consistent across all nodes. It means that all occurrences of <>
are going to lead to crash in this package, as opposed to only sometimes.
TSTypeParameterInstantiation
and TSTypeParameterDeclaration
with empty array of params
should be supported
Input:
interface foo {
foo<>();
}
Output:
TypeError: Cannot read property 'pos' of undefined
at https://prettier.io/lib/parser-typescript.js:1:2122250
at T (https://prettier.io/lib/parser-typescript.js:1:2123933)
at t (https://prettier.io/lib/parser-typescript.js:1:2122204)
at Object.h [as findNextToken] (https://prettier.io/lib/parser-typescript.js:1:2122387)
at b (https://prettier.io/lib/parser-typescript.js:1:2128676)
at e (https://prettier.io/lib/parser-typescript.js:1:2155613)
at d (https://prettier.io/lib/parser-typescript.js:1:2127555)
at m (https://prettier.io/lib/parser-typescript.js:1:2127698)
at https://prettier.io/lib/parser-typescript.js:1:2157681
at Array.map (<anonymous>)
Reference:
- Incosistent AST for typeArgument and typeParameters typescript-eslint/typescript-eslint#220
- fix(ts-estree): align typeArguments and typeParameters across nodes typescript-eslint/typescript-eslint#223
- feat(ts-estree): enable 1098,1099 errors and add missing tests typescript-eslint/typescript-eslint#219
Metadata
Metadata
Assignees
Labels
lang:typescriptIssues affecting TypeScript-specific constructs (not general JS issues)Issues affecting TypeScript-specific constructs (not general JS issues)locked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.Please open a new issue and fill out the template instead of commenting.type:testsIssues about tests that are not correct, should be added, or similarIssues about tests that are not correct, should be added, or similar