From 381e60974986c8fc1d052a273b14adc38bc23a33 Mon Sep 17 00:00:00 2001 From: TypeScript Bot Date: Tue, 16 Jul 2024 13:50:51 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=96=20Pick=20PR=20#59137=20(`visitNode?= =?UTF-8?q?sWithoutCopyingPositions`...)=20into=20release-5.5=20(#59179)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Isabel Duan --- src/compiler/checker.ts | 2 +- tests/cases/fourslash/nodeArrayCloneCrash.ts | 38 ++++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 tests/cases/fourslash/nodeArrayCloneCrash.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 6605372406af4..a99513cba1dad 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -8969,7 +8969,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { if (result) { if (result.pos !== -1 || result.end !== -1) { if (result === nodes) { - result = factory.createNodeArray(nodes, nodes.hasTrailingComma); + result = factory.createNodeArray(nodes.slice(), nodes.hasTrailingComma); } setTextRangePosEnd(result, -1, -1); } diff --git a/tests/cases/fourslash/nodeArrayCloneCrash.ts b/tests/cases/fourslash/nodeArrayCloneCrash.ts new file mode 100644 index 0000000000000..d18a2d7bf8fab --- /dev/null +++ b/tests/cases/fourslash/nodeArrayCloneCrash.ts @@ -0,0 +1,38 @@ +/// + +// @module: preserve + +// @Filename: /TLLineShape.ts +//// import { createShapePropsMigrationIds } from "./TLShape"; +//// createShapePropsMigrationIds/**/ + +// @Filename: /TLShape.ts +//// import { T } from "@tldraw/validate"; +//// +//// /** +//// * @public +//// */ +//// export function createShapePropsMigrationIds(): { [k in keyof T]: any } { +//// return; +//// } + +verify.completions({ + marker: "", + includes: [ + { + name: "createShapePropsMigrationIds", + text: "(alias) function createShapePropsMigrationIds(): { [k in keyof T]: any; }\nimport createShapePropsMigrationIds", + tags: [{ name: "public", text: undefined }] + } + ] +}); + +goTo.file("/TLShape.ts"); +verify.organizeImports( +` +/** + * @public + */ +export function createShapePropsMigrationIds(): { [k in keyof T]: any } { + return; +}`); \ No newline at end of file