Skip to content

Commit

Permalink
Update @typescript-eslint/typescript-estree to support satisfies (#…
Browse files Browse the repository at this point in the history
…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 committed Nov 22, 2022
1 parent fac8761 commit fd37600
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 @@ -998,7 +998,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 @@ -59,7 +59,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 @@ -115,7 +115,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 @@ -171,7 +171,7 @@ this.intervalID = setInterval(() => {

exports[`assignment.ts format 1`] = `
====================================options=====================================
parsers: ["babel-ts"]
parsers: ["typescript"]
printWidth: 80
| printWidth
=====================================input======================================
Expand Down Expand Up @@ -226,7 +226,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 @@ -299,7 +299,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 @@ -371,7 +371,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 @@ -390,7 +390,7 @@ const t4 = {} /* comment1 */ satisfies /* comment2 */ {}

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

exports[`comments-unstable.ts format 1`] = `
====================================options=====================================
parsers: ["babel-ts"]
parsers: ["typescript"]
printWidth: 80
| printWidth
=====================================input======================================
Expand All @@ -459,7 +459,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 @@ -474,7 +474,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 @@ -488,7 +488,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 @@ -505,7 +505,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 @@ -521,7 +521,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 @@ -544,7 +544,7 @@ window.postMessage({

exports[`hug-args.ts format 1`] = `
====================================options=====================================
parsers: ["babel-ts"]
parsers: ["typescript"]
printWidth: 80
| printWidth
=====================================input======================================
Expand All @@ -566,7 +566,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 @@ -594,7 +594,7 @@ semi: false

exports[`lhs.ts format 1`] = `
====================================options=====================================
parsers: ["babel-ts"]
parsers: ["typescript"]
printWidth: 80
| printWidth
=====================================input======================================
Expand All @@ -621,7 +621,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 @@ -649,7 +649,7 @@ const getAccountCount = async () =>

exports[`nested-await-and-satisfies.ts format 1`] = `
====================================options=====================================
parsers: ["babel-ts"]
parsers: ["typescript"]
printWidth: 80
| printWidth
=====================================input======================================
Expand All @@ -676,7 +676,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 @@ -695,7 +695,7 @@ const el = ReactDOM.findDOMNode(ref)

exports[`non-null.ts format 1`] = `
====================================options=====================================
parsers: ["babel-ts"]
parsers: ["typescript"]
printWidth: 80
| printWidth
=====================================input======================================
Expand All @@ -713,7 +713,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 @@ -770,7 +770,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 @@ -826,7 +826,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 @@ -858,7 +858,7 @@ const b = \`\${

exports[`template-literal.ts format 1`] = `
====================================options=====================================
parsers: ["babel-ts"]
parsers: ["typescript"]
printWidth: 80
| printWidth
=====================================input======================================
Expand Down Expand Up @@ -889,7 +889,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 @@ -992,7 +992,7 @@ bifornCringerMoshedPerplexSawder =

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

exports[`types-comments.ts - {"semi":false} format 1`] = `
====================================options=====================================
parsers: ["babel-ts"]
parsers: ["typescript"]
printWidth: 80
semi: false
| printWidth
Expand All @@ -1113,7 +1113,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 fd37600

Please sign in to comment.