-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Support TypeScript 4.1 via typescript-estree #9636
Changes from 8 commits
5d5a4f0
0e801c9
a04127a
599f5f1
ca42089
27e7b46
a918330
589a689
cd545a8
8cb07ca
c31a3df
c563159
6c20946
4fc37c7
27a4473
5b15eb2
1484a2e
9a94c6b
1209987
9571318
a760c59
53fff41
5978c26
6ba07e0
4f693ed
ae8071d
9de9bc7
80cf659
07ed145
768e593
93a44d7
b048b0b
ff1ed80
24cfed1
beae5e1
1b7d159
109aa25
b4dd8c8
4f35ff3
7c65de6
be58419
e06ae5e
42913c2
702aeeb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -129,6 +129,19 @@ function postprocess(ast, options) { | |
node.optional = true; | ||
} | ||
break; | ||
case "TSTemplateLiteralType": { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should print this, not transform it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have no strong opinion. Out of curiosity, why? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe we'll support |
||
const { types, quasis, ...rest } = node; | ||
return { | ||
...rest, | ||
type: "TSLiteralType", | ||
literal: { | ||
...rest, | ||
type: "TemplateLiteral", | ||
expressions: types, | ||
quasis, | ||
}, | ||
}; | ||
} | ||
} | ||
}); | ||
|
||
|
@@ -157,6 +170,8 @@ function transformChainExpression(node) { | |
} else if (node.type === "MemberExpression") { | ||
node.type = "OptionalMemberExpression"; | ||
node.object = transformChainExpression(node.object); | ||
} else if (node.type === "TSNonNullExpression") { | ||
node.expression = transformChainExpression(node.expression); | ||
} | ||
return node; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
run_spec(__dirname, ["babel-ts", "typescript"], { | ||
errors: { typescript: true }, | ||
}); | ||
run_spec(__dirname, ["babel-ts", "typescript"]); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
run_spec(__dirname, ["babel-ts", "typescript"], { | ||
errors: { typescript: true }, | ||
}); | ||
run_spec(__dirname, ["babel-ts", "typescript"]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know why, but this change removes the TypeScript typecheck error. Why...?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe #9207