Skip to content
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

Update typescript to v4.9 #13852

Merged
merged 3 commits into from Nov 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -85,7 +85,7 @@
"semver": "7.3.7",
"string-width": "5.0.1",
"strip-ansi": "7.0.1",
"typescript": "4.8.2",
"typescript": "4.9.3",
"unicode-regex": "3.0.0",
"unified": "9.2.1",
"vnopts": "1.0.2",
Expand Down
15 changes: 10 additions & 5 deletions src/language-js/parse/postprocess/typescript.js
Expand Up @@ -4,9 +4,16 @@ const isNonEmptyArray = require("../../../utils/is-non-empty-array.js");
const visitNode = require("./visit-node.js");
const throwSyntaxError = require("./throw-syntax-error.js");

// Taken from `typescript` package
const SyntaxKind = {
AbstractKeyword: 126,
SourceFile: 308,
PropertyDeclaration: 169,
};

// Copied from https://unpkg.com/typescript@4.8.2/lib/typescript.js
function getSourceFileOfNode(node) {
while (node && node.kind !== 305 /* SyntaxKind.SourceFile */) {
while (node && node.kind !== SyntaxKind.SourceFile) {
node = node.parent;
}
return node;
Expand Down Expand Up @@ -36,13 +43,11 @@ function throwErrorForInvalidDecorator(tsNode) {
// Values of abstract property is removed since `@typescript-eslint/typescript-estree` v5
// https://github.com/typescript-eslint/typescript-eslint/releases/tag/v5.0.0
function throwErrorForInvalidAbstractProperty(tsNode, esTreeNode) {
const SYNTAX_KIND_PROPERTY_DEFINITION = 167;
const SYNTAX_KIND_ABSTRACT_KEYWORD = 126;
if (
tsNode.kind !== SYNTAX_KIND_PROPERTY_DEFINITION ||
tsNode.kind !== SyntaxKind.PropertyDeclaration ||
(tsNode.modifiers &&
!tsNode.modifiers.some(
(modifier) => modifier.kind === SYNTAX_KIND_ABSTRACT_KEYWORD
(modifier) => modifier.kind === SyntaxKind.AbstractKeyword
))
) {
return;
Expand Down
14 changes: 7 additions & 7 deletions yarn.lock
Expand Up @@ -1710,9 +1710,9 @@
integrity sha1-7ihweulOEdK4J7y+UnC86n8+ce4=

"@types/node@*":
version "17.0.15"
resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.15.tgz#97779282c09c09577120a2162e71d8380003590a"
integrity sha512-zWt4SDDv1S9WRBNxLFxFRHxdD9tvH8f5/kg5/IaLFdnSNXsDY4eL3Q3XXN+VxUnWIhyVFDwcsmAprvwXoM/ClA==
version "18.11.9"
resolved "https://registry.yarnpkg.com/@types/node/-/node-18.11.9.tgz#02d013de7058cea16d36168ef2fc653464cfbad4"
integrity sha512-CRpX21/kGdzjOpFsZSkcrXMGIBWMGNIHXXBVFSH+ggkftxg+XYP20TESbh+zFvFj3EQOl5byk0HTRn1IL6hbqg==

"@types/normalize-package-data@^2.4.0":
version "2.4.1"
Expand Down Expand Up @@ -6504,10 +6504,10 @@ typedarray-to-buffer@^3.1.5:
dependencies:
is-typedarray "^1.0.0"

typescript@4.8.2:
version "4.8.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.8.2.tgz#e3b33d5ccfb5914e4eeab6699cf208adee3fd790"
integrity sha512-C0I1UsrrDHo2fYI5oaCGbSejwX4ch+9Y5jTQELvovfmFkK3HHSZJB8MSJcWLmCUBzQBchCrZ9rMRV6GuNrvGtw==
typescript@4.9.3:
version "4.9.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.3.tgz#3aea307c1746b8c384435d8ac36b8a2e580d85db"
integrity sha512-CIfGzTelbKNEnLpLdGFgdyKhG23CKdKgQPOBc+OUNrkJ2vr+KSzsSV5kq5iWhEQbok+quxgGzrAtGWCyU7tHnA==

unbox-primitive@^1.0.1:
version "1.0.1"
Expand Down