Skip to content

Commit

Permalink
Update @typescript-eslint/typescript-estree to support satisfies (p…
Browse files Browse the repository at this point in the history
…rettier#13872)

* Update to `5.43.1-alpha.22`

* Update snapshots for satisfies

* Update changelog

* Remove `@ts-expect-error` comment

* Yarn dedupe

* Update to stable version

* Fix changelog

* Fix changelog
  • Loading branch information
sosukesuzuki authored and medikoo committed Jan 4, 2024
1 parent 456b790 commit 6765cfc
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 319 deletions.
10 changes: 6 additions & 4 deletions changelog_unreleased/typescript/13764.md
@@ -1,10 +1,8 @@
#### Support TypeScript 4.9 (#13764, #13783 by @sosukesuzuki)
#### Support TypeScript 4.9 (#13764, #13783, #13872 by @sosukesuzuki)

Support [TypeScript 4.9](https://devblogs.microsoft.com/typescript/announcing-typescript-4-9) features!

##### [`satisfies` operator](https://devblogs.microsoft.com/typescript/announcing-typescript-4-9-beta/#the-satisfies-operator)

Supported by only `babel-ts` parser.
##### [`satisfies` operator](https://devblogs.microsoft.com/typescript/announcing-typescript-4-9/#satisfies)

<!-- prettier-ignore -->
```tsx
Expand All @@ -14,3 +12,7 @@ const palette = {
blue: [0, 0, 255]
} satisfies Record<Colors, string | RGB>;
```

##### [Auto-Accessors in Classes](https://devblogs.microsoft.com/typescript/announcing-typescript-4-9/#auto-accessors-in-classes)

**Auto-Accessors in Classes is not yet supported.**
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -27,7 +27,7 @@
"@babel/parser": "7.20.1",
"@glimmer/syntax": "0.84.2",
"@iarna/toml": "2.2.5",
"@typescript-eslint/typescript-estree": "5.36.2",
"@typescript-eslint/typescript-estree": "5.44.0",
"acorn": "8.8.0",
"acorn-jsx": "5.3.2",
"angular-estree-parser": "2.5.1",
Expand Down
1 change: 0 additions & 1 deletion src/language-js/utils/index.js
Expand Up @@ -999,7 +999,6 @@ function startsWithNoLookaheadToken(node, forbidFunctionClassAndDoExpr) {
node.expressions[0],
forbidFunctionClassAndDoExpr
);
// @ts-expect-error
case "TSSatisfiesExpression":
case "TSAsExpression":
case "TSNonNullExpression":
Expand Down
Expand Up @@ -2,7 +2,7 @@

exports[`argument-expansion.ts - {"semi":false} format 1`] = `
====================================options=====================================
parsers: ["babel-ts"]
parsers: ["typescript"]
printWidth: 80
semi: false
| printWidth
Expand Down Expand Up @@ -54,7 +54,7 @@ const bar5 = [1, 2, 3].reduce((carry, value) => {

exports[`argument-expansion.ts format 1`] = `
====================================options=====================================
parsers: ["babel-ts"]
parsers: ["typescript"]
printWidth: 80
| printWidth
=====================================input======================================
Expand Down Expand Up @@ -105,7 +105,7 @@ const bar5 = [1, 2, 3].reduce((carry, value) => {

exports[`assignment.ts - {"semi":false} format 1`] = `
====================================options=====================================
parsers: ["babel-ts"]
parsers: ["typescript"]
printWidth: 80
semi: false
| printWidth
Expand Down Expand Up @@ -161,7 +161,7 @@ this.intervalID = setInterval(() => {

exports[`assignment.ts format 1`] = `
====================================options=====================================
parsers: ["babel-ts"]
parsers: ["typescript"]
printWidth: 80
| printWidth
=====================================input======================================
Expand Down Expand Up @@ -216,7 +216,7 @@ this.intervalID = setInterval(() => {

exports[`basic.ts - {"semi":false} format 1`] = `
====================================options=====================================
parsers: ["babel-ts"]
parsers: ["typescript"]
printWidth: 80
semi: false
| printWidth
Expand Down Expand Up @@ -289,7 +289,7 @@ var v = undefined satisfies 1

exports[`basic.ts format 1`] = `
====================================options=====================================
parsers: ["babel-ts"]
parsers: ["typescript"]
printWidth: 80
| printWidth
=====================================input======================================
Expand Down Expand Up @@ -361,7 +361,7 @@ var v = undefined satisfies 1;

exports[`comments.ts - {"semi":false} format 1`] = `
====================================options=====================================
parsers: ["babel-ts"]
parsers: ["typescript"]
printWidth: 80
semi: false
| printWidth
Expand All @@ -380,7 +380,7 @@ const t4 = {} /* comment1 */ satisfies /* comment2 */ {}

exports[`comments.ts format 1`] = `
====================================options=====================================
parsers: ["babel-ts"]
parsers: ["typescript"]
printWidth: 80
| printWidth
=====================================input======================================
Expand All @@ -398,7 +398,7 @@ const t4 = {} /* comment1 */ satisfies /* comment2 */ {};

exports[`comments-unstable.ts - {"semi":false} format 1`] = `
====================================options=====================================
parsers: ["babel-ts"]
parsers: ["typescript"]
printWidth: 80
semi: false
| printWidth
Expand All @@ -420,7 +420,7 @@ Record<string, number>

exports[`comments-unstable.ts format 1`] = `
====================================options=====================================
parsers: ["babel-ts"]
parsers: ["typescript"]
printWidth: 80
| printWidth
=====================================input======================================
Expand All @@ -441,7 +441,7 @@ Record<string, number>;

exports[`export-default-as.ts - {"semi":false} format 1`] = `
====================================options=====================================
parsers: ["babel-ts"]
parsers: ["typescript"]
printWidth: 80
semi: false
| printWidth
Expand All @@ -456,7 +456,7 @@ export default (function log() {} satisfies typeof console.log)

exports[`export-default-as.ts format 1`] = `
====================================options=====================================
parsers: ["babel-ts"]
parsers: ["typescript"]
printWidth: 80
| printWidth
=====================================input======================================
Expand All @@ -470,7 +470,7 @@ export default (function log() {} satisfies typeof console.log);

exports[`gt-lt.ts - {"semi":false} format 1`] = `
====================================options=====================================
parsers: ["babel-ts"]
parsers: ["typescript"]
printWidth: 80
semi: false
| printWidth
Expand All @@ -487,7 +487,7 @@ x satisfies boolean ?? y; // (x satisfies boolean) ?? y;

exports[`gt-lt.ts format 1`] = `
====================================options=====================================
parsers: ["babel-ts"]
parsers: ["typescript"]
printWidth: 80
| printWidth
=====================================input======================================
Expand All @@ -503,7 +503,7 @@ x satisfies boolean ?? y; // (x satisfies boolean) ?? y;

exports[`hug-args.ts - {"semi":false} format 1`] = `
====================================options=====================================
parsers: ["babel-ts"]
parsers: ["typescript"]
printWidth: 80
semi: false
| printWidth
Expand All @@ -526,7 +526,7 @@ window.postMessage({

exports[`hug-args.ts format 1`] = `
====================================options=====================================
parsers: ["babel-ts"]
parsers: ["typescript"]
printWidth: 80
| printWidth
=====================================input======================================
Expand All @@ -548,7 +548,7 @@ window.postMessage({

exports[`lhs.ts - {"semi":false} format 1`] = `
====================================options=====================================
parsers: ["babel-ts"]
parsers: ["typescript"]
printWidth: 80
semi: false
| printWidth
Expand Down Expand Up @@ -576,7 +576,7 @@ semi: false

exports[`lhs.ts format 1`] = `
====================================options=====================================
parsers: ["babel-ts"]
parsers: ["typescript"]
printWidth: 80
| printWidth
=====================================input======================================
Expand All @@ -603,7 +603,7 @@ printWidth: 80

exports[`nested-await-and-satisfies.ts - {"semi":false} format 1`] = `
====================================options=====================================
parsers: ["babel-ts"]
parsers: ["typescript"]
printWidth: 80
semi: false
| printWidth
Expand Down Expand Up @@ -631,7 +631,7 @@ const getAccountCount = async () =>

exports[`nested-await-and-satisfies.ts format 1`] = `
====================================options=====================================
parsers: ["babel-ts"]
parsers: ["typescript"]
printWidth: 80
| printWidth
=====================================input======================================
Expand All @@ -658,7 +658,7 @@ const getAccountCount = async () =>

exports[`non-null.ts - {"semi":false} format 1`] = `
====================================options=====================================
parsers: ["babel-ts"]
parsers: ["typescript"]
printWidth: 80
semi: false
| printWidth
Expand All @@ -677,7 +677,7 @@ const el = ReactDOM.findDOMNode(ref)

exports[`non-null.ts format 1`] = `
====================================options=====================================
parsers: ["babel-ts"]
parsers: ["typescript"]
printWidth: 80
| printWidth
=====================================input======================================
Expand All @@ -695,7 +695,7 @@ const el = ReactDOM.findDOMNode(ref);

exports[`satisfies.ts - {"semi":false} format 1`] = `
====================================options=====================================
parsers: ["babel-ts"]
parsers: ["typescript"]
printWidth: 80
semi: false
| printWidth
Expand Down Expand Up @@ -750,7 +750,7 @@ foo as unknown satisfies Bar

exports[`satisfies.ts format 1`] = `
====================================options=====================================
parsers: ["babel-ts"]
parsers: ["typescript"]
printWidth: 80
| printWidth
=====================================input======================================
Expand Down Expand Up @@ -804,7 +804,7 @@ foo as unknown satisfies Bar;

exports[`template-literal.ts - {"semi":false} format 1`] = `
====================================options=====================================
parsers: ["babel-ts"]
parsers: ["typescript"]
printWidth: 80
semi: false
| printWidth
Expand Down Expand Up @@ -836,7 +836,7 @@ const b = \`\${

exports[`template-literal.ts format 1`] = `
====================================options=====================================
parsers: ["babel-ts"]
parsers: ["typescript"]
printWidth: 80
| printWidth
=====================================input======================================
Expand Down Expand Up @@ -867,7 +867,7 @@ const b = \`\${

exports[`ternary.ts - {"semi":false} format 1`] = `
====================================options=====================================
parsers: ["babel-ts"]
parsers: ["typescript"]
printWidth: 80
semi: false
| printWidth
Expand Down Expand Up @@ -970,7 +970,7 @@ bifornCringerMoshedPerplexSawder =

exports[`ternary.ts format 1`] = `
====================================options=====================================
parsers: ["babel-ts"]
parsers: ["typescript"]
printWidth: 80
| printWidth
=====================================input======================================
Expand Down Expand Up @@ -1072,7 +1072,7 @@ bifornCringerMoshedPerplexSawder =

exports[`types-comments.ts - {"semi":false} format 1`] = `
====================================options=====================================
parsers: ["babel-ts"]
parsers: ["typescript"]
printWidth: 80
semi: false
| printWidth
Expand All @@ -1091,7 +1091,7 @@ semi: false

exports[`types-comments.ts format 1`] = `
====================================options=====================================
parsers: ["babel-ts"]
parsers: ["typescript"]
printWidth: 80
| printWidth
=====================================input======================================
Expand Down
4 changes: 2 additions & 2 deletions tests/format/typescript/satisfies-operators/jsfmt.spec.js
@@ -1,2 +1,2 @@
run_spec(__dirname, ["babel-ts"]);
run_spec(__dirname, ["babel-ts"], { semi: false });
run_spec(__dirname, ["typescript"]);
run_spec(__dirname, ["typescript"], { semi: false });

0 comments on commit 6765cfc

Please sign in to comment.