This repository was archived by the owner on Jan 19, 2019. It is now read-only.
This repository was archived by the owner on Jan 19, 2019. It is now read-only.
Unnecessary TypeReference wrapper for ImportType in TypeReference's typeParameters #507
Closed
Description
What version of TypeScript are you using?
3.0.1
What version of typescript-eslint-parser
are you using?
17.0.1
What code were you trying to parse?
type X = A<import("").B<any>>;
What did you expect to happen?
{
"type": "Program",
"body": [
{
"type": "VariableDeclaration",
"kind": "type",
"declarations": [
{
"type": "VariableDeclarator",
"id": { "type": "Identifier", "name": "X" },
"init": {
"type": "TSTypeReference",
"typeName": { "type": "Identifier", "name": "A" },
"typeParameters": {
"type": "TSTypeParameterInstantiation",
"params": [
{
"type": "TSImportType",
"argument": {
"type": "TSLiteralType",
"literal": {
"type": "Literal",
"raw": "\"\"",
"value": ""
}
},
"qualifier": { "type": "Identifier", "name": "B" },
"typeParameters": {
"type": "TSTypeParameterInstantiation",
"params": [{ "type": "TSAnyKeyword" }]
}
}
]
}
}
}
]
}
],
"sourceType": "script"
}
What happened?
{
"type": "Program",
"body": [
{
"type": "VariableDeclaration",
"kind": "type",
"declarations": [
{
"type": "VariableDeclarator",
"id": { "type": "Identifier", "name": "X" },
"init": {
"type": "TSTypeReference",
"typeName": { "type": "Identifier", "name": "A" },
"typeParameters": {
"type": "TSTypeParameterInstantiation",
"params": [
{
+ "type": "TSTypeReference",
+ "typeName": {
- "type": "TSImportType",
+ "type": "TSLastTypeNode",
"argument": {
"type": "TSLiteralType",
"literal": {
"type": "Literal",
"raw": "\"\"",
"value": ""
}
},
"qualifier": { "type": "Identifier", "name": "B" },
"typeParameters": {
"type": "TSTypeParameterInstantiation",
"params": [{ "type": "TSAnyKeyword" }]
}
+ },
+ "typeParameters": {
+ "type": "TSTypeParameterInstantiation",
+ "params": [{ "type": "TSAnyKeyword" }]
+ }
}
]
}
}
}
]
}
],
"sourceType": "script"
}
Original post: prettier/prettier#4938