diff --git a/package.json b/package.json index 5fe4ede9a2ce..892575d86af6 100644 --- a/package.json +++ b/package.json @@ -24,10 +24,10 @@ "dependencies": { "@angular/compiler": "12.2.16", "@babel/code-frame": "7.16.7", - "@babel/parser": "7.18.0", + "@babel/parser": "7.20.1", "@glimmer/syntax": "0.84.2", "@iarna/toml": "2.2.5", - "@typescript-eslint/typescript-estree": "5.30.0", + "@typescript-eslint/typescript-estree": "5.36.2", "acorn": "8.8.0", "acorn-jsx": "5.3.2", "angular-estree-parser": "2.5.1", @@ -85,7 +85,7 @@ "semver": "7.3.7", "string-width": "5.0.1", "strip-ansi": "7.0.1", - "typescript": "4.7.2", + "typescript": "4.8.2", "unicode-regex": "3.0.0", "unified": "9.2.1", "vnopts": "1.0.2", @@ -102,7 +102,7 @@ "@types/file-entry-cache": "5.0.2", "@types/find-cache-dir": "3.2.1", "@types/jest": "27.4.1", - "@typescript-eslint/eslint-plugin": "5.20.0", + "@typescript-eslint/eslint-plugin": "5.36.2", "babel-jest": "27.5.1", "benchmark": "2.1.4", "browserslist-to-esbuild": "1.1.1", diff --git a/src/language-js/loc.js b/src/language-js/loc.js index 15f07e8d9146..4be972e1ec95 100644 --- a/src/language-js/loc.js +++ b/src/language-js/loc.js @@ -6,20 +6,16 @@ const isNonEmptyArray = require("../utils/is-non-empty-array.js"); * @typedef {import("./types/estree").Node} Node */ -function locStart(node, opts) { - const { ignoreDecorators } = opts || {}; +function locStart(node) { + const start = node.range ? node.range[0] : node.start; // Handle nodes with decorators. They should start at the first decorator - if (!ignoreDecorators) { - const decorators = - (node.declaration && node.declaration.decorators) || node.decorators; - - if (isNonEmptyArray(decorators)) { - return locStart(decorators[0]); - } + const decorators = node.declaration?.decorators ?? node.decorators; + if (isNonEmptyArray(decorators)) { + return Math.min(locStart(decorators[0]), start); } - return node.range ? node.range[0] : node.start; + return start; } function locEnd(node) { diff --git a/src/language-js/needs-parens.js b/src/language-js/needs-parens.js index 1a71011ecdca..94d95febc44a 100644 --- a/src/language-js/needs-parens.js +++ b/src/language-js/needs-parens.js @@ -15,6 +15,7 @@ const { isCallExpression, isMemberExpression, isObjectProperty, + isTSTypeExpression, } = require("./utils/index.js"); function needsParens(path, options) { @@ -244,14 +245,16 @@ function needsParens(path, options) { // fallthrough case "TSTypeAssertion": case "TSAsExpression": + case "TSSatisfiesExpression": case "LogicalExpression": switch (parent.type) { + case "TSSatisfiesExpression": case "TSAsExpression": // example: foo as unknown as Bar - return node.type !== "TSAsExpression"; + return !isTSTypeExpression(node); case "ConditionalExpression": - return node.type === "TSAsExpression"; + return isTSTypeExpression(node); case "CallExpression": case "NewExpression": @@ -282,7 +285,7 @@ function needsParens(path, options) { case "AssignmentPattern": return ( name === "left" && - (node.type === "TSTypeAssertion" || node.type === "TSAsExpression") + (node.type === "TSTypeAssertion" || isTSTypeExpression(node)) ); case "LogicalExpression": @@ -363,7 +366,7 @@ function needsParens(path, options) { if ( parent.type === "UnaryExpression" || parent.type === "AwaitExpression" || - parent.type === "TSAsExpression" || + isTSTypeExpression(parent) || parent.type === "TSNonNullExpression" ) { return true; @@ -377,6 +380,7 @@ function needsParens(path, options) { case "SpreadElement": case "SpreadProperty": case "TSAsExpression": + case "TSSatisfiesExpression": case "TSNonNullExpression": case "BindExpression": return true; @@ -612,6 +616,7 @@ function needsParens(path, options) { case "TSTypeAssertion": case "TypeCastExpression": case "TSAsExpression": + case "TSSatisfiesExpression": case "TSNonNullExpression": return true; @@ -661,6 +666,7 @@ function needsParens(path, options) { return name === "object"; case "TSAsExpression": + case "TSSatisfiesExpression": case "TSNonNullExpression": case "BindExpression": case "TaggedTemplateExpression": diff --git a/src/language-js/parse/postprocess/typescript.js b/src/language-js/parse/postprocess/typescript.js index aea24d9dde46..2f613bbf4d76 100644 --- a/src/language-js/parse/postprocess/typescript.js +++ b/src/language-js/parse/postprocess/typescript.js @@ -1,33 +1,36 @@ "use strict"; +const isNonEmptyArray = require("../../../utils/is-non-empty-array.js"); const visitNode = require("./visit-node.js"); const throwSyntaxError = require("./throw-syntax-error.js"); +// Copied from https://unpkg.com/typescript@4.8.2/lib/typescript.js +function getSourceFileOfNode(node) { + while (node && node.kind !== 305 /* SyntaxKind.SourceFile */) { + node = node.parent; + } + return node; +} + // Invalid decorators are removed since `@typescript-eslint/typescript-estree` v4 // https://github.com/typescript-eslint/typescript-eslint/pull/2375 -function throwErrorForInvalidDecorator( - tsNode, - esTreeNode, - tsNodeToESTreeNodeMap -) { - const tsDecorators = tsNode.decorators; - if (!Array.isArray(tsDecorators)) { +// There is a `checkGrammarDecorators` in `typescript` package, consider use it directly in future +function throwErrorForInvalidDecorator(tsNode) { + const { illegalDecorators } = tsNode; + if (!isNonEmptyArray(illegalDecorators)) { return; } - const esTreeDecorators = esTreeNode.decorators; - if ( - !Array.isArray(esTreeDecorators) || - esTreeDecorators.length !== tsDecorators.length || - tsDecorators.some((tsDecorator) => { - const esTreeDecorator = tsNodeToESTreeNodeMap.get(tsDecorator); - return !esTreeDecorator || !esTreeDecorators.includes(esTreeDecorator); - }) - ) { - throwSyntaxError( - esTreeNode, - "Leading decorators must be attached to a class declaration" - ); - } + + const [{ expression }] = illegalDecorators; + + const sourceFile = getSourceFileOfNode(expression); + const [start, end] = [expression.pos, expression.end].map((position) => { + const { line, character: column } = + sourceFile.getLineAndCharacterOfPosition(position); + return { line: line + 1, column }; + }); + + throwSyntaxError({ loc: { start, end } }, "Decorators are not valid here."); } // Values of abstract property is removed since `@typescript-eslint/typescript-estree` v5 @@ -66,7 +69,7 @@ function throwErrorForInvalidNodes(ast, options) { return; } - throwErrorForInvalidDecorator(tsNode, esTreeNode, tsNodeToESTreeNodeMap); + throwErrorForInvalidDecorator(tsNode); throwErrorForInvalidAbstractProperty(tsNode, esTreeNode); }); } diff --git a/src/language-js/print/call-arguments.js b/src/language-js/print/call-arguments.js index 187521a04460..6bd36e3421db 100644 --- a/src/language-js/print/call-arguments.js +++ b/src/language-js/print/call-arguments.js @@ -16,6 +16,7 @@ const { isCallExpression, isStringLiteral, isObjectProperty, + isTSTypeExpression, } = require("../utils/index.js"); const { @@ -190,7 +191,7 @@ function couldGroupArg(arg, arrowChainRecursion = false) { (arg.type === "ArrayExpression" && (arg.elements.length > 0 || hasComment(arg))) || (arg.type === "TSTypeAssertion" && couldGroupArg(arg.expression)) || - (arg.type === "TSAsExpression" && couldGroupArg(arg.expression)) || + (isTSTypeExpression(arg) && couldGroupArg(arg.expression)) || arg.type === "FunctionExpression" || (arg.type === "ArrowFunctionExpression" && // we want to avoid breaking inside composite return types but not simple keywords diff --git a/src/language-js/print/decorators.js b/src/language-js/print/decorators.js index 2b679b4d5f32..1bca71a541f7 100644 --- a/src/language-js/print/decorators.js +++ b/src/language-js/print/decorators.js @@ -72,8 +72,7 @@ function hasDecoratorsBeforeExport(node) { const decorators = node.declaration && node.declaration.decorators; return ( - isNonEmptyArray(decorators) && - locStart(node, { ignoreDecorators: true }) > locStart(decorators[0]) + isNonEmptyArray(decorators) && locStart(node) === locStart(decorators[0]) ); } diff --git a/src/language-js/print/template-literal.js b/src/language-js/print/template-literal.js index c7bd2119552a..e46505cc33eb 100644 --- a/src/language-js/print/template-literal.js +++ b/src/language-js/print/template-literal.js @@ -22,6 +22,7 @@ const { isSimpleTemplateLiteral, hasComment, isMemberExpression, + isTSTypeExpression, } = require("../utils/index.js"); function printTemplateLiteral(path, print, options) { @@ -90,7 +91,7 @@ function printTemplateLiteral(path, print, options) { isMemberExpression(expression) || expression.type === "ConditionalExpression" || expression.type === "SequenceExpression" || - expression.type === "TSAsExpression" || + isTSTypeExpression(expression) || isBinaryish(expression) ) { printed = [indent([softline, printed]), softline]; diff --git a/src/language-js/print/ternary.js b/src/language-js/print/ternary.js index 18c9c8d156c6..542e15b21847 100644 --- a/src/language-js/print/ternary.js +++ b/src/language-js/print/ternary.js @@ -6,6 +6,7 @@ const { getComments, isCallExpression, isMemberExpression, + isTSTypeExpression, } = require("../utils/index.js"); const { locStart, locEnd } = require("../loc.js"); const isBlockComment = require("../utils/is-block-comment.js"); @@ -165,7 +166,7 @@ function shouldExtraIndentForConditionalExpression(path) { if ( (node.type === "NewExpression" && node.callee === child) || - (node.type === "TSAsExpression" && node.expression === child) + (isTSTypeExpression(node) && node.expression === child) ) { parent = path.getParentNode(ancestorCount + 1); child = node; diff --git a/src/language-js/print/typescript.js b/src/language-js/print/typescript.js index b755c7458c66..a67193627da1 100644 --- a/src/language-js/print/typescript.js +++ b/src/language-js/print/typescript.js @@ -148,8 +148,10 @@ function printTypescript(path, options, print) { return printTypeParameters(path, options, print, "params"); case "TSTypeParameter": return printTypeParameter(path, options, print); + case "TSSatisfiesExpression": case "TSAsExpression": { - parts.push(print("expression"), " as ", print("typeAnnotation")); + const operator = node.type === "TSAsExpression" ? "as" : "satisfies"; + parts.push(print("expression"), ` ${operator} `, print("typeAnnotation")); const parent = path.getParentNode(); if ( (isCallExpression(parent) && parent.callee === node) || diff --git a/src/language-js/utils/index.js b/src/language-js/utils/index.js index 1a11a0b0b105..8406ac296f26 100644 --- a/src/language-js/utils/index.js +++ b/src/language-js/utils/index.js @@ -106,7 +106,7 @@ function hasNakedLeftSide(node) { node.type === "TaggedTemplateExpression" || node.type === "BindExpression" || (node.type === "UpdateExpression" && !node.prefix) || - node.type === "TSAsExpression" || + isTSTypeExpression(node) || node.type === "TSNonNullExpression" ); } @@ -998,6 +998,8 @@ function startsWithNoLookaheadToken(node, forbidFunctionClassAndDoExpr) { node.expressions[0], forbidFunctionClassAndDoExpr ); + // @ts-expect-error + case "TSSatisfiesExpression": case "TSAsExpression": case "TSNonNullExpression": return startsWithNoLookaheadToken( @@ -1305,6 +1307,12 @@ const markerForIfWithoutBlockAndSameLineComment = Symbol( "ifWithoutBlockAndSameLineComment" ); +function isTSTypeExpression(node) { + return ( + node.type === "TSAsExpression" || node.type === "TSSatisfiesExpression" + ); +} + module.exports = { getFunctionParameters, iterateFunctionParametersPath, @@ -1369,4 +1377,5 @@ module.exports = { getComments, CommentCheckFlags, markerForIfWithoutBlockAndSameLineComment, + isTSTypeExpression, }; diff --git a/tests/config/format-test.js b/tests/config/format-test.js index 743e03ee71ba..3574fddf1e40 100644 --- a/tests/config/format-test.js +++ b/tests/config/format-test.js @@ -40,6 +40,7 @@ const unstableTests = new Map( "typescript/prettier-ignore/mapped-types.ts", "js/comments/html-like/comment.js", "js/for/continue-and-break-comment-without-blocks.js", + "typescript/satisfies-operators/comments-unstable.ts", ].map((fixture) => { const [file, isUnstable = () => true] = Array.isArray(fixture) ? fixture diff --git a/tests/format/misc/errors/invalid-typescript-decorators/__snapshots__/jsfmt.spec.js.snap b/tests/format/misc/errors/invalid-typescript-decorators/__snapshots__/jsfmt.spec.js.snap index 8d1286b597dd..26d9fed0966b 100644 --- a/tests/format/misc/errors/invalid-typescript-decorators/__snapshots__/jsfmt.spec.js.snap +++ b/tests/format/misc/errors/invalid-typescript-decorators/__snapshots__/jsfmt.spec.js.snap @@ -10,13 +10,12 @@ exports[`decorator.ts [babel-ts] format 1`] = ` `; exports[`decorator.ts [typescript] format 1`] = ` -"Leading decorators must be attached to a class declaration (3:1) +"Decorators are not valid here. (3:2) 1 | declare function dec(target: T): T; 2 | > 3 | @dec - | ^^^^ -> 4 | enum E {} - | ^^^^^^^^^^ + | ^^^ + 4 | enum E {} 5 |" `; @@ -32,24 +31,14 @@ exports[`enums.ts [babel-ts] format 1`] = ` `; exports[`enums.ts [typescript] format 1`] = ` -"Leading decorators must be attached to a class declaration (3:1) - 1 | // https://github.com/typescript-eslint/typescript-eslint/pull/2375 - 2 | -> 3 | @decorator() - | ^^^^^^^^^^^^ -> 4 | enum Direction { - | ^^^^^^^^^^^^^^^^ -> 5 | Up = 1, - | ^^^^^^^^^^^^^^^^ -> 6 | Down, - | ^^^^^^^^^^^^^^^^ -> 7 | Left, - | ^^^^^^^^^^^^^^^^ -> 8 | Right - | ^^^^^^^^^^^^^^^^ -> 9 | } - | ^^ - 10 |" +"Decorators are not valid here. (3:2) + 1 | // https://github.com/typescript-eslint/typescript-eslint/pull/2375 + 2 | +> 3 | @decorator() + | ^^^^^^^^^^^ + 4 | enum Direction { + 5 | Up = 1, + 6 | Down," `; exports[`function.ts [babel-ts] format 1`] = ` @@ -62,13 +51,12 @@ exports[`function.ts [babel-ts] format 1`] = ` `; exports[`function.ts [typescript] format 1`] = ` -"Leading decorators must be attached to a class declaration (3:1) +"Decorators are not valid here. (3:2) 1 | // https://github.com/typescript-eslint/typescript-eslint/pull/2375 2 | > 3 | @decorator() - | ^^^^^^^^^^^^ -> 4 | function foo( ){} - | ^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^ + 4 | function foo( ){} 5 |" `; @@ -83,15 +71,13 @@ exports[`interface.ts [babel-ts] format 1`] = ` `; exports[`interface.ts [typescript] format 1`] = ` -"Leading decorators must be attached to a class declaration (4:1) +"Decorators are not valid here. (4:2) 2 | // #4632 3 | > 4 | @hello() - | ^^^^^^^^ -> 5 | interface MyInterface {id: string; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -> 6 | } - | ^^ + | ^^^^^^^ + 5 | interface MyInterface {id: string; + 6 | } 7 |" `; @@ -105,11 +91,10 @@ exports[`issue-9102.ts [babel-ts] format 1`] = ` `; exports[`issue-9102.ts [typescript] format 1`] = ` -"Leading decorators must be attached to a class declaration (1:1) +"Decorators are not valid here. (1:2) > 1 | @Decorator() - | ^^^^^^^^^^^^ -> 2 | type T = 1; - | ^^^^^^^^^^^^ + | ^^^^^^^^^^^ + 2 | type T = 1; 3 | class C {} 4 |" `; diff --git a/tests/format/typescript/instantiation-expression/__snapshots__/jsfmt.spec.js.snap b/tests/format/typescript/instantiation-expression/__snapshots__/jsfmt.spec.js.snap index 974c9bdab73a..75e7a6721b94 100644 --- a/tests/format/typescript/instantiation-expression/__snapshots__/jsfmt.spec.js.snap +++ b/tests/format/typescript/instantiation-expression/__snapshots__/jsfmt.spec.js.snap @@ -26,7 +26,8 @@ new A < B > C =====================================output===================================== -new A() < B > C; +new A(); +C; ================================================================================ `; diff --git a/tests/format/typescript/satisfies-operators/__snapshots__/jsfmt.spec.js.snap b/tests/format/typescript/satisfies-operators/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000000..7580e493ffc8 --- /dev/null +++ b/tests/format/typescript/satisfies-operators/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,1130 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`argument-expansion.ts - {"semi":false} format 1`] = ` +====================================options===================================== +parsers: ["babel-ts"] +printWidth: 80 +semi: false + | printWidth +=====================================input====================================== +const bar1 = [1,2,3].reduce((carry, value) => { + return [...carry, value]; +}, ([] satisfies unknown) satisfies number[]); + +const bar2 = [1,2,3].reduce((carry, value) => { + return [...carry, value]; +}, ([1, 2, 3] satisfies unknown) satisfies number[]); + +const bar3 = [1,2,3].reduce((carry, value) => { + return {...carry, [value]: true}; +}, ({} satisfies unknown) satisfies {[key: number]: boolean}); + +const bar4 = [1,2,3].reduce((carry, value) => { + return {...carry, [value]: true}; +}, ({1: true} satisfies unknown) satisfies {[key: number]: boolean}); + +const bar5 = [1,2,3].reduce((carry, value) => { + return [...carry, value]; +}, [] satisfies foo); + +=====================================output===================================== +const bar1 = [1, 2, 3].reduce((carry, value) => { + return [...carry, value] +}, [] satisfies unknown satisfies number[]) + +const bar2 = [1, 2, 3].reduce( + (carry, value) => { + return [...carry, value] + }, + [1, 2, 3] satisfies unknown satisfies number[] +) + +const bar3 = [1, 2, 3].reduce((carry, value) => { + return { ...carry, [value]: true } +}, {} satisfies unknown satisfies { [key: number]: boolean }) + +const bar4 = [1, 2, 3].reduce( + (carry, value) => { + return { ...carry, [value]: true } + }, + { 1: true } satisfies unknown satisfies { [key: number]: boolean } +) + +const bar5 = [1, 2, 3].reduce((carry, value) => { + return [...carry, value] +}, [] satisfies foo) + +================================================================================ +`; + +exports[`argument-expansion.ts format 1`] = ` +====================================options===================================== +parsers: ["babel-ts"] +printWidth: 80 + | printWidth +=====================================input====================================== +const bar1 = [1,2,3].reduce((carry, value) => { + return [...carry, value]; +}, ([] satisfies unknown) satisfies number[]); + +const bar2 = [1,2,3].reduce((carry, value) => { + return [...carry, value]; +}, ([1, 2, 3] satisfies unknown) satisfies number[]); + +const bar3 = [1,2,3].reduce((carry, value) => { + return {...carry, [value]: true}; +}, ({} satisfies unknown) satisfies {[key: number]: boolean}); + +const bar4 = [1,2,3].reduce((carry, value) => { + return {...carry, [value]: true}; +}, ({1: true} satisfies unknown) satisfies {[key: number]: boolean}); + +const bar5 = [1,2,3].reduce((carry, value) => { + return [...carry, value]; +}, [] satisfies foo); + +=====================================output===================================== +const bar1 = [1, 2, 3].reduce((carry, value) => { + return [...carry, value]; +}, [] satisfies unknown satisfies number[]); + +const bar2 = [1, 2, 3].reduce( + (carry, value) => { + return [...carry, value]; + }, + [1, 2, 3] satisfies unknown satisfies number[] +); + +const bar3 = [1, 2, 3].reduce((carry, value) => { + return { ...carry, [value]: true }; +}, {} satisfies unknown satisfies { [key: number]: boolean }); + +const bar4 = [1, 2, 3].reduce( + (carry, value) => { + return { ...carry, [value]: true }; + }, + { 1: true } satisfies unknown satisfies { [key: number]: boolean } +); + +const bar5 = [1, 2, 3].reduce((carry, value) => { + return [...carry, value]; +}, [] satisfies foo); + +================================================================================ +`; + +exports[`assignment.ts - {"semi":false} format 1`] = ` +====================================options===================================== +parsers: ["babel-ts"] +printWidth: 80 +semi: false + | printWidth +=====================================input====================================== +const extraRendererAttrs = ((attrs.rendererAttrs && + this.utils.safeParseJsonString(attrs.rendererAttrs)) || + Object.create(null)) satisfies FieldService.RendererAttributes; + +const annotate = (angular.injector satisfies any).$$annotate satisfies ( + fn: Function +) => string[]; + +const originalPrototype = originalConstructor.prototype satisfies TComponent & InjectionTarget, + propertyToServiceName = originalPrototype._inject; + +this.previewPlayerHandle = (setInterval(async () => { + if (this.previewIsPlaying) { + await this.fetchNextPreviews(); + this.currentPreviewIndex++; + } +}, this.refreshDelay) satisfies unknown) satisfies number; + +this.intervalID = (setInterval(() => { + self.step(); +}, 30) satisfies unknown) satisfies number; + +=====================================output===================================== +const extraRendererAttrs = ((attrs.rendererAttrs && + this.utils.safeParseJsonString(attrs.rendererAttrs)) || + Object.create(null)) satisfies FieldService.RendererAttributes + +const annotate = (angular.injector satisfies any).$$annotate satisfies ( + fn: Function +) => string[] + +const originalPrototype = originalConstructor.prototype satisfies TComponent & + InjectionTarget, + propertyToServiceName = originalPrototype._inject + +this.previewPlayerHandle = setInterval(async () => { + if (this.previewIsPlaying) { + await this.fetchNextPreviews() + this.currentPreviewIndex++ + } +}, this.refreshDelay) satisfies unknown satisfies number + +this.intervalID = setInterval(() => { + self.step() +}, 30) satisfies unknown satisfies number + +================================================================================ +`; + +exports[`assignment.ts format 1`] = ` +====================================options===================================== +parsers: ["babel-ts"] +printWidth: 80 + | printWidth +=====================================input====================================== +const extraRendererAttrs = ((attrs.rendererAttrs && + this.utils.safeParseJsonString(attrs.rendererAttrs)) || + Object.create(null)) satisfies FieldService.RendererAttributes; + +const annotate = (angular.injector satisfies any).$$annotate satisfies ( + fn: Function +) => string[]; + +const originalPrototype = originalConstructor.prototype satisfies TComponent & InjectionTarget, + propertyToServiceName = originalPrototype._inject; + +this.previewPlayerHandle = (setInterval(async () => { + if (this.previewIsPlaying) { + await this.fetchNextPreviews(); + this.currentPreviewIndex++; + } +}, this.refreshDelay) satisfies unknown) satisfies number; + +this.intervalID = (setInterval(() => { + self.step(); +}, 30) satisfies unknown) satisfies number; + +=====================================output===================================== +const extraRendererAttrs = ((attrs.rendererAttrs && + this.utils.safeParseJsonString(attrs.rendererAttrs)) || + Object.create(null)) satisfies FieldService.RendererAttributes; + +const annotate = (angular.injector satisfies any).$$annotate satisfies ( + fn: Function +) => string[]; + +const originalPrototype = originalConstructor.prototype satisfies TComponent & + InjectionTarget, + propertyToServiceName = originalPrototype._inject; + +this.previewPlayerHandle = setInterval(async () => { + if (this.previewIsPlaying) { + await this.fetchNextPreviews(); + this.currentPreviewIndex++; + } +}, this.refreshDelay) satisfies unknown satisfies number; + +this.intervalID = setInterval(() => { + self.step(); +}, 30) satisfies unknown satisfies number; + +================================================================================ +`; + +exports[`basic.ts - {"semi":false} format 1`] = ` +====================================options===================================== +parsers: ["babel-ts"] +printWidth: 80 +semi: false + | printWidth +=====================================input====================================== +const t1 = { a: 1 } satisfies I1; +const t2 = { a: 1, b: 1 } satisfies I1; +const t3 = { } satisfies I1; +const t4: T1 = { a: "a" } satisfies T1; +const t5 = (m => m.substring(0)) satisfies T2; +const t6 = [1, 2] satisfies [number, number]; +let t7 = { a: 'test' } satisfies A; +let t8 = { a: 'test', b: 'test' } satisfies A; + +const p = { + isEven: n => n % 2 === 0, + isOdd: n => n % 2 === 1 +} satisfies Predicates; + +let obj: { f(s: string): void } & Record = { + f(s) { }, + g(s) { } +} satisfies { g(s: string): void } & Record; + +({ f(x) { } }) satisfies { f(s: string): void }; + +const car = { + start() { }, + move(d) { + // d should be number + }, + stop() { } +} satisfies Movable & Record; + +var v = undefined satisfies 1; + +=====================================output===================================== +const t1 = { a: 1 } satisfies I1 +const t2 = { a: 1, b: 1 } satisfies I1 +const t3 = {} satisfies I1 +const t4: T1 = { a: "a" } satisfies T1 +const t5 = ((m) => m.substring(0)) satisfies T2 +const t6 = [1, 2] satisfies [number, number] +let t7 = { a: "test" } satisfies A +let t8 = { a: "test", b: "test" } satisfies A + +const p = { + isEven: (n) => n % 2 === 0, + isOdd: (n) => n % 2 === 1, +} satisfies Predicates + +let obj: { f(s: string): void } & Record = { + f(s) {}, + g(s) {}, +} satisfies { g(s: string): void } & Record + +;({ f(x) {} } satisfies { f(s: string): void }) + +const car = { + start() {}, + move(d) { + // d should be number + }, + stop() {}, +} satisfies Movable & Record + +var v = undefined satisfies 1 + +================================================================================ +`; + +exports[`basic.ts format 1`] = ` +====================================options===================================== +parsers: ["babel-ts"] +printWidth: 80 + | printWidth +=====================================input====================================== +const t1 = { a: 1 } satisfies I1; +const t2 = { a: 1, b: 1 } satisfies I1; +const t3 = { } satisfies I1; +const t4: T1 = { a: "a" } satisfies T1; +const t5 = (m => m.substring(0)) satisfies T2; +const t6 = [1, 2] satisfies [number, number]; +let t7 = { a: 'test' } satisfies A; +let t8 = { a: 'test', b: 'test' } satisfies A; + +const p = { + isEven: n => n % 2 === 0, + isOdd: n => n % 2 === 1 +} satisfies Predicates; + +let obj: { f(s: string): void } & Record = { + f(s) { }, + g(s) { } +} satisfies { g(s: string): void } & Record; + +({ f(x) { } }) satisfies { f(s: string): void }; + +const car = { + start() { }, + move(d) { + // d should be number + }, + stop() { } +} satisfies Movable & Record; + +var v = undefined satisfies 1; + +=====================================output===================================== +const t1 = { a: 1 } satisfies I1; +const t2 = { a: 1, b: 1 } satisfies I1; +const t3 = {} satisfies I1; +const t4: T1 = { a: "a" } satisfies T1; +const t5 = ((m) => m.substring(0)) satisfies T2; +const t6 = [1, 2] satisfies [number, number]; +let t7 = { a: "test" } satisfies A; +let t8 = { a: "test", b: "test" } satisfies A; + +const p = { + isEven: (n) => n % 2 === 0, + isOdd: (n) => n % 2 === 1, +} satisfies Predicates; + +let obj: { f(s: string): void } & Record = { + f(s) {}, + g(s) {}, +} satisfies { g(s: string): void } & Record; + +({ f(x) {} } satisfies { f(s: string): void }); + +const car = { + start() {}, + move(d) { + // d should be number + }, + stop() {}, +} satisfies Movable & Record; + +var v = undefined satisfies 1; + +================================================================================ +`; + +exports[`comments.ts - {"semi":false} format 1`] = ` +====================================options===================================== +parsers: ["babel-ts"] +printWidth: 80 +semi: false + | printWidth +=====================================input====================================== +const t2 = {} /* comment */ satisfies {}; +const t3 = {} satisfies /* comment */ {}; +const t4 = {} /* comment1 */ satisfies /* comment2 */ {}; + +=====================================output===================================== +const t2 = {} /* comment */ satisfies {} +const t3 = {} satisfies /* comment */ {} +const t4 = {} /* comment1 */ satisfies /* comment2 */ {} + +================================================================================ +`; + +exports[`comments.ts format 1`] = ` +====================================options===================================== +parsers: ["babel-ts"] +printWidth: 80 + | printWidth +=====================================input====================================== +const t2 = {} /* comment */ satisfies {}; +const t3 = {} satisfies /* comment */ {}; +const t4 = {} /* comment1 */ satisfies /* comment2 */ {}; + +=====================================output===================================== +const t2 = {} /* comment */ satisfies {}; +const t3 = {} satisfies /* comment */ {}; +const t4 = {} /* comment1 */ satisfies /* comment2 */ {}; + +================================================================================ +`; + +exports[`comments-unstable.ts - {"semi":false} format 1`] = ` +====================================options===================================== +parsers: ["babel-ts"] +printWidth: 80 +semi: false + | printWidth +=====================================input====================================== +const t1 = { + prop1: 1, + prop2: 2, + prop3: 3 +} satisfies +// Comment +Record; + +=====================================output===================================== +const t1 = { + prop1: 1, + prop2: 2, + prop3: 3, +} satisfies // Comment +Record + +================================================================================ +`; + +exports[`comments-unstable.ts format 1`] = ` +====================================options===================================== +parsers: ["babel-ts"] +printWidth: 80 + | printWidth +=====================================input====================================== +const t1 = { + prop1: 1, + prop2: 2, + prop3: 3 +} satisfies +// Comment +Record; + +=====================================output===================================== +const t1 = { + prop1: 1, + prop2: 2, + prop3: 3, +} satisfies // Comment +Record; + +================================================================================ +`; + +exports[`export-default-as.ts - {"semi":false} format 1`] = ` +====================================options===================================== +parsers: ["babel-ts"] +printWidth: 80 +semi: false + | printWidth +=====================================input====================================== +export default (function log() {} satisfies typeof console.log) + +=====================================output===================================== +export default (function log() {} satisfies typeof console.log) + +================================================================================ +`; + +exports[`export-default-as.ts format 1`] = ` +====================================options===================================== +parsers: ["babel-ts"] +printWidth: 80 + | printWidth +=====================================input====================================== +export default (function log() {} satisfies typeof console.log) + +=====================================output===================================== +export default (function log() {} satisfies typeof console.log); + +================================================================================ +`; + +exports[`gt-lt.ts - {"semi":false} format 1`] = ` +====================================options===================================== +parsers: ["babel-ts"] +printWidth: 80 +semi: false + | printWidth +=====================================input====================================== +x satisfies boolean <= y; // (x satisfies boolean) <= y; +x satisfies boolean ?? y; // (x satisfies boolean) ?? y; + +=====================================output===================================== +;(x satisfies boolean) <= y // (x satisfies boolean) <= y; +;(x satisfies boolean) ?? y // (x satisfies boolean) ?? y; + +================================================================================ +`; + +exports[`gt-lt.ts format 1`] = ` +====================================options===================================== +parsers: ["babel-ts"] +printWidth: 80 + | printWidth +=====================================input====================================== +x satisfies boolean <= y; // (x satisfies boolean) <= y; +x satisfies boolean ?? y; // (x satisfies boolean) ?? y; + +=====================================output===================================== +(x satisfies boolean) <= y; // (x satisfies boolean) <= y; +(x satisfies boolean) ?? y; // (x satisfies boolean) ?? y; + +================================================================================ +`; + +exports[`hug-args.ts - {"semi":false} format 1`] = ` +====================================options===================================== +parsers: ["babel-ts"] +printWidth: 80 +semi: false + | printWidth +=====================================input====================================== +window.postMessage( + { + context: item.context, + topic: item.topic + } satisfies IActionMessage + ); + +=====================================output===================================== +window.postMessage({ + context: item.context, + topic: item.topic, +} satisfies IActionMessage) + +================================================================================ +`; + +exports[`hug-args.ts format 1`] = ` +====================================options===================================== +parsers: ["babel-ts"] +printWidth: 80 + | printWidth +=====================================input====================================== +window.postMessage( + { + context: item.context, + topic: item.topic + } satisfies IActionMessage + ); + +=====================================output===================================== +window.postMessage({ + context: item.context, + topic: item.topic, +} satisfies IActionMessage); + +================================================================================ +`; + +exports[`lhs.ts - {"semi":false} format 1`] = ` +====================================options===================================== +parsers: ["babel-ts"] +printWidth: 80 +semi: false + | printWidth +=====================================input====================================== +(a satisfies number) = 42; +({ a: (b satisfies any) = 2000 } = x); +(this.selectorElem satisfies any) = this.multiselectWidget = this.initialValues = undefined; +(this.configuration satisfies any) = (this.editor satisfies any) = (this + .editorBody satisfies any) = undefined; + +=====================================output===================================== +;(a satisfies number) = 42 +;({ a: (b satisfies any) = 2000 } = x) +;(this.selectorElem satisfies any) = + this.multiselectWidget = + this.initialValues = + undefined +;(this.configuration satisfies any) = + (this.editor satisfies any) = + (this.editorBody satisfies any) = + undefined + +================================================================================ +`; + +exports[`lhs.ts format 1`] = ` +====================================options===================================== +parsers: ["babel-ts"] +printWidth: 80 + | printWidth +=====================================input====================================== +(a satisfies number) = 42; +({ a: (b satisfies any) = 2000 } = x); +(this.selectorElem satisfies any) = this.multiselectWidget = this.initialValues = undefined; +(this.configuration satisfies any) = (this.editor satisfies any) = (this + .editorBody satisfies any) = undefined; + +=====================================output===================================== +(a satisfies number) = 42; +({ a: (b satisfies any) = 2000 } = x); +(this.selectorElem satisfies any) = + this.multiselectWidget = + this.initialValues = + undefined; +(this.configuration satisfies any) = + (this.editor satisfies any) = + (this.editorBody satisfies any) = + undefined; + +================================================================================ +`; + +exports[`nested-await-and-satisfies.ts - {"semi":false} format 1`] = ` +====================================options===================================== +parsers: ["babel-ts"] +printWidth: 80 +semi: false + | printWidth +=====================================input====================================== +const getAccountCount = async () => + (await + ((await ( + await focusOnSection(BOOKMARKED_PROJECTS_SECTION_NAME) + ).findItem("My bookmarks")) satisfies TreeItem + ).getChildren() + ).length + +=====================================output===================================== +const getAccountCount = async () => + ( + await ( + (await ( + await focusOnSection(BOOKMARKED_PROJECTS_SECTION_NAME) + ).findItem("My bookmarks")) satisfies TreeItem + ).getChildren() + ).length + +================================================================================ +`; + +exports[`nested-await-and-satisfies.ts format 1`] = ` +====================================options===================================== +parsers: ["babel-ts"] +printWidth: 80 + | printWidth +=====================================input====================================== +const getAccountCount = async () => + (await + ((await ( + await focusOnSection(BOOKMARKED_PROJECTS_SECTION_NAME) + ).findItem("My bookmarks")) satisfies TreeItem + ).getChildren() + ).length + +=====================================output===================================== +const getAccountCount = async () => + ( + await ( + (await ( + await focusOnSection(BOOKMARKED_PROJECTS_SECTION_NAME) + ).findItem("My bookmarks")) satisfies TreeItem + ).getChildren() + ).length; + +================================================================================ +`; + +exports[`non-null.ts - {"semi":false} format 1`] = ` +====================================options===================================== +parsers: ["babel-ts"] +printWidth: 80 +semi: false + | printWidth +=====================================input====================================== +// the 2nd line needs ASI protection +const el = ReactDOM.findDOMNode(ref) +;(el satisfies HTMLElement)!.style.cursor = 'pointer' + +=====================================output===================================== +// the 2nd line needs ASI protection +const el = ReactDOM.findDOMNode(ref) +;(el satisfies HTMLElement)!.style.cursor = "pointer" + +================================================================================ +`; + +exports[`non-null.ts format 1`] = ` +====================================options===================================== +parsers: ["babel-ts"] +printWidth: 80 + | printWidth +=====================================input====================================== +// the 2nd line needs ASI protection +const el = ReactDOM.findDOMNode(ref) +;(el satisfies HTMLElement)!.style.cursor = 'pointer' + +=====================================output===================================== +// the 2nd line needs ASI protection +const el = ReactDOM.findDOMNode(ref); +(el satisfies HTMLElement)!.style.cursor = "pointer"; + +================================================================================ +`; + +exports[`satisfies.ts - {"semi":false} format 1`] = ` +====================================options===================================== +parsers: ["babel-ts"] +printWidth: 80 +semi: false + | printWidth +=====================================input====================================== +({}) satisfies {}; +({}) satisfies X; +() => ({}) satisfies X; +this.isTabActionBar((e.target || e.srcElement) satisfies HTMLElement); + +'current' in (props.pagination satisfies Object); +('current' in props.pagination) satisfies Object; +start + (yearSelectTotal satisfies number); +(start + yearSelectTotal) satisfies number; +scrollTop > (visibilityHeight satisfies number); +(scrollTop > visibilityHeight) satisfies number; +(bValue satisfies boolean) ? 0 : -1; + +async function g1() { + const test = (await 'foo') satisfies number; +} + +var x = (v => v) satisfies (x: number) => string; + +foo satisfies unknown satisfies Bar; +foo satisfies unknown as Bar; +foo as unknown satisfies Bar; + +=====================================output===================================== +;({} satisfies {}) +;({} satisfies X) +;() => ({} satisfies X) +this.isTabActionBar((e.target || e.srcElement) satisfies HTMLElement) + +"current" in (props.pagination satisfies Object) +;("current" in props.pagination) satisfies Object +start + (yearSelectTotal satisfies number) +;(start + yearSelectTotal) satisfies number +scrollTop > (visibilityHeight satisfies number) +;(scrollTop > visibilityHeight) satisfies number +;(bValue satisfies boolean) ? 0 : -1 + +async function g1() { + const test = (await "foo") satisfies number +} + +var x = ((v) => v) satisfies (x: number) => string + +foo satisfies unknown satisfies Bar +foo satisfies unknown as Bar +foo as unknown satisfies Bar + +================================================================================ +`; + +exports[`satisfies.ts format 1`] = ` +====================================options===================================== +parsers: ["babel-ts"] +printWidth: 80 + | printWidth +=====================================input====================================== +({}) satisfies {}; +({}) satisfies X; +() => ({}) satisfies X; +this.isTabActionBar((e.target || e.srcElement) satisfies HTMLElement); + +'current' in (props.pagination satisfies Object); +('current' in props.pagination) satisfies Object; +start + (yearSelectTotal satisfies number); +(start + yearSelectTotal) satisfies number; +scrollTop > (visibilityHeight satisfies number); +(scrollTop > visibilityHeight) satisfies number; +(bValue satisfies boolean) ? 0 : -1; + +async function g1() { + const test = (await 'foo') satisfies number; +} + +var x = (v => v) satisfies (x: number) => string; + +foo satisfies unknown satisfies Bar; +foo satisfies unknown as Bar; +foo as unknown satisfies Bar; + +=====================================output===================================== +({} satisfies {}); +({} satisfies X); +() => ({} satisfies X); +this.isTabActionBar((e.target || e.srcElement) satisfies HTMLElement); + +"current" in (props.pagination satisfies Object); +("current" in props.pagination) satisfies Object; +start + (yearSelectTotal satisfies number); +(start + yearSelectTotal) satisfies number; +scrollTop > (visibilityHeight satisfies number); +(scrollTop > visibilityHeight) satisfies number; +(bValue satisfies boolean) ? 0 : -1; + +async function g1() { + const test = (await "foo") satisfies number; +} + +var x = ((v) => v) satisfies (x: number) => string; + +foo satisfies unknown satisfies Bar; +foo satisfies unknown as Bar; +foo as unknown satisfies Bar; + +================================================================================ +`; + +exports[`template-literal.ts - {"semi":false} format 1`] = ` +====================================options===================================== +parsers: ["babel-ts"] +printWidth: 80 +semi: false + | printWidth +=====================================input====================================== +const a = \`\${(foo + bar) satisfies baz}\`; +const b = \`\${(veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFoo + bar) satisfies baz}\`; +const b = \`\${(foo + veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongBar) satisfies baz}\`; +const b = \`\${(foo + bar) satisfies veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongBaz}\`; +const b = \`\${(veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFoo + veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongBar) satisfies veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongBaz}\`; + +=====================================output===================================== +const a = \`\${(foo + bar) satisfies baz}\` +const b = \`\${ + (veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFoo + bar) satisfies baz +}\` +const b = \`\${ + (foo + veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongBar) satisfies baz +}\` +const b = \`\${ + (foo + bar) satisfies veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongBaz +}\` +const b = \`\${ + (veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFoo + + veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongBar) satisfies veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongBaz +}\` + +================================================================================ +`; + +exports[`template-literal.ts format 1`] = ` +====================================options===================================== +parsers: ["babel-ts"] +printWidth: 80 + | printWidth +=====================================input====================================== +const a = \`\${(foo + bar) satisfies baz}\`; +const b = \`\${(veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFoo + bar) satisfies baz}\`; +const b = \`\${(foo + veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongBar) satisfies baz}\`; +const b = \`\${(foo + bar) satisfies veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongBaz}\`; +const b = \`\${(veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFoo + veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongBar) satisfies veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongBaz}\`; + +=====================================output===================================== +const a = \`\${(foo + bar) satisfies baz}\`; +const b = \`\${ + (veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFoo + bar) satisfies baz +}\`; +const b = \`\${ + (foo + veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongBar) satisfies baz +}\`; +const b = \`\${ + (foo + bar) satisfies veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongBaz +}\`; +const b = \`\${ + (veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFoo + + veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongBar) satisfies veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongBaz +}\`; + +================================================================================ +`; + +exports[`ternary.ts - {"semi":false} format 1`] = ` +====================================options===================================== +parsers: ["babel-ts"] +printWidth: 80 +semi: false + | printWidth +=====================================input====================================== +foo = (coooooooooooooooooooooooooooooooooooooooooooooooooooond + ? baaaaaaaaaaaaaaaaaaaaar + : baaaaaaaaaaaaaaaaaaaaaz) satisfies Fooooooooooo; + +foo = (condition ? firstValue : secondValue) satisfies SomeType; + +const foo = (coooooooooooooooooooooooooooooooooooooooooooooooooooond + ? baaaaaaaaaaaaaaaaaaaaar + : baaaaaaaaaaaaaaaaaaaaaz) satisfies Fooooooooooo; + +function foo() { + return (coooooooooooooooooooooooooooooooooooooooooooooooooooond + ? baaaaaaaaaaaaaaaaaaaaar + : baaaaaaaaaaaaaaaaaaaaaz) satisfies Fooooooooooo; +} + +function foo() { + throw (coooooooooooooooooooooooooooooooooooooooooooooooooooond + ? baaaaaaaaaaaaaaaaaaaaar + : baaaaaaaaaaaaaaaaaaaaaz) satisfies Fooooooooooo; +} + +function foo() { + void ((coooooooooooooooooooooooooooooooooooooooooooooooooooond + ? baaaaaaaaaaaaaaaaaaaaar + : baaaaaaaaaaaaaaaaaaaaaz) satisfies Fooooooooooo); +} + +bifornCringerMoshedPerplexSawder = + askTrovenaBeenaDependsRowans + + ((glimseGlyphsHazardNoopsTieTie === 0 + ? averredBathersBoxroomBuggyNurl + : anodyneCondosMalateOverateRetinol) satisfies AnnularCooeedSplicesWalksWayWay); + +bifornCringerMoshedPerplexSawder = + askTrovenaBeenaDependsRowans + + ((glimseGlyphsHazardNoopsTieTie === 0 && + kochabCooieGameOnOboleUnweave === Math.PI + ? averredBathersBoxroomBuggyNurl + : anodyneCondosMalateOverateRetinol) satisfies AnnularCooeedSplicesWalksWayWay); + +=====================================output===================================== +foo = ( + coooooooooooooooooooooooooooooooooooooooooooooooooooond + ? baaaaaaaaaaaaaaaaaaaaar + : baaaaaaaaaaaaaaaaaaaaaz +) satisfies Fooooooooooo + +foo = (condition ? firstValue : secondValue) satisfies SomeType + +const foo = ( + coooooooooooooooooooooooooooooooooooooooooooooooooooond + ? baaaaaaaaaaaaaaaaaaaaar + : baaaaaaaaaaaaaaaaaaaaaz +) satisfies Fooooooooooo + +function foo() { + return ( + coooooooooooooooooooooooooooooooooooooooooooooooooooond + ? baaaaaaaaaaaaaaaaaaaaar + : baaaaaaaaaaaaaaaaaaaaaz + ) satisfies Fooooooooooo +} + +function foo() { + throw ( + coooooooooooooooooooooooooooooooooooooooooooooooooooond + ? baaaaaaaaaaaaaaaaaaaaar + : baaaaaaaaaaaaaaaaaaaaaz + ) satisfies Fooooooooooo +} + +function foo() { + void (( + coooooooooooooooooooooooooooooooooooooooooooooooooooond + ? baaaaaaaaaaaaaaaaaaaaar + : baaaaaaaaaaaaaaaaaaaaaz + ) satisfies Fooooooooooo) +} + +bifornCringerMoshedPerplexSawder = + askTrovenaBeenaDependsRowans + + ((glimseGlyphsHazardNoopsTieTie === 0 + ? averredBathersBoxroomBuggyNurl + : anodyneCondosMalateOverateRetinol) satisfies AnnularCooeedSplicesWalksWayWay) + +bifornCringerMoshedPerplexSawder = + askTrovenaBeenaDependsRowans + + ((glimseGlyphsHazardNoopsTieTie === 0 && + kochabCooieGameOnOboleUnweave === Math.PI + ? averredBathersBoxroomBuggyNurl + : anodyneCondosMalateOverateRetinol) satisfies AnnularCooeedSplicesWalksWayWay) + +================================================================================ +`; + +exports[`ternary.ts format 1`] = ` +====================================options===================================== +parsers: ["babel-ts"] +printWidth: 80 + | printWidth +=====================================input====================================== +foo = (coooooooooooooooooooooooooooooooooooooooooooooooooooond + ? baaaaaaaaaaaaaaaaaaaaar + : baaaaaaaaaaaaaaaaaaaaaz) satisfies Fooooooooooo; + +foo = (condition ? firstValue : secondValue) satisfies SomeType; + +const foo = (coooooooooooooooooooooooooooooooooooooooooooooooooooond + ? baaaaaaaaaaaaaaaaaaaaar + : baaaaaaaaaaaaaaaaaaaaaz) satisfies Fooooooooooo; + +function foo() { + return (coooooooooooooooooooooooooooooooooooooooooooooooooooond + ? baaaaaaaaaaaaaaaaaaaaar + : baaaaaaaaaaaaaaaaaaaaaz) satisfies Fooooooooooo; +} + +function foo() { + throw (coooooooooooooooooooooooooooooooooooooooooooooooooooond + ? baaaaaaaaaaaaaaaaaaaaar + : baaaaaaaaaaaaaaaaaaaaaz) satisfies Fooooooooooo; +} + +function foo() { + void ((coooooooooooooooooooooooooooooooooooooooooooooooooooond + ? baaaaaaaaaaaaaaaaaaaaar + : baaaaaaaaaaaaaaaaaaaaaz) satisfies Fooooooooooo); +} + +bifornCringerMoshedPerplexSawder = + askTrovenaBeenaDependsRowans + + ((glimseGlyphsHazardNoopsTieTie === 0 + ? averredBathersBoxroomBuggyNurl + : anodyneCondosMalateOverateRetinol) satisfies AnnularCooeedSplicesWalksWayWay); + +bifornCringerMoshedPerplexSawder = + askTrovenaBeenaDependsRowans + + ((glimseGlyphsHazardNoopsTieTie === 0 && + kochabCooieGameOnOboleUnweave === Math.PI + ? averredBathersBoxroomBuggyNurl + : anodyneCondosMalateOverateRetinol) satisfies AnnularCooeedSplicesWalksWayWay); + +=====================================output===================================== +foo = ( + coooooooooooooooooooooooooooooooooooooooooooooooooooond + ? baaaaaaaaaaaaaaaaaaaaar + : baaaaaaaaaaaaaaaaaaaaaz +) satisfies Fooooooooooo; + +foo = (condition ? firstValue : secondValue) satisfies SomeType; + +const foo = ( + coooooooooooooooooooooooooooooooooooooooooooooooooooond + ? baaaaaaaaaaaaaaaaaaaaar + : baaaaaaaaaaaaaaaaaaaaaz +) satisfies Fooooooooooo; + +function foo() { + return ( + coooooooooooooooooooooooooooooooooooooooooooooooooooond + ? baaaaaaaaaaaaaaaaaaaaar + : baaaaaaaaaaaaaaaaaaaaaz + ) satisfies Fooooooooooo; +} + +function foo() { + throw ( + coooooooooooooooooooooooooooooooooooooooooooooooooooond + ? baaaaaaaaaaaaaaaaaaaaar + : baaaaaaaaaaaaaaaaaaaaaz + ) satisfies Fooooooooooo; +} + +function foo() { + void (( + coooooooooooooooooooooooooooooooooooooooooooooooooooond + ? baaaaaaaaaaaaaaaaaaaaar + : baaaaaaaaaaaaaaaaaaaaaz + ) satisfies Fooooooooooo); +} + +bifornCringerMoshedPerplexSawder = + askTrovenaBeenaDependsRowans + + ((glimseGlyphsHazardNoopsTieTie === 0 + ? averredBathersBoxroomBuggyNurl + : anodyneCondosMalateOverateRetinol) satisfies AnnularCooeedSplicesWalksWayWay); + +bifornCringerMoshedPerplexSawder = + askTrovenaBeenaDependsRowans + + ((glimseGlyphsHazardNoopsTieTie === 0 && + kochabCooieGameOnOboleUnweave === Math.PI + ? averredBathersBoxroomBuggyNurl + : anodyneCondosMalateOverateRetinol) satisfies AnnularCooeedSplicesWalksWayWay); + +================================================================================ +`; + +exports[`types-comments.ts - {"semi":false} format 1`] = ` +====================================options===================================== +parsers: ["babel-ts"] +printWidth: 80 +semi: false + | printWidth +=====================================input====================================== +(() => { + // swallow error and fallback to using directory as path +}) satisfies string[]; + +=====================================output===================================== +;(() => { + // swallow error and fallback to using directory as path +}) satisfies string[] + +================================================================================ +`; + +exports[`types-comments.ts format 1`] = ` +====================================options===================================== +parsers: ["babel-ts"] +printWidth: 80 + | printWidth +=====================================input====================================== +(() => { + // swallow error and fallback to using directory as path +}) satisfies string[]; + +=====================================output===================================== +(() => { + // swallow error and fallback to using directory as path +}) satisfies string[]; + +================================================================================ +`; diff --git a/tests/format/typescript/satisfies-operators/argument-expansion.ts b/tests/format/typescript/satisfies-operators/argument-expansion.ts new file mode 100644 index 000000000000..aef1a1410c1a --- /dev/null +++ b/tests/format/typescript/satisfies-operators/argument-expansion.ts @@ -0,0 +1,19 @@ +const bar1 = [1,2,3].reduce((carry, value) => { + return [...carry, value]; +}, ([] satisfies unknown) satisfies number[]); + +const bar2 = [1,2,3].reduce((carry, value) => { + return [...carry, value]; +}, ([1, 2, 3] satisfies unknown) satisfies number[]); + +const bar3 = [1,2,3].reduce((carry, value) => { + return {...carry, [value]: true}; +}, ({} satisfies unknown) satisfies {[key: number]: boolean}); + +const bar4 = [1,2,3].reduce((carry, value) => { + return {...carry, [value]: true}; +}, ({1: true} satisfies unknown) satisfies {[key: number]: boolean}); + +const bar5 = [1,2,3].reduce((carry, value) => { + return [...carry, value]; +}, [] satisfies foo); diff --git a/tests/format/typescript/satisfies-operators/assignment.ts b/tests/format/typescript/satisfies-operators/assignment.ts new file mode 100644 index 000000000000..9b7139253bc4 --- /dev/null +++ b/tests/format/typescript/satisfies-operators/assignment.ts @@ -0,0 +1,21 @@ +const extraRendererAttrs = ((attrs.rendererAttrs && + this.utils.safeParseJsonString(attrs.rendererAttrs)) || + Object.create(null)) satisfies FieldService.RendererAttributes; + +const annotate = (angular.injector satisfies any).$$annotate satisfies ( + fn: Function +) => string[]; + +const originalPrototype = originalConstructor.prototype satisfies TComponent & InjectionTarget, + propertyToServiceName = originalPrototype._inject; + +this.previewPlayerHandle = (setInterval(async () => { + if (this.previewIsPlaying) { + await this.fetchNextPreviews(); + this.currentPreviewIndex++; + } +}, this.refreshDelay) satisfies unknown) satisfies number; + +this.intervalID = (setInterval(() => { + self.step(); +}, 30) satisfies unknown) satisfies number; diff --git a/tests/format/typescript/satisfies-operators/basic.ts b/tests/format/typescript/satisfies-operators/basic.ts new file mode 100644 index 000000000000..3eff7182b432 --- /dev/null +++ b/tests/format/typescript/satisfies-operators/basic.ts @@ -0,0 +1,30 @@ +const t1 = { a: 1 } satisfies I1; +const t2 = { a: 1, b: 1 } satisfies I1; +const t3 = { } satisfies I1; +const t4: T1 = { a: "a" } satisfies T1; +const t5 = (m => m.substring(0)) satisfies T2; +const t6 = [1, 2] satisfies [number, number]; +let t7 = { a: 'test' } satisfies A; +let t8 = { a: 'test', b: 'test' } satisfies A; + +const p = { + isEven: n => n % 2 === 0, + isOdd: n => n % 2 === 1 +} satisfies Predicates; + +let obj: { f(s: string): void } & Record = { + f(s) { }, + g(s) { } +} satisfies { g(s: string): void } & Record; + +({ f(x) { } }) satisfies { f(s: string): void }; + +const car = { + start() { }, + move(d) { + // d should be number + }, + stop() { } +} satisfies Movable & Record; + +var v = undefined satisfies 1; diff --git a/tests/format/typescript/satisfies-operators/comments-unstable.ts b/tests/format/typescript/satisfies-operators/comments-unstable.ts new file mode 100644 index 000000000000..0f658aa54605 --- /dev/null +++ b/tests/format/typescript/satisfies-operators/comments-unstable.ts @@ -0,0 +1,7 @@ +const t1 = { + prop1: 1, + prop2: 2, + prop3: 3 +} satisfies +// Comment +Record; diff --git a/tests/format/typescript/satisfies-operators/comments.ts b/tests/format/typescript/satisfies-operators/comments.ts new file mode 100644 index 000000000000..9ab0ae58c20c --- /dev/null +++ b/tests/format/typescript/satisfies-operators/comments.ts @@ -0,0 +1,3 @@ +const t2 = {} /* comment */ satisfies {}; +const t3 = {} satisfies /* comment */ {}; +const t4 = {} /* comment1 */ satisfies /* comment2 */ {}; diff --git a/tests/format/typescript/satisfies-operators/export-default-as.ts b/tests/format/typescript/satisfies-operators/export-default-as.ts new file mode 100644 index 000000000000..6d6905150d89 --- /dev/null +++ b/tests/format/typescript/satisfies-operators/export-default-as.ts @@ -0,0 +1 @@ +export default (function log() {} satisfies typeof console.log) diff --git a/tests/format/typescript/satisfies-operators/gt-lt.ts b/tests/format/typescript/satisfies-operators/gt-lt.ts new file mode 100644 index 000000000000..bdc95deefbed --- /dev/null +++ b/tests/format/typescript/satisfies-operators/gt-lt.ts @@ -0,0 +1,2 @@ +x satisfies boolean <= y; // (x satisfies boolean) <= y; +x satisfies boolean ?? y; // (x satisfies boolean) ?? y; diff --git a/tests/format/typescript/satisfies-operators/hug-args.ts b/tests/format/typescript/satisfies-operators/hug-args.ts new file mode 100644 index 000000000000..c35cf66fb521 --- /dev/null +++ b/tests/format/typescript/satisfies-operators/hug-args.ts @@ -0,0 +1,6 @@ +window.postMessage( + { + context: item.context, + topic: item.topic + } satisfies IActionMessage + ); diff --git a/tests/format/typescript/satisfies-operators/jsfmt.spec.js b/tests/format/typescript/satisfies-operators/jsfmt.spec.js new file mode 100644 index 000000000000..3727c175bda6 --- /dev/null +++ b/tests/format/typescript/satisfies-operators/jsfmt.spec.js @@ -0,0 +1,2 @@ +run_spec(__dirname, ["babel-ts"]); +run_spec(__dirname, ["babel-ts"], { semi: false }); diff --git a/tests/format/typescript/satisfies-operators/lhs.ts b/tests/format/typescript/satisfies-operators/lhs.ts new file mode 100644 index 000000000000..fbdbe1c91062 --- /dev/null +++ b/tests/format/typescript/satisfies-operators/lhs.ts @@ -0,0 +1,5 @@ +(a satisfies number) = 42; +({ a: (b satisfies any) = 2000 } = x); +(this.selectorElem satisfies any) = this.multiselectWidget = this.initialValues = undefined; +(this.configuration satisfies any) = (this.editor satisfies any) = (this + .editorBody satisfies any) = undefined; diff --git a/tests/format/typescript/satisfies-operators/nested-await-and-satisfies.ts b/tests/format/typescript/satisfies-operators/nested-await-and-satisfies.ts new file mode 100644 index 000000000000..d9c2b4a600be --- /dev/null +++ b/tests/format/typescript/satisfies-operators/nested-await-and-satisfies.ts @@ -0,0 +1,7 @@ +const getAccountCount = async () => + (await + ((await ( + await focusOnSection(BOOKMARKED_PROJECTS_SECTION_NAME) + ).findItem("My bookmarks")) satisfies TreeItem + ).getChildren() + ).length diff --git a/tests/format/typescript/satisfies-operators/non-null.ts b/tests/format/typescript/satisfies-operators/non-null.ts new file mode 100644 index 000000000000..9e1e0b3ac0b0 --- /dev/null +++ b/tests/format/typescript/satisfies-operators/non-null.ts @@ -0,0 +1,3 @@ +// the 2nd line needs ASI protection +const el = ReactDOM.findDOMNode(ref) +;(el satisfies HTMLElement)!.style.cursor = 'pointer' diff --git a/tests/format/typescript/satisfies-operators/satisfies.ts b/tests/format/typescript/satisfies-operators/satisfies.ts new file mode 100644 index 000000000000..f9b3f6f2acb3 --- /dev/null +++ b/tests/format/typescript/satisfies-operators/satisfies.ts @@ -0,0 +1,22 @@ +({}) satisfies {}; +({}) satisfies X; +() => ({}) satisfies X; +this.isTabActionBar((e.target || e.srcElement) satisfies HTMLElement); + +'current' in (props.pagination satisfies Object); +('current' in props.pagination) satisfies Object; +start + (yearSelectTotal satisfies number); +(start + yearSelectTotal) satisfies number; +scrollTop > (visibilityHeight satisfies number); +(scrollTop > visibilityHeight) satisfies number; +(bValue satisfies boolean) ? 0 : -1; + +async function g1() { + const test = (await 'foo') satisfies number; +} + +var x = (v => v) satisfies (x: number) => string; + +foo satisfies unknown satisfies Bar; +foo satisfies unknown as Bar; +foo as unknown satisfies Bar; diff --git a/tests/format/typescript/satisfies-operators/template-literal.ts b/tests/format/typescript/satisfies-operators/template-literal.ts new file mode 100644 index 000000000000..d4152adc97e5 --- /dev/null +++ b/tests/format/typescript/satisfies-operators/template-literal.ts @@ -0,0 +1,5 @@ +const a = `${(foo + bar) satisfies baz}`; +const b = `${(veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFoo + bar) satisfies baz}`; +const b = `${(foo + veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongBar) satisfies baz}`; +const b = `${(foo + bar) satisfies veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongBaz}`; +const b = `${(veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongFoo + veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongBar) satisfies veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongBaz}`; diff --git a/tests/format/typescript/satisfies-operators/ternary.ts b/tests/format/typescript/satisfies-operators/ternary.ts new file mode 100644 index 000000000000..0baab89c6c37 --- /dev/null +++ b/tests/format/typescript/satisfies-operators/ternary.ts @@ -0,0 +1,40 @@ +foo = (coooooooooooooooooooooooooooooooooooooooooooooooooooond + ? baaaaaaaaaaaaaaaaaaaaar + : baaaaaaaaaaaaaaaaaaaaaz) satisfies Fooooooooooo; + +foo = (condition ? firstValue : secondValue) satisfies SomeType; + +const foo = (coooooooooooooooooooooooooooooooooooooooooooooooooooond + ? baaaaaaaaaaaaaaaaaaaaar + : baaaaaaaaaaaaaaaaaaaaaz) satisfies Fooooooooooo; + +function foo() { + return (coooooooooooooooooooooooooooooooooooooooooooooooooooond + ? baaaaaaaaaaaaaaaaaaaaar + : baaaaaaaaaaaaaaaaaaaaaz) satisfies Fooooooooooo; +} + +function foo() { + throw (coooooooooooooooooooooooooooooooooooooooooooooooooooond + ? baaaaaaaaaaaaaaaaaaaaar + : baaaaaaaaaaaaaaaaaaaaaz) satisfies Fooooooooooo; +} + +function foo() { + void ((coooooooooooooooooooooooooooooooooooooooooooooooooooond + ? baaaaaaaaaaaaaaaaaaaaar + : baaaaaaaaaaaaaaaaaaaaaz) satisfies Fooooooooooo); +} + +bifornCringerMoshedPerplexSawder = + askTrovenaBeenaDependsRowans + + ((glimseGlyphsHazardNoopsTieTie === 0 + ? averredBathersBoxroomBuggyNurl + : anodyneCondosMalateOverateRetinol) satisfies AnnularCooeedSplicesWalksWayWay); + +bifornCringerMoshedPerplexSawder = + askTrovenaBeenaDependsRowans + + ((glimseGlyphsHazardNoopsTieTie === 0 && + kochabCooieGameOnOboleUnweave === Math.PI + ? averredBathersBoxroomBuggyNurl + : anodyneCondosMalateOverateRetinol) satisfies AnnularCooeedSplicesWalksWayWay); diff --git a/tests/format/typescript/satisfies-operators/types-comments.ts b/tests/format/typescript/satisfies-operators/types-comments.ts new file mode 100644 index 000000000000..8ef9413c2a31 --- /dev/null +++ b/tests/format/typescript/satisfies-operators/types-comments.ts @@ -0,0 +1,3 @@ +(() => { + // swallow error and fallback to using directory as path +}) satisfies string[]; diff --git a/yarn.lock b/yarn.lock index e545351d8422..53ae360e305d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -306,10 +306,10 @@ chalk "^2.0.0" js-tokens "^4.0.0" -"@babel/parser@7.18.0": - version "7.18.0" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.18.0.tgz#10a8d4e656bc01128d299a787aa006ce1a91e112" - integrity sha512-AqDccGC+m5O/iUStSJy3DGRIUFu7WbY/CppZYwrEUB4N0tZlnI8CSTsgL7v5fHVFmUbRv2sd+yy27o8Ydt4MGg== +"@babel/parser@7.20.1": + version "7.20.1" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.20.1.tgz#3e045a92f7b4623cafc2425eddcb8cf2e54f9cc5" + integrity sha512-hp0AYxaZJhxULfM1zyp7Wgr+pSUKBcP3M+PHnSzWGdXOzg/kHWIgiUWARvubhUKGOEw3xqY4x+lyZ9ytBVcELw== "@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.16.7", "@babel/parser@^7.17.9": version "7.17.9" @@ -1751,19 +1751,19 @@ dependencies: "@types/yargs-parser" "*" -"@typescript-eslint/eslint-plugin@5.20.0": - version "5.20.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.20.0.tgz#022531a639640ff3faafaf251d1ce00a2ef000a1" - integrity sha512-fapGzoxilCn3sBtC6NtXZX6+P/Hef7VDbyfGqTTpzYydwhlkevB+0vE0EnmHPVTVSy68GUncyJ/2PcrFBeCo5Q== +"@typescript-eslint/eslint-plugin@5.36.2": + version "5.36.2" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.36.2.tgz#6df092a20e0f9ec748b27f293a12cb39d0c1fe4d" + integrity sha512-OwwR8LRwSnI98tdc2z7mJYgY60gf7I9ZfGjN5EjCwwns9bdTuQfAXcsjSB2wSQ/TVNYSGKf4kzVXbNGaZvwiXw== dependencies: - "@typescript-eslint/scope-manager" "5.20.0" - "@typescript-eslint/type-utils" "5.20.0" - "@typescript-eslint/utils" "5.20.0" - debug "^4.3.2" + "@typescript-eslint/scope-manager" "5.36.2" + "@typescript-eslint/type-utils" "5.36.2" + "@typescript-eslint/utils" "5.36.2" + debug "^4.3.4" functional-red-black-tree "^1.0.1" - ignore "^5.1.8" + ignore "^5.2.0" regexpp "^3.2.0" - semver "^7.3.5" + semver "^7.3.7" tsutils "^3.21.0" "@typescript-eslint/scope-manager@5.20.0": @@ -1774,13 +1774,22 @@ "@typescript-eslint/types" "5.20.0" "@typescript-eslint/visitor-keys" "5.20.0" -"@typescript-eslint/type-utils@5.20.0": - version "5.20.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.20.0.tgz#151c21cbe9a378a34685735036e5ddfc00223be3" - integrity sha512-WxNrCwYB3N/m8ceyoGCgbLmuZwupvzN0rE8NBuwnl7APgjv24ZJIjkNzoFBXPRCGzLNkoU/WfanW0exvp/+3Iw== +"@typescript-eslint/scope-manager@5.36.2": + version "5.36.2" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.36.2.tgz#a75eb588a3879ae659514780831370642505d1cd" + integrity sha512-cNNP51L8SkIFSfce8B1NSUBTJTu2Ts4nWeWbFrdaqjmn9yKrAaJUBHkyTZc0cL06OFHpb+JZq5AUHROS398Orw== dependencies: - "@typescript-eslint/utils" "5.20.0" - debug "^4.3.2" + "@typescript-eslint/types" "5.36.2" + "@typescript-eslint/visitor-keys" "5.36.2" + +"@typescript-eslint/type-utils@5.36.2": + version "5.36.2" + resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.36.2.tgz#752373f4babf05e993adf2cd543a763632826391" + integrity sha512-rPQtS5rfijUWLouhy6UmyNquKDPhQjKsaKH0WnY6hl/07lasj8gPaH2UD8xWkePn6SC+jW2i9c2DZVDnL+Dokw== + dependencies: + "@typescript-eslint/typescript-estree" "5.36.2" + "@typescript-eslint/utils" "5.36.2" + debug "^4.3.4" tsutils "^3.21.0" "@typescript-eslint/types@5.20.0": @@ -1788,10 +1797,10 @@ resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.20.0.tgz#fa39c3c2aa786568302318f1cb51fcf64258c20c" integrity sha512-+d8wprF9GyvPwtoB4CxBAR/s0rpP25XKgnOvMf/gMXYDvlUC3rPFHupdTQ/ow9vn7UDe5rX02ovGYQbv/IUCbg== -"@typescript-eslint/types@5.30.0": - version "5.30.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.30.0.tgz#db7d81d585a3da3801432a9c1d2fafbff125e110" - integrity sha512-vfqcBrsRNWw/LBXyncMF/KrUTYYzzygCSsVqlZ1qGu1QtGs6vMkt3US0VNSQ05grXi5Yadp3qv5XZdYLjpp8ag== +"@typescript-eslint/types@5.36.2": + version "5.36.2" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.36.2.tgz#a5066e500ebcfcee36694186ccc57b955c05faf9" + integrity sha512-9OJSvvwuF1L5eS2EQgFUbECb99F0mwq501w0H0EkYULkhFa19Qq7WFbycdw1PexAc929asupbZcgjVIe6OK/XQ== "@typescript-eslint/typescript-estree@5.20.0": version "5.20.0" @@ -1806,20 +1815,32 @@ semver "^7.3.5" tsutils "^3.21.0" -"@typescript-eslint/typescript-estree@5.30.0": - version "5.30.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.30.0.tgz#4565ee8a6d2ac368996e20b2344ea0eab1a8f0bb" - integrity sha512-hDEawogreZB4n1zoqcrrtg/wPyyiCxmhPLpZ6kmWfKF5M5G0clRLaEexpuWr31fZ42F96SlD/5xCt1bT5Qm4Nw== +"@typescript-eslint/typescript-estree@5.36.2": + version "5.36.2" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.36.2.tgz#0c93418b36c53ba0bc34c61fe9405c4d1d8fe560" + integrity sha512-8fyH+RfbKc0mTspfuEjlfqA4YywcwQK2Amcf6TDOwaRLg7Vwdu4bZzyvBZp4bjt1RRjQ5MDnOZahxMrt2l5v9w== dependencies: - "@typescript-eslint/types" "5.30.0" - "@typescript-eslint/visitor-keys" "5.30.0" + "@typescript-eslint/types" "5.36.2" + "@typescript-eslint/visitor-keys" "5.36.2" debug "^4.3.4" globby "^11.1.0" is-glob "^4.0.3" semver "^7.3.7" tsutils "^3.21.0" -"@typescript-eslint/utils@5.20.0", "@typescript-eslint/utils@^5.10.0": +"@typescript-eslint/utils@5.36.2": + version "5.36.2" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.36.2.tgz#b01a76f0ab244404c7aefc340c5015d5ce6da74c" + integrity sha512-uNcopWonEITX96v9pefk9DC1bWMdkweeSsewJ6GeC7L6j2t0SJywisgkr9wUTtXk90fi2Eljj90HSHm3OGdGRg== + dependencies: + "@types/json-schema" "^7.0.9" + "@typescript-eslint/scope-manager" "5.36.2" + "@typescript-eslint/types" "5.36.2" + "@typescript-eslint/typescript-estree" "5.36.2" + eslint-scope "^5.1.1" + eslint-utils "^3.0.0" + +"@typescript-eslint/utils@^5.10.0": version "5.20.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.20.0.tgz#b8e959ed11eca1b2d5414e12417fd94cae3517a5" integrity sha512-lHONGJL1LIO12Ujyx8L8xKbwWSkoUKFSO+0wDAqGXiudWB2EO7WEUT+YZLtVbmOmSllAjLb9tpoIPwpRe5Tn6w== @@ -1839,12 +1860,12 @@ "@typescript-eslint/types" "5.20.0" eslint-visitor-keys "^3.0.0" -"@typescript-eslint/visitor-keys@5.30.0": - version "5.30.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.30.0.tgz#07721d23daca2ec4c2da7f1e660d41cd78bacac3" - integrity sha512-6WcIeRk2DQ3pHKxU1Ni0qMXJkjO/zLjBymlYBy/53qxe7yjEFSvzKLDToJjURUhSl2Fzhkl4SMXQoETauF74cw== +"@typescript-eslint/visitor-keys@5.36.2": + version "5.36.2" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.36.2.tgz#2f8f78da0a3bad3320d2ac24965791ac39dace5a" + integrity sha512-BtRvSR6dEdrNt7Net2/XDjbYKU5Ml6GqJgVfXT0CxTCJlnIqK7rAGreuWKMT2t8cFUT2Msv5oxw0GMRD7T5J7A== dependencies: - "@typescript-eslint/types" "5.30.0" + "@typescript-eslint/types" "5.36.2" eslint-visitor-keys "^3.3.0" abab@^2.0.3, abab@^2.0.5: @@ -2241,9 +2262,9 @@ camelcase@^5.3.1: integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== caniuse-lite@^1.0.30001286, caniuse-lite@^1.0.30001304: - version "1.0.30001341" - resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001341.tgz" - integrity sha512-2SodVrFFtvGENGCv0ChVJIDQ0KPaS1cg7/qtfMaICgeMolDdo/Z2OD32F0Aq9yl6F4YFwGPBS5AaPqNYiW4PoA== + version "1.0.30001429" + resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001429.tgz" + integrity sha512-511ThLu1hF+5RRRt0zYCf2U2yRr9GPF6m5y90SBCWsvSoYoW7yAGlv/elyPaNfvGCkp6kj/KFZWU0BMA69Prsg== ccount@^1.0.0: version "1.1.0" @@ -3768,7 +3789,7 @@ iconv-lite@0.4.24: dependencies: safer-buffer ">= 2.1.2 < 3" -ignore@5.2.0, ignore@^5.1.8, ignore@^5.2.0: +ignore@5.2.0, ignore@^5.2.0: version "5.2.0" resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.2.0.tgz#6d3bac8fa7fe0d45d9f9be7bac2fc279577e345a" integrity sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ== @@ -6483,10 +6504,10 @@ typedarray-to-buffer@^3.1.5: dependencies: is-typedarray "^1.0.0" -typescript@4.7.2: - version "4.7.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.7.2.tgz#1f9aa2ceb9af87cca227813b4310fff0b51593c4" - integrity sha512-Mamb1iX2FDUpcTRzltPxgWMKy3fhg0TN378ylbktPGPK/99KbDtMQ4W1hwgsbPAsG3a0xKa1vmw4VKZQbkvz5A== +typescript@4.8.2: + version "4.8.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.8.2.tgz#e3b33d5ccfb5914e4eeab6699cf208adee3fd790" + integrity sha512-C0I1UsrrDHo2fYI5oaCGbSejwX4ch+9Y5jTQELvovfmFkK3HHSZJB8MSJcWLmCUBzQBchCrZ9rMRV6GuNrvGtw== unbox-primitive@^1.0.1: version "1.0.1"