From b547906da5c134ce2c485ee51c6119f88649ede1 Mon Sep 17 00:00:00 2001 From: TypeScript Bot Date: Thu, 1 Jun 2023 12:57:22 -0700 Subject: [PATCH 1/9] =?UTF-8?q?=F0=9F=A4=96=20Pick=20PR=20#54425=20(fix(54?= =?UTF-8?q?411):=20Compiled=20code=20contain=20j...)=20into=20release-5.1?= =?UTF-8?q?=20(#54489)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Oleksandr T --- src/compiler/transformers/jsx.ts | 2 +- tests/baselines/reference/jsxSpreadTag.js | 10 ++++++++++ .../baselines/reference/jsxSpreadTag.symbols | 11 +++++++++++ tests/baselines/reference/jsxSpreadTag.types | 19 +++++++++++++++++++ tests/cases/compiler/jsxSpreadTag.ts | 8 ++++++++ 5 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 tests/baselines/reference/jsxSpreadTag.js create mode 100644 tests/baselines/reference/jsxSpreadTag.symbols create mode 100644 tests/baselines/reference/jsxSpreadTag.types create mode 100644 tests/cases/compiler/jsxSpreadTag.ts diff --git a/src/compiler/transformers/jsx.ts b/src/compiler/transformers/jsx.ts index 52fa0bc564f74..3447a2249524c 100644 --- a/src/compiler/transformers/jsx.ts +++ b/src/compiler/transformers/jsx.ts @@ -480,7 +480,7 @@ export function transformJsx(context: TransformationContext): (x: SourceFile | B continue; } finishObjectLiteralIfNeeded(); - expressions.push(attr.expression); + expressions.push(Debug.checkDefined(visitNode(attr.expression, visitor, isExpression))); continue; } properties.push(transformJsxAttributeToObjectLiteralElement(attr)); diff --git a/tests/baselines/reference/jsxSpreadTag.js b/tests/baselines/reference/jsxSpreadTag.js new file mode 100644 index 0000000000000..2fbf28534213e --- /dev/null +++ b/tests/baselines/reference/jsxSpreadTag.js @@ -0,0 +1,10 @@ +//// [a.tsx] +declare const React: any; + +const t1 =
} />; +const t2 =
} />; + + +//// [a.js] +const t1 = React.createElement("div", Object.assign({}, React.createElement("span", null))); +const t2 = React.createElement("div", Object.assign({}, React.createElement("span", { className: "foo" }))); diff --git a/tests/baselines/reference/jsxSpreadTag.symbols b/tests/baselines/reference/jsxSpreadTag.symbols new file mode 100644 index 0000000000000..93057b1ff6568 --- /dev/null +++ b/tests/baselines/reference/jsxSpreadTag.symbols @@ -0,0 +1,11 @@ +=== /a.tsx === +declare const React: any; +>React : Symbol(React, Decl(a.tsx, 0, 13)) + +const t1 =
} />; +>t1 : Symbol(t1, Decl(a.tsx, 2, 5)) + +const t2 =
} />; +>t2 : Symbol(t2, Decl(a.tsx, 3, 5)) +>className : Symbol(className, Decl(a.tsx, 3, 25)) + diff --git a/tests/baselines/reference/jsxSpreadTag.types b/tests/baselines/reference/jsxSpreadTag.types new file mode 100644 index 0000000000000..c3647817a71d9 --- /dev/null +++ b/tests/baselines/reference/jsxSpreadTag.types @@ -0,0 +1,19 @@ +=== /a.tsx === +declare const React: any; +>React : any + +const t1 =
} />; +>t1 : error +>
} /> : error +>div : any +> : error +>span : any + +const t2 =
} />; +>t2 : error +>
} /> : error +>div : any +> : error +>span : any +>className : string + diff --git a/tests/cases/compiler/jsxSpreadTag.ts b/tests/cases/compiler/jsxSpreadTag.ts new file mode 100644 index 0000000000000..d572d05783039 --- /dev/null +++ b/tests/cases/compiler/jsxSpreadTag.ts @@ -0,0 +1,8 @@ +// @jsx: react +// @target: es2015 +// @filename: /a.tsx + +declare const React: any; + +const t1 =
} />; +const t2 =
} />; From d1259a11889e06df3bac12e9257bb510df3f24d7 Mon Sep 17 00:00:00 2001 From: TypeScript Bot Date: Wed, 7 Jun 2023 15:13:50 -0700 Subject: [PATCH 2/9] =?UTF-8?q?=F0=9F=A4=96=20Pick=20PR=20#54507=20(Ensure?= =?UTF-8?q?=20we=20don't=20overwrite=20computed=20...)=20into=20release-5.?= =?UTF-8?q?1=20(#54545)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Jake Bailey <5341706+jakebailey@users.noreply.github.com> --- src/compiler/checker.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 0715f58e71429..59e5c3e8aee45 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -18768,8 +18768,12 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { // If none of the type arguments for the outer type parameters contain type variables, it follows // that the instantiated type doesn't reference type variables. if (result.flags & TypeFlags.ObjectFlagsType && !((result as ObjectFlagsType).objectFlags & ObjectFlags.CouldContainTypeVariablesComputed)) { - (result as ObjectFlagsType).objectFlags |= ObjectFlags.CouldContainTypeVariablesComputed | - (some(typeArguments, couldContainTypeVariables) ? ObjectFlags.CouldContainTypeVariables : 0); + const resultCouldContainTypeVariables = some(typeArguments, couldContainTypeVariables); + // The above check may have caused the result's objectFlags to update if the result is referenced via typeArguments. + if (!((result as ObjectFlagsType).objectFlags & ObjectFlags.CouldContainTypeVariablesComputed)) { + (result as ObjectFlagsType).objectFlags |= ObjectFlags.CouldContainTypeVariablesComputed | + (resultCouldContainTypeVariables ? ObjectFlags.CouldContainTypeVariables : 0); + } } target.instantiations.set(id, result); } From e6ceba084147bd00045c573a1ba9843c0bb5c721 Mon Sep 17 00:00:00 2001 From: TypeScript Bot Date: Wed, 7 Jun 2023 22:28:56 +0000 Subject: [PATCH 3/9] Bump version to 5.1.4 and LKG --- lib/tsc.js | 9 ++++++--- lib/tsserver.js | 9 ++++++--- lib/tsserverlibrary.js | 9 ++++++--- lib/typescript.js | 9 ++++++--- lib/typingsInstaller.js | 2 +- package.json | 2 +- src/compiler/corePublic.ts | 2 +- 7 files changed, 27 insertions(+), 15 deletions(-) diff --git a/lib/tsc.js b/lib/tsc.js index 7670cce0ca8a9..f1380f4ecf2ec 100644 --- a/lib/tsc.js +++ b/lib/tsc.js @@ -18,7 +18,7 @@ and limitations under the License. // src/compiler/corePublic.ts var versionMajorMinor = "5.1"; -var version = "5.1.3"; +var version = "5.1.4"; // src/compiler/core.ts var emptyArray = []; @@ -58055,7 +58055,10 @@ function createTypeChecker(host) { const newMapper = createTypeMapper(typeParameters, typeArguments); result = target.objectFlags & 4 /* Reference */ ? createDeferredTypeReference(type.target, type.node, newMapper, newAliasSymbol, newAliasTypeArguments) : target.objectFlags & 32 /* Mapped */ ? instantiateMappedType(target, newMapper, newAliasSymbol, newAliasTypeArguments) : instantiateAnonymousType(target, newMapper, newAliasSymbol, newAliasTypeArguments); if (result.flags & 138117121 /* ObjectFlagsType */ && !(result.objectFlags & 524288 /* CouldContainTypeVariablesComputed */)) { - result.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (some(typeArguments, couldContainTypeVariables) ? 1048576 /* CouldContainTypeVariables */ : 0); + const resultCouldContainTypeVariables = some(typeArguments, couldContainTypeVariables); + if (!(result.objectFlags & 524288 /* CouldContainTypeVariablesComputed */)) { + result.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (resultCouldContainTypeVariables ? 1048576 /* CouldContainTypeVariables */ : 0); + } } target.instantiations.set(id, result); } @@ -95306,7 +95309,7 @@ function transformJsx(context) { continue; } finishObjectLiteralIfNeeded(); - expressions.push(attr.expression); + expressions.push(Debug.checkDefined(visitNode(attr.expression, visitor, isExpression))); continue; } properties.push(transformJsxAttributeToObjectLiteralElement(attr)); diff --git a/lib/tsserver.js b/lib/tsserver.js index 63bcdac309ff4..0d87a1c790788 100644 --- a/lib/tsserver.js +++ b/lib/tsserver.js @@ -2304,7 +2304,7 @@ module.exports = __toCommonJS(server_exports); // src/compiler/corePublic.ts var versionMajorMinor = "5.1"; -var version = "5.1.3"; +var version = "5.1.4"; var Comparison = /* @__PURE__ */ ((Comparison3) => { Comparison3[Comparison3["LessThan"] = -1] = "LessThan"; Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo"; @@ -62706,7 +62706,10 @@ function createTypeChecker(host) { const newMapper = createTypeMapper(typeParameters, typeArguments); result = target.objectFlags & 4 /* Reference */ ? createDeferredTypeReference(type.target, type.node, newMapper, newAliasSymbol, newAliasTypeArguments) : target.objectFlags & 32 /* Mapped */ ? instantiateMappedType(target, newMapper, newAliasSymbol, newAliasTypeArguments) : instantiateAnonymousType(target, newMapper, newAliasSymbol, newAliasTypeArguments); if (result.flags & 138117121 /* ObjectFlagsType */ && !(result.objectFlags & 524288 /* CouldContainTypeVariablesComputed */)) { - result.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (some(typeArguments, couldContainTypeVariables) ? 1048576 /* CouldContainTypeVariables */ : 0); + const resultCouldContainTypeVariables = some(typeArguments, couldContainTypeVariables); + if (!(result.objectFlags & 524288 /* CouldContainTypeVariablesComputed */)) { + result.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (resultCouldContainTypeVariables ? 1048576 /* CouldContainTypeVariables */ : 0); + } } target.instantiations.set(id, result); } @@ -100128,7 +100131,7 @@ function transformJsx(context) { continue; } finishObjectLiteralIfNeeded(); - expressions.push(attr.expression); + expressions.push(Debug.checkDefined(visitNode(attr.expression, visitor, isExpression))); continue; } properties.push(transformJsxAttributeToObjectLiteralElement(attr)); diff --git a/lib/tsserverlibrary.js b/lib/tsserverlibrary.js index 872b4a4bd1fed..b20060ffedcec 100644 --- a/lib/tsserverlibrary.js +++ b/lib/tsserverlibrary.js @@ -35,7 +35,7 @@ var ts = (() => { "src/compiler/corePublic.ts"() { "use strict"; versionMajorMinor = "5.1"; - version = "5.1.3"; + version = "5.1.4"; Comparison = /* @__PURE__ */ ((Comparison3) => { Comparison3[Comparison3["LessThan"] = -1] = "LessThan"; Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo"; @@ -60497,7 +60497,10 @@ ${lanes.join("\n")} const newMapper = createTypeMapper(typeParameters, typeArguments); result = target.objectFlags & 4 /* Reference */ ? createDeferredTypeReference(type.target, type.node, newMapper, newAliasSymbol, newAliasTypeArguments) : target.objectFlags & 32 /* Mapped */ ? instantiateMappedType(target, newMapper, newAliasSymbol, newAliasTypeArguments) : instantiateAnonymousType(target, newMapper, newAliasSymbol, newAliasTypeArguments); if (result.flags & 138117121 /* ObjectFlagsType */ && !(result.objectFlags & 524288 /* CouldContainTypeVariablesComputed */)) { - result.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (some(typeArguments, couldContainTypeVariables) ? 1048576 /* CouldContainTypeVariables */ : 0); + const resultCouldContainTypeVariables = some(typeArguments, couldContainTypeVariables); + if (!(result.objectFlags & 524288 /* CouldContainTypeVariablesComputed */)) { + result.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (resultCouldContainTypeVariables ? 1048576 /* CouldContainTypeVariables */ : 0); + } } target.instantiations.set(id, result); } @@ -98154,7 +98157,7 @@ ${lanes.join("\n")} continue; } finishObjectLiteralIfNeeded(); - expressions.push(attr.expression); + expressions.push(Debug.checkDefined(visitNode(attr.expression, visitor, isExpression))); continue; } properties.push(transformJsxAttributeToObjectLiteralElement(attr)); diff --git a/lib/typescript.js b/lib/typescript.js index 3e038fb51b5e6..d56076c2ee5b6 100644 --- a/lib/typescript.js +++ b/lib/typescript.js @@ -35,7 +35,7 @@ var ts = (() => { "src/compiler/corePublic.ts"() { "use strict"; versionMajorMinor = "5.1"; - version = "5.1.3"; + version = "5.1.4"; Comparison = /* @__PURE__ */ ((Comparison3) => { Comparison3[Comparison3["LessThan"] = -1] = "LessThan"; Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo"; @@ -60497,7 +60497,10 @@ ${lanes.join("\n")} const newMapper = createTypeMapper(typeParameters, typeArguments); result = target.objectFlags & 4 /* Reference */ ? createDeferredTypeReference(type.target, type.node, newMapper, newAliasSymbol, newAliasTypeArguments) : target.objectFlags & 32 /* Mapped */ ? instantiateMappedType(target, newMapper, newAliasSymbol, newAliasTypeArguments) : instantiateAnonymousType(target, newMapper, newAliasSymbol, newAliasTypeArguments); if (result.flags & 138117121 /* ObjectFlagsType */ && !(result.objectFlags & 524288 /* CouldContainTypeVariablesComputed */)) { - result.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (some(typeArguments, couldContainTypeVariables) ? 1048576 /* CouldContainTypeVariables */ : 0); + const resultCouldContainTypeVariables = some(typeArguments, couldContainTypeVariables); + if (!(result.objectFlags & 524288 /* CouldContainTypeVariablesComputed */)) { + result.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (resultCouldContainTypeVariables ? 1048576 /* CouldContainTypeVariables */ : 0); + } } target.instantiations.set(id, result); } @@ -98154,7 +98157,7 @@ ${lanes.join("\n")} continue; } finishObjectLiteralIfNeeded(); - expressions.push(attr.expression); + expressions.push(Debug.checkDefined(visitNode(attr.expression, visitor, isExpression))); continue; } properties.push(transformJsxAttributeToObjectLiteralElement(attr)); diff --git a/lib/typingsInstaller.js b/lib/typingsInstaller.js index e29b10166c898..d3cf1506449e9 100644 --- a/lib/typingsInstaller.js +++ b/lib/typingsInstaller.js @@ -54,7 +54,7 @@ var path = __toESM(require("path")); // src/compiler/corePublic.ts var versionMajorMinor = "5.1"; -var version = "5.1.3"; +var version = "5.1.4"; // src/compiler/core.ts var emptyArray = []; diff --git a/package.json b/package.json index 291ad5fbf1745..d364bedf7b6e1 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "typescript", "author": "Microsoft Corp.", "homepage": "https://www.typescriptlang.org/", - "version": "5.1.3", + "version": "5.1.4", "license": "Apache-2.0", "description": "TypeScript is a language for application scale JavaScript development", "keywords": [ diff --git a/src/compiler/corePublic.ts b/src/compiler/corePublic.ts index 0109115ede21d..4e01d23815da8 100644 --- a/src/compiler/corePublic.ts +++ b/src/compiler/corePublic.ts @@ -4,7 +4,7 @@ export const versionMajorMinor = "5.1"; // The following is baselined as a literal template type without intervention /** The version of the TypeScript compiler release */ // eslint-disable-next-line @typescript-eslint/no-inferrable-types -export const version = "5.1.3" as string; +export const version = "5.1.4" as string; /** * Type of objects whose values are all of the same type. From 2d031ce160d9cd3272d58161bce1f55bafd2b52e Mon Sep 17 00:00:00 2001 From: TypeScript Bot Date: Mon, 26 Jun 2023 12:02:47 -0700 Subject: [PATCH 4/9] =?UTF-8?q?=F0=9F=A4=96=20Pick=20PR=20#54656=20(fix:?= =?UTF-8?q?=20no=20variable=20suggestions=20withou...)=20into=20release-5.?= =?UTF-8?q?1=20(#54782)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Vitaly Turovsky --- src/services/completions.ts | 16 +++++++++++----- tests/cases/fourslash/completionEntryForConst.ts | 10 ++++++++-- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/services/completions.ts b/src/services/completions.ts index 75ec22e3528e4..b4563b0312034 100644 --- a/src/services/completions.ts +++ b/src/services/completions.ts @@ -2394,7 +2394,7 @@ export function getCompletionEntriesFromSymbols( includeSymbol = false ): UniqueNameSet { const start = timestamp(); - const variableOrParameterDeclaration = getVariableOrParameterDeclaration(contextToken); + const variableOrParameterDeclaration = getVariableOrParameterDeclaration(contextToken, location); const useSemicolons = probablyUsesSemicolons(sourceFile); const typeChecker = program.getTypeChecker(); // Tracks unique names. @@ -5464,14 +5464,20 @@ function isModuleSpecifierMissingOrEmpty(specifier: ModuleReference | Expression return !tryCast(isExternalModuleReference(specifier) ? specifier.expression : specifier, isStringLiteralLike)?.text; } -function getVariableOrParameterDeclaration(contextToken: Node | undefined) { +function getVariableOrParameterDeclaration(contextToken: Node | undefined, location: Node) { if (!contextToken) return; - const declaration = findAncestor(contextToken, node => + const possiblyParameterDeclaration = findAncestor(contextToken, node => isFunctionBlock(node) || isArrowFunctionBody(node) || isBindingPattern(node) ? "quit" - : isVariableDeclaration(node) || ((isParameter(node) || isTypeParameterDeclaration(node)) && !isIndexSignatureDeclaration(node.parent))); - return declaration as ParameterDeclaration | TypeParameterDeclaration | VariableDeclaration | undefined; + : ((isParameter(node) || isTypeParameterDeclaration(node)) && !isIndexSignatureDeclaration(node.parent))); + + const possiblyVariableDeclaration = findAncestor(location, node => + isFunctionBlock(node) || isArrowFunctionBody(node) || isBindingPattern(node) + ? "quit" + : isVariableDeclaration(node)); + + return (possiblyParameterDeclaration || possiblyVariableDeclaration) as ParameterDeclaration | TypeParameterDeclaration | VariableDeclaration | undefined; } function isArrowFunctionBody(node: Node) { diff --git a/tests/cases/fourslash/completionEntryForConst.ts b/tests/cases/fourslash/completionEntryForConst.ts index c89dd82124580..39d85df6de4c7 100644 --- a/tests/cases/fourslash/completionEntryForConst.ts +++ b/tests/cases/fourslash/completionEntryForConst.ts @@ -1,6 +1,12 @@ /// ////const c = "s"; -/////**/ +/////*1*/ +////const d = 1 +////d/*2*/ +////const e = 1 +/////*3*/ -verify.completions({ marker: "", includes: { name: "c", text: 'const c: "s"', kind: "const" } }); +verify.completions({ marker: ["1"], includes: { name: "c", text: 'const c: "s"', kind: "const" } }); +verify.completions({ marker: ["2"], includes: { name: "d", text: 'const d: 1', kind: "const" } }); +verify.completions({ marker: ["3"], includes: { name: "e", text: 'const e: 1', kind: "const" } }); From 668c93bac78c16edc35ac18d1742b069b16f8dd4 Mon Sep 17 00:00:00 2001 From: TypeScript Bot Date: Mon, 26 Jun 2023 13:25:38 -0700 Subject: [PATCH 5/9] =?UTF-8?q?=F0=9F=A4=96=20Pick=20PR=20#54578=20(Switch?= =?UTF-8?q?=20from=20corepack=20to=20a=20global=20np...)=20into=20release-?= =?UTF-8?q?5.1=20(#54787)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Jake Bailey <5341706+jakebailey@users.noreply.github.com> --- .github/workflows/ci.yml | 11 +++++++++-- .github/workflows/new-release-branch.yaml | 4 +++- .github/workflows/nightly.yaml | 4 +++- .github/workflows/release-branch-artifact.yaml | 4 +++- .github/workflows/set-version.yaml | 4 +++- .github/workflows/update-package-lock.yaml | 4 +++- 6 files changed, 24 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9bce28f22e5ad..8a1cf9a02d2ef 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -101,7 +101,9 @@ jobs: node-version: "*" check-latest: true - run: | - corepack enable npm + npm --version + # corepack enable npm + npm install -g $(jq -r '.packageManager' < package.json) npm --version - run: npm ci @@ -147,8 +149,13 @@ jobs: node-version: "*" check-latest: true - run: | - corepack enable npm npm --version + # corepack enable npm + + - run: | + npm install -g $(jq -r '.packageManager' < package.json) + npm --version + working-directory: ./pr - run: npm ci working-directory: ./pr diff --git a/.github/workflows/new-release-branch.yaml b/.github/workflows/new-release-branch.yaml index dcd720a42da4f..e8d56babb6b6e 100644 --- a/.github/workflows/new-release-branch.yaml +++ b/.github/workflows/new-release-branch.yaml @@ -17,7 +17,9 @@ jobs: steps: - uses: actions/setup-node@v3 - run: | - corepack enable npm + npm --version + # corepack enable npm + npm install -g $(jq -r '.packageManager' < package.json) npm --version - uses: actions/checkout@v3 with: diff --git a/.github/workflows/nightly.yaml b/.github/workflows/nightly.yaml index e365ad71fda49..25f0dc27df993 100644 --- a/.github/workflows/nightly.yaml +++ b/.github/workflows/nightly.yaml @@ -23,7 +23,9 @@ jobs: # Use NODE_AUTH_TOKEN environment variable to authenticate to this registry. registry-url: https://registry.npmjs.org/ - run: | - corepack enable npm + npm --version + # corepack enable npm + npm install -g $(jq -r '.packageManager' < package.json) npm --version - name: Setup and publish nightly run: | diff --git a/.github/workflows/release-branch-artifact.yaml b/.github/workflows/release-branch-artifact.yaml index 39c4426e27e9b..371074c0a02de 100644 --- a/.github/workflows/release-branch-artifact.yaml +++ b/.github/workflows/release-branch-artifact.yaml @@ -16,7 +16,9 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 - run: | - corepack enable npm + npm --version + # corepack enable npm + npm install -g $(jq -r '.packageManager' < package.json) npm --version - name: npm install and test run: | diff --git a/.github/workflows/set-version.yaml b/.github/workflows/set-version.yaml index 0fc9d58d16706..62142066f8000 100644 --- a/.github/workflows/set-version.yaml +++ b/.github/workflows/set-version.yaml @@ -20,7 +20,9 @@ jobs: with: ref: ${{ github.event.client_payload.branch_name }} - run: | - corepack enable npm + npm --version + # corepack enable npm + npm install -g $(jq -r '.packageManager' < package.json) npm --version # notably, this is essentially the same script as `new-release-branch.yaml` (with fewer inputs), but it assumes the branch already exists # do note that executing the transform below will prevent the `configurePrerelease` script from running on the source, as it makes the diff --git a/.github/workflows/update-package-lock.yaml b/.github/workflows/update-package-lock.yaml index 6bcba20a1ebfe..ce15f65d6819e 100644 --- a/.github/workflows/update-package-lock.yaml +++ b/.github/workflows/update-package-lock.yaml @@ -26,7 +26,9 @@ jobs: with: node-version: 16 - run: | - corepack enable npm + npm --version + # corepack enable npm + npm install -g $(jq -r '.packageManager' < package.json) npm --version - name: Update package-lock.json and push From 2faa176a2c1f4b7e794b3ae03a685c634a7496b1 Mon Sep 17 00:00:00 2001 From: TypeScript Bot Date: Mon, 26 Jun 2023 13:43:42 -0700 Subject: [PATCH 6/9] =?UTF-8?q?=F0=9F=A4=96=20Pick=20PR=20#54599=20(fix(dt?= =?UTF-8?q?s):=20`JsxSpreadAttribute`=20-=20re...)=20into=20release-5.1=20?= =?UTF-8?q?(#54720)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: David Sherret --- src/compiler/types.ts | 1 - tests/baselines/reference/api/tsserverlibrary.d.ts | 1 - tests/baselines/reference/api/typescript.d.ts | 1 - 3 files changed, 3 deletions(-) diff --git a/src/compiler/types.ts b/src/compiler/types.ts index b30bd455d5c3f..a3b71593c5bcc 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -3258,7 +3258,6 @@ export type JsxAttributeValue = export interface JsxSpreadAttribute extends ObjectLiteralElement { readonly kind: SyntaxKind.JsxSpreadAttribute; - readonly name: PropertyName; readonly parent: JsxAttributes; readonly expression: Expression; } diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index ca20adbcc9179..24685f553b407 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -5446,7 +5446,6 @@ declare namespace ts { type JsxAttributeValue = StringLiteral | JsxExpression | JsxElement | JsxSelfClosingElement | JsxFragment; interface JsxSpreadAttribute extends ObjectLiteralElement { readonly kind: SyntaxKind.JsxSpreadAttribute; - readonly name: PropertyName; readonly parent: JsxAttributes; readonly expression: Expression; } diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 0dae9f82541a3..ff7896ef2664f 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -1398,7 +1398,6 @@ declare namespace ts { type JsxAttributeValue = StringLiteral | JsxExpression | JsxElement | JsxSelfClosingElement | JsxFragment; interface JsxSpreadAttribute extends ObjectLiteralElement { readonly kind: SyntaxKind.JsxSpreadAttribute; - readonly name: PropertyName; readonly parent: JsxAttributes; readonly expression: Expression; } From db3575ab8a91ef5401f7b05bd00ec85db7f0d51d Mon Sep 17 00:00:00 2001 From: TypeScript Bot Date: Mon, 26 Jun 2023 16:24:54 -0700 Subject: [PATCH 7/9] =?UTF-8?q?=F0=9F=A4=96=20Pick=20PR=20#54588=20(Fixed?= =?UTF-8?q?=20a=20regression=20with=20string=20comp...)=20into=20release-5?= =?UTF-8?q?.1=20(#54635)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Mateusz BurzyƄski --- src/services/stringCompletions.ts | 2 +- ...letionsLiteralDirectlyInRestConstrainedToArrayType.ts | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 tests/cases/fourslash/completionsLiteralDirectlyInRestConstrainedToArrayType.ts diff --git a/src/services/stringCompletions.ts b/src/services/stringCompletions.ts index 61c23266701fa..e2250bee92f6f 100644 --- a/src/services/stringCompletions.ts +++ b/src/services/stringCompletions.ts @@ -387,7 +387,7 @@ function getStringLiteralCompletionEntries(sourceFile: SourceFile, node: StringL // Get string literal completions from specialized signatures of the target // i.e. declare function f(a: 'A'); // f("/*completion position*/") - return argumentInfo && getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) || fromContextualType(); + return argumentInfo && getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) || fromContextualType(ContextFlags.None); } // falls through (is `require("")` or `require(""` or `import("")`) diff --git a/tests/cases/fourslash/completionsLiteralDirectlyInRestConstrainedToArrayType.ts b/tests/cases/fourslash/completionsLiteralDirectlyInRestConstrainedToArrayType.ts new file mode 100644 index 0000000000000..620e4fda5f24d --- /dev/null +++ b/tests/cases/fourslash/completionsLiteralDirectlyInRestConstrainedToArrayType.ts @@ -0,0 +1,9 @@ +/// +// @strict: true +//// +//// function fn(...values: T): T { return values; } +//// +//// const value1 = fn('/*1*/'); +//// const value2 = fn('value1', '/*2*/'); + +verify.completions({ marker: ["1", "2"], includes: [`value1`, `value2`, `value3`] }) From f244192f674ce139ed095feb8db50256bced793e Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Mon, 26 Jun 2023 17:09:05 -0700 Subject: [PATCH 8/9] Pick 54781 to release 5.1 (#54792) --- src/compiler/checker.ts | 5 --- ...VarianceComparisonResultCorrect.errors.txt | 35 +++++++++++++++++++ ...ccessVarianceComparisonResultCorrect.types | 2 +- 3 files changed, 36 insertions(+), 6 deletions(-) create mode 100644 tests/baselines/reference/genericIndexedAccessVarianceComparisonResultCorrect.errors.txt diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 59e5c3e8aee45..9ea2abe9c2868 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -21459,11 +21459,6 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { // Relate components directly before falling back to constraint relationships // A type S[K] is related to a type T[J] if S is related to T and K is related to J. if (result = isRelatedTo((source as IndexedAccessType).objectType, (target as IndexedAccessType).objectType, RecursionFlags.Both, reportErrors)) { - // This does _not_ generalize - specific instantiations of `S[K]` and `T[J]` may be related, even if the indexed accesses generally are not. - // For example, `S = {x: string, a: string}`, `T = {x: string, b: string}`, `K = J = "x"`. `S` and `T` are unrelated, but the result of executing - // `S["x"]` and `T["x"]` _are_. Given that, we have to flag the object type comparison here as "unreliable", since while the generic result can reliably - // be used in the affirmative case, it failing is not an indicator that the structural result will not succeed. - instantiateType((source as IndexedAccessType).objectType, reportUnreliableMapper); result &= isRelatedTo((source as IndexedAccessType).indexType, (target as IndexedAccessType).indexType, RecursionFlags.Both, reportErrors); } if (result) { diff --git a/tests/baselines/reference/genericIndexedAccessVarianceComparisonResultCorrect.errors.txt b/tests/baselines/reference/genericIndexedAccessVarianceComparisonResultCorrect.errors.txt new file mode 100644 index 0000000000000..dace4eb923fe1 --- /dev/null +++ b/tests/baselines/reference/genericIndexedAccessVarianceComparisonResultCorrect.errors.txt @@ -0,0 +1,35 @@ +tests/cases/compiler/genericIndexedAccessVarianceComparisonResultCorrect.ts(25,1): error TS2322: Type 'T' is not assignable to type 'T'. + Property 'z' is missing in type 'A' but required in type 'B'. + + +==== tests/cases/compiler/genericIndexedAccessVarianceComparisonResultCorrect.ts (1 errors) ==== + class A { + x: string = 'A'; + y: number = 0; + } + + class B { + x: string = 'B'; + z: boolean = true; + } + + type T = Pick; + + type C = T; + type D = T; + + type C_extends_D = C extends D ? true : false; // true + type PickA_extends_PickB = Pick extends Pick ? true : false; // true + type TA_extends_TB = T extends T ? true : false; // should be true + + declare let a: T; + declare let b: T; + declare let c: C; + declare let d: D; + + b = a; // should be no error + ~ +!!! error TS2322: Type 'T' is not assignable to type 'T'. +!!! error TS2322: Property 'z' is missing in type 'A' but required in type 'B'. +!!! related TS2728 tests/cases/compiler/genericIndexedAccessVarianceComparisonResultCorrect.ts:8:5: 'z' is declared here. + c = d; \ No newline at end of file diff --git a/tests/baselines/reference/genericIndexedAccessVarianceComparisonResultCorrect.types b/tests/baselines/reference/genericIndexedAccessVarianceComparisonResultCorrect.types index e04f48ba89210..b22be4610f1ec 100644 --- a/tests/baselines/reference/genericIndexedAccessVarianceComparisonResultCorrect.types +++ b/tests/baselines/reference/genericIndexedAccessVarianceComparisonResultCorrect.types @@ -44,7 +44,7 @@ type PickA_extends_PickB = Pick extends Pick ? true : false; >false : false type TA_extends_TB = T extends T ? true : false; // should be true ->TA_extends_TB : true +>TA_extends_TB : false >true : true >false : false From e7f1caf7178c8421c6729e5bac22f7ae9cc6415c Mon Sep 17 00:00:00 2001 From: TypeScript Bot Date: Tue, 27 Jun 2023 00:21:03 +0000 Subject: [PATCH 9/9] Bump version to 5.1.5 and LKG --- lib/tsc.js | 3 +-- lib/tsserver.js | 14 +++++++------- lib/tsserverlibrary.d.ts | 1 - lib/tsserverlibrary.js | 14 +++++++------- lib/typescript.d.ts | 1 - lib/typescript.js | 14 +++++++------- lib/typingsInstaller.js | 2 +- package.json | 2 +- src/compiler/corePublic.ts | 2 +- 9 files changed, 25 insertions(+), 28 deletions(-) diff --git a/lib/tsc.js b/lib/tsc.js index f1380f4ecf2ec..f7e464aa28ed8 100644 --- a/lib/tsc.js +++ b/lib/tsc.js @@ -18,7 +18,7 @@ and limitations under the License. // src/compiler/corePublic.ts var versionMajorMinor = "5.1"; -var version = "5.1.4"; +var version = "5.1.5"; // src/compiler/core.ts var emptyArray = []; @@ -60584,7 +60584,6 @@ function createTypeChecker(host) { } else if (targetFlags & 8388608 /* IndexedAccess */) { if (sourceFlags & 8388608 /* IndexedAccess */) { if (result2 = isRelatedTo(source2.objectType, target2.objectType, 3 /* Both */, reportErrors2)) { - instantiateType(source2.objectType, reportUnreliableMapper); result2 &= isRelatedTo(source2.indexType, target2.indexType, 3 /* Both */, reportErrors2); } if (result2) { diff --git a/lib/tsserver.js b/lib/tsserver.js index 0d87a1c790788..8c682afa1d190 100644 --- a/lib/tsserver.js +++ b/lib/tsserver.js @@ -2304,7 +2304,7 @@ module.exports = __toCommonJS(server_exports); // src/compiler/corePublic.ts var versionMajorMinor = "5.1"; -var version = "5.1.4"; +var version = "5.1.5"; var Comparison = /* @__PURE__ */ ((Comparison3) => { Comparison3[Comparison3["LessThan"] = -1] = "LessThan"; Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo"; @@ -65235,7 +65235,6 @@ function createTypeChecker(host) { } else if (targetFlags & 8388608 /* IndexedAccess */) { if (sourceFlags & 8388608 /* IndexedAccess */) { if (result2 = isRelatedTo(source2.objectType, target2.objectType, 3 /* Both */, reportErrors2)) { - instantiateType(source2.objectType, reportUnreliableMapper); result2 &= isRelatedTo(source2.indexType, target2.indexType, 3 /* Both */, reportErrors2); } if (result2) { @@ -156314,7 +156313,7 @@ function getSourceFromOrigin(origin) { } function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, position, sourceFile, host, program, target, log, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importStatementCompletion, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag, includeSymbol = false) { const start2 = timestamp(); - const variableOrParameterDeclaration = getVariableOrParameterDeclaration(contextToken); + const variableOrParameterDeclaration = getVariableOrParameterDeclaration(contextToken, location); const useSemicolons = probablyUsesSemicolons(sourceFile); const typeChecker = program.getTypeChecker(); const uniques = /* @__PURE__ */ new Map(); @@ -158493,11 +158492,12 @@ function isModuleSpecifierMissingOrEmpty(specifier) { return true; return !((_a = tryCast(isExternalModuleReference(specifier) ? specifier.expression : specifier, isStringLiteralLike)) == null ? void 0 : _a.text); } -function getVariableOrParameterDeclaration(contextToken) { +function getVariableOrParameterDeclaration(contextToken, location) { if (!contextToken) return; - const declaration = findAncestor(contextToken, (node) => isFunctionBlock(node) || isArrowFunctionBody(node) || isBindingPattern(node) ? "quit" : isVariableDeclaration(node) || (isParameter(node) || isTypeParameterDeclaration(node)) && !isIndexSignatureDeclaration(node.parent)); - return declaration; + const possiblyParameterDeclaration = findAncestor(contextToken, (node) => isFunctionBlock(node) || isArrowFunctionBody(node) || isBindingPattern(node) ? "quit" : (isParameter(node) || isTypeParameterDeclaration(node)) && !isIndexSignatureDeclaration(node.parent)); + const possiblyVariableDeclaration = findAncestor(location, (node) => isFunctionBlock(node) || isArrowFunctionBody(node) || isBindingPattern(node) ? "quit" : isVariableDeclaration(node)); + return possiblyParameterDeclaration || possiblyVariableDeclaration; } function isArrowFunctionBody(node) { return node.parent && isArrowFunction(node.parent) && (node.parent.body === node || // const a = () => /**/; @@ -158739,7 +158739,7 @@ function getStringLiteralCompletionEntries(sourceFile, node, position, typeCheck case 290 /* JsxAttribute */: if (!isRequireCallArgument(node) && !isImportCall(parent2)) { const argumentInfo = ts_SignatureHelp_exports.getArgumentInfoForCompletions(parent2.kind === 290 /* JsxAttribute */ ? parent2.parent : node, position, sourceFile); - return argumentInfo && getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) || fromContextualType(); + return argumentInfo && getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) || fromContextualType(0 /* None */); } case 271 /* ImportDeclaration */: case 277 /* ExportDeclaration */: diff --git a/lib/tsserverlibrary.d.ts b/lib/tsserverlibrary.d.ts index ca20adbcc9179..24685f553b407 100644 --- a/lib/tsserverlibrary.d.ts +++ b/lib/tsserverlibrary.d.ts @@ -5446,7 +5446,6 @@ declare namespace ts { type JsxAttributeValue = StringLiteral | JsxExpression | JsxElement | JsxSelfClosingElement | JsxFragment; interface JsxSpreadAttribute extends ObjectLiteralElement { readonly kind: SyntaxKind.JsxSpreadAttribute; - readonly name: PropertyName; readonly parent: JsxAttributes; readonly expression: Expression; } diff --git a/lib/tsserverlibrary.js b/lib/tsserverlibrary.js index b20060ffedcec..574e237d7c67f 100644 --- a/lib/tsserverlibrary.js +++ b/lib/tsserverlibrary.js @@ -35,7 +35,7 @@ var ts = (() => { "src/compiler/corePublic.ts"() { "use strict"; versionMajorMinor = "5.1"; - version = "5.1.4"; + version = "5.1.5"; Comparison = /* @__PURE__ */ ((Comparison3) => { Comparison3[Comparison3["LessThan"] = -1] = "LessThan"; Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo"; @@ -63026,7 +63026,6 @@ ${lanes.join("\n")} } else if (targetFlags & 8388608 /* IndexedAccess */) { if (sourceFlags & 8388608 /* IndexedAccess */) { if (result2 = isRelatedTo(source2.objectType, target2.objectType, 3 /* Both */, reportErrors2)) { - instantiateType(source2.objectType, reportUnreliableMapper); result2 &= isRelatedTo(source2.indexType, target2.indexType, 3 /* Both */, reportErrors2); } if (result2) { @@ -155546,7 +155545,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, position, sourceFile, host, program, target, log, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importStatementCompletion, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag, includeSymbol = false) { const start = timestamp(); - const variableOrParameterDeclaration = getVariableOrParameterDeclaration(contextToken); + const variableOrParameterDeclaration = getVariableOrParameterDeclaration(contextToken, location); const useSemicolons = probablyUsesSemicolons(sourceFile); const typeChecker = program.getTypeChecker(); const uniques = /* @__PURE__ */ new Map(); @@ -157703,11 +157702,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return true; return !((_a = tryCast(isExternalModuleReference(specifier) ? specifier.expression : specifier, isStringLiteralLike)) == null ? void 0 : _a.text); } - function getVariableOrParameterDeclaration(contextToken) { + function getVariableOrParameterDeclaration(contextToken, location) { if (!contextToken) return; - const declaration = findAncestor(contextToken, (node) => isFunctionBlock(node) || isArrowFunctionBody(node) || isBindingPattern(node) ? "quit" : isVariableDeclaration(node) || (isParameter(node) || isTypeParameterDeclaration(node)) && !isIndexSignatureDeclaration(node.parent)); - return declaration; + const possiblyParameterDeclaration = findAncestor(contextToken, (node) => isFunctionBlock(node) || isArrowFunctionBody(node) || isBindingPattern(node) ? "quit" : (isParameter(node) || isTypeParameterDeclaration(node)) && !isIndexSignatureDeclaration(node.parent)); + const possiblyVariableDeclaration = findAncestor(location, (node) => isFunctionBlock(node) || isArrowFunctionBody(node) || isBindingPattern(node) ? "quit" : isVariableDeclaration(node)); + return possiblyParameterDeclaration || possiblyVariableDeclaration; } function isArrowFunctionBody(node) { return node.parent && isArrowFunction(node.parent) && (node.parent.body === node || // const a = () => /**/; @@ -158014,7 +158014,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} case 290 /* JsxAttribute */: if (!isRequireCallArgument(node) && !isImportCall(parent2)) { const argumentInfo = ts_SignatureHelp_exports.getArgumentInfoForCompletions(parent2.kind === 290 /* JsxAttribute */ ? parent2.parent : node, position, sourceFile); - return argumentInfo && getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) || fromContextualType(); + return argumentInfo && getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) || fromContextualType(0 /* None */); } case 271 /* ImportDeclaration */: case 277 /* ExportDeclaration */: diff --git a/lib/typescript.d.ts b/lib/typescript.d.ts index 0dae9f82541a3..ff7896ef2664f 100644 --- a/lib/typescript.d.ts +++ b/lib/typescript.d.ts @@ -1398,7 +1398,6 @@ declare namespace ts { type JsxAttributeValue = StringLiteral | JsxExpression | JsxElement | JsxSelfClosingElement | JsxFragment; interface JsxSpreadAttribute extends ObjectLiteralElement { readonly kind: SyntaxKind.JsxSpreadAttribute; - readonly name: PropertyName; readonly parent: JsxAttributes; readonly expression: Expression; } diff --git a/lib/typescript.js b/lib/typescript.js index d56076c2ee5b6..9a9266cacf127 100644 --- a/lib/typescript.js +++ b/lib/typescript.js @@ -35,7 +35,7 @@ var ts = (() => { "src/compiler/corePublic.ts"() { "use strict"; versionMajorMinor = "5.1"; - version = "5.1.4"; + version = "5.1.5"; Comparison = /* @__PURE__ */ ((Comparison3) => { Comparison3[Comparison3["LessThan"] = -1] = "LessThan"; Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo"; @@ -63026,7 +63026,6 @@ ${lanes.join("\n")} } else if (targetFlags & 8388608 /* IndexedAccess */) { if (sourceFlags & 8388608 /* IndexedAccess */) { if (result2 = isRelatedTo(source2.objectType, target2.objectType, 3 /* Both */, reportErrors2)) { - instantiateType(source2.objectType, reportUnreliableMapper); result2 &= isRelatedTo(source2.indexType, target2.indexType, 3 /* Both */, reportErrors2); } if (result2) { @@ -155561,7 +155560,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, position, sourceFile, host, program, target, log, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importStatementCompletion, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag, includeSymbol = false) { const start = timestamp(); - const variableOrParameterDeclaration = getVariableOrParameterDeclaration(contextToken); + const variableOrParameterDeclaration = getVariableOrParameterDeclaration(contextToken, location); const useSemicolons = probablyUsesSemicolons(sourceFile); const typeChecker = program.getTypeChecker(); const uniques = /* @__PURE__ */ new Map(); @@ -157718,11 +157717,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return true; return !((_a = tryCast(isExternalModuleReference(specifier) ? specifier.expression : specifier, isStringLiteralLike)) == null ? void 0 : _a.text); } - function getVariableOrParameterDeclaration(contextToken) { + function getVariableOrParameterDeclaration(contextToken, location) { if (!contextToken) return; - const declaration = findAncestor(contextToken, (node) => isFunctionBlock(node) || isArrowFunctionBody(node) || isBindingPattern(node) ? "quit" : isVariableDeclaration(node) || (isParameter(node) || isTypeParameterDeclaration(node)) && !isIndexSignatureDeclaration(node.parent)); - return declaration; + const possiblyParameterDeclaration = findAncestor(contextToken, (node) => isFunctionBlock(node) || isArrowFunctionBody(node) || isBindingPattern(node) ? "quit" : (isParameter(node) || isTypeParameterDeclaration(node)) && !isIndexSignatureDeclaration(node.parent)); + const possiblyVariableDeclaration = findAncestor(location, (node) => isFunctionBlock(node) || isArrowFunctionBody(node) || isBindingPattern(node) ? "quit" : isVariableDeclaration(node)); + return possiblyParameterDeclaration || possiblyVariableDeclaration; } function isArrowFunctionBody(node) { return node.parent && isArrowFunction(node.parent) && (node.parent.body === node || // const a = () => /**/; @@ -158029,7 +158029,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} case 290 /* JsxAttribute */: if (!isRequireCallArgument(node) && !isImportCall(parent2)) { const argumentInfo = ts_SignatureHelp_exports.getArgumentInfoForCompletions(parent2.kind === 290 /* JsxAttribute */ ? parent2.parent : node, position, sourceFile); - return argumentInfo && getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) || fromContextualType(); + return argumentInfo && getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) || fromContextualType(0 /* None */); } case 271 /* ImportDeclaration */: case 277 /* ExportDeclaration */: diff --git a/lib/typingsInstaller.js b/lib/typingsInstaller.js index d3cf1506449e9..a668ca7364c02 100644 --- a/lib/typingsInstaller.js +++ b/lib/typingsInstaller.js @@ -54,7 +54,7 @@ var path = __toESM(require("path")); // src/compiler/corePublic.ts var versionMajorMinor = "5.1"; -var version = "5.1.4"; +var version = "5.1.5"; // src/compiler/core.ts var emptyArray = []; diff --git a/package.json b/package.json index d364bedf7b6e1..164ad0ae67627 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "typescript", "author": "Microsoft Corp.", "homepage": "https://www.typescriptlang.org/", - "version": "5.1.4", + "version": "5.1.5", "license": "Apache-2.0", "description": "TypeScript is a language for application scale JavaScript development", "keywords": [ diff --git a/src/compiler/corePublic.ts b/src/compiler/corePublic.ts index 4e01d23815da8..934c20d2e2c5f 100644 --- a/src/compiler/corePublic.ts +++ b/src/compiler/corePublic.ts @@ -4,7 +4,7 @@ export const versionMajorMinor = "5.1"; // The following is baselined as a literal template type without intervention /** The version of the TypeScript compiler release */ // eslint-disable-next-line @typescript-eslint/no-inferrable-types -export const version = "5.1.4" as string; +export const version = "5.1.5" as string; /** * Type of objects whose values are all of the same type.