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

Support TypeScript 4.3 #10945

Merged
merged 3 commits into from May 25, 2021
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
26 changes: 26 additions & 0 deletions changelog_unreleased/typescript/10945.md
@@ -0,0 +1,26 @@
#### Support TypeScript 4.3 (#10945 by @sosukesuzuki)

##### [`override` modifiers in class elements](https://devblogs.microsoft.com/typescript/announcing-typescript-4-3-rc/#override-and-the-noimplicitoverride-flag)

```ts
class Foo extends {
override method() {}
}
```

##### [static index signatures (`[key: KeyType]: ValueType`) in classes](https://devblogs.microsoft.com/typescript/announcing-typescript-4-3-rc/#static-index-signatures)

```ts
class Foo {
static [key: string]: Bar;
}
```

##### [`get` / `set` in type declarations](https://devblogs.microsoft.com/typescript/announcing-typescript-4-3-rc/#separate-write-types-on-properties)

```ts
interface Foo {
set foo(value);
get foo(): string;
}
```
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -25,7 +25,7 @@
"@babel/parser": "7.14.3",
"@glimmer/syntax": "0.79.2",
"@iarna/toml": "2.2.5",
"@typescript-eslint/typescript-estree": "4.24.0",
"@typescript-eslint/typescript-estree": "4.25.0",
"angular-estree-parser": "2.3.0",
"angular-html-parser": "1.8.0",
"camelcase": "6.2.0",
Expand Down Expand Up @@ -79,7 +79,7 @@
"semver": "7.3.5",
"string-width": "4.2.2",
"strip-ansi": "6.0.0",
"typescript": "4.2.4",
"typescript": "4.3.1-rc",
"unicode-regex": "3.0.0",
"unified": "9.2.1",
"vnopts": "1.0.2",
Expand Down
Expand Up @@ -60,68 +60,6 @@ class Bar {
================================================================================
`;

exports[`ts-4.3-override-modifier.ts format 1`] = `
====================================options=====================================
parsers: ["babel-ts"]
printWidth: 80
| printWidth
=====================================input======================================
class MyClass extends BaseClass {
override show() {}
public override show() {}
override size = 5;
override readonly size = 5;
}

=====================================output=====================================
class MyClass extends BaseClass {
override show() {}
public override show() {}
override size = 5;
override readonly size = 5;
}

================================================================================
`;

exports[`ts4.3-type-members-get-set.ts format 1`] = `
====================================options=====================================
parsers: ["babel-ts"]
printWidth: 80
| printWidth
=====================================input======================================
interface Foo {
get foo(): string;
set bar(v);
}

type Foo = {
get foo(): string;
set bar(v);
}

interface Foo {
set bar(foo: string);
}

=====================================output=====================================
interface Foo {
get foo(): string;
set bar(v);
}

type Foo = {
get foo(): string;
set bar(v);
};

interface Foo {
set bar(foo: string);
}

================================================================================
`;

exports[`tuple-labeled-ts.ts format 1`] = `
====================================options=====================================
parsers: ["babel-ts"]
Expand Down
@@ -0,0 +1,25 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`override-modifier.ts format 1`] = `
====================================options=====================================
parsers: ["typescript"]
printWidth: 80
| printWidth
=====================================input======================================
class MyClass extends BaseClass {
override show() {}
public override show() {}
override size = 5;
override readonly size = 5;
}

=====================================output=====================================
class MyClass extends BaseClass {
override show() {}
public override show() {}
override size = 5;
override readonly size = 5;
}

================================================================================
`;
1 change: 1 addition & 0 deletions tests/format/typescript/override-modifiers/jsfmt.spec.js
@@ -0,0 +1 @@
run_spec(__dirname, ["typescript"]);
@@ -0,0 +1,39 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`type-member-get-set.ts format 1`] = `
====================================options=====================================
parsers: ["typescript"]
printWidth: 80
| printWidth
=====================================input======================================
interface Foo {
get foo(): string;
set bar(v);
}

type Foo = {
get foo(): string;
set bar(v);
}

interface Foo {
set bar(foo: string);
}

=====================================output=====================================
interface Foo {
get foo(): string;
set bar(v);
}

type Foo = {
get foo(): string;
set bar(v);
};

interface Foo {
set bar(foo: string);
}

================================================================================
`;
1 change: 1 addition & 0 deletions tests/format/typescript/type-member-get-set/jsfmt.spec.js
@@ -0,0 +1 @@
run_spec(__dirname, ["typescript"]);
39 changes: 20 additions & 19 deletions yarn.lock
Expand Up @@ -1660,10 +1660,10 @@
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.19.0.tgz#5181d5d2afd02e5b8f149ebb37ffc8bd7b07a568"
integrity sha512-A4iAlexVvd4IBsSTNxdvdepW0D4uR/fwxDrKUa+iEY9UWvGREu2ZyB8ylTENM1SH8F7bVC9ac9+si3LWNxcBuA==

"@typescript-eslint/types@4.24.0":
version "4.24.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.24.0.tgz#6d0cca2048cbda4e265e0c4db9c2a62aaad8228c"
integrity sha512-tkZUBgDQKdvfs8L47LaqxojKDE+mIUmOzdz7r+u+U54l3GDkTpEbQ1Jp3cNqqAU9vMUCBA1fitsIhm7yN0vx9Q==
"@typescript-eslint/types@4.25.0":
version "4.25.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.25.0.tgz#0e444a5c5e3c22d7ffa5e16e0e60510b3de5af87"
integrity sha512-+CNINNvl00OkW6wEsi32wU5MhHti2J25TJsJJqgQmJu3B3dYDBcmOxcE5w9cgoM13TrdE/5ND2HoEnBohasxRQ==

"@typescript-eslint/typescript-estree@4.19.0":
version "4.19.0"
Expand All @@ -1678,13 +1678,13 @@
semver "^7.3.2"
tsutils "^3.17.1"

"@typescript-eslint/typescript-estree@4.24.0":
version "4.24.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.24.0.tgz#b49249679a98014d8b03e8d4b70864b950e3c90f"
integrity sha512-kBDitL/by/HK7g8CYLT7aKpAwlR8doshfWz8d71j97n5kUa5caHWvY0RvEUEanL/EqBJoANev8Xc/mQ6LLwXGA==
"@typescript-eslint/typescript-estree@4.25.0":
version "4.25.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.25.0.tgz#942e4e25888736bff5b360d9b0b61e013d0cfa25"
integrity sha512-1B8U07TGNAFMxZbSpF6jqiDs1cVGO0izVkf18Q/SPcUAc9LhHxzvSowXDTvkHMWUVuPpagupaW63gB6ahTXVlg==
dependencies:
"@typescript-eslint/types" "4.24.0"
"@typescript-eslint/visitor-keys" "4.24.0"
"@typescript-eslint/types" "4.25.0"
"@typescript-eslint/visitor-keys" "4.25.0"
debug "^4.1.1"
globby "^11.0.1"
is-glob "^4.0.1"
Expand All @@ -1699,12 +1699,12 @@
"@typescript-eslint/types" "4.19.0"
eslint-visitor-keys "^2.0.0"

"@typescript-eslint/visitor-keys@4.24.0":
version "4.24.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.24.0.tgz#a8fafdc76cad4e04a681a945fbbac4e35e98e297"
integrity sha512-4ox1sjmGHIxjEDBnMCtWFFhErXtKA1Ec0sBpuz0fqf3P+g3JFGyTxxbF06byw0FRsPnnbq44cKivH7Ks1/0s6g==
"@typescript-eslint/visitor-keys@4.25.0":
version "4.25.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.25.0.tgz#863e7ed23da4287c5b469b13223255d0fde6aaa7"
integrity sha512-AmkqV9dDJVKP/TcZrbf6s6i1zYXt5Hl8qOLrRDTFfRNae4+LB8A4N3i+FLZPW85zIxRy39BgeWOfMS3HoH5ngg==
dependencies:
"@typescript-eslint/types" "4.24.0"
"@typescript-eslint/types" "4.25.0"
eslint-visitor-keys "^2.0.0"

"@webassemblyjs/ast@1.11.0":
Expand Down Expand Up @@ -3129,6 +3129,7 @@ eslint-plugin-jest@24.3.6:

"eslint-plugin-prettier-internal-rules@link:scripts/tools/eslint-plugin-prettier-internal-rules":
version "0.0.0"
uid ""

eslint-plugin-react@7.23.2:
version "7.23.2"
Expand Down Expand Up @@ -6941,10 +6942,10 @@ typedarray-to-buffer@^3.1.5:
dependencies:
is-typedarray "^1.0.0"

typescript@4.2.4:
version "4.2.4"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.2.4.tgz#8610b59747de028fda898a8aef0e103f156d0961"
integrity sha512-V+evlYHZnQkaz8TRBuxTA92yZBPotr5H+WhQ7bD3hZUndx5tGOa1fuCgeSjxAzM1RiN5IzvadIXTVefuuwZCRg==
typescript@4.3.1-rc:
version "4.3.1-rc"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.3.1-rc.tgz#925149c8d8514e20a6bd8d4bd7f42adac67ab59c"
integrity sha512-L3uJ0gcntaRaKni9aV2amYB+pCDVodKe/B5+IREyvtKGsDOF7cYjchHb/B894skqkgD52ykRuWatIZMqEsHIqA==

unherit@^1.0.4:
version "1.1.3"
Expand Down