From 1f44dcf4e1d7db05fab64dea6949fe3c0e642d25 Mon Sep 17 00:00:00 2001 From: TypeScript Bot <23042052+typescript-bot@users.noreply.github.com> Date: Tue, 8 Oct 2024 11:51:35 -0700 Subject: [PATCH 1/4] =?UTF-8?q?=F0=9F=A4=96=20Pick=20PR=20#60157=20(fix=20?= =?UTF-8?q?automatic=20type=20acquisition)=20into=20release-5.6=20(#60169)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Austin Henrie <113467168+epistemancering@users.noreply.github.com> --- src/typingsInstaller/nodeTypingsInstaller.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/typingsInstaller/nodeTypingsInstaller.ts b/src/typingsInstaller/nodeTypingsInstaller.ts index e9fcfdfb5333d..d2a3efb9707df 100644 --- a/src/typingsInstaller/nodeTypingsInstaller.ts +++ b/src/typingsInstaller/nodeTypingsInstaller.ts @@ -1,4 +1,4 @@ -import { execFileSync } from "child_process"; +import { execSync } from "child_process"; import * as fs from "fs"; import * as path from "path"; @@ -172,7 +172,7 @@ export class NodeTypingsInstaller extends ts.server.typingsInstaller.TypingsInst this.log.writeLine(`Exec: ${command}`); } try { - const stdout = execFileSync(command, { ...options, encoding: "utf-8" }); + const stdout = execSync(command, { ...options, encoding: "utf-8" }); if (this.log.isEnabled()) { this.log.writeLine(` Succeeded. stdout:${indent(sys.newLine, stdout)}`); } From ff716921496ab538e74450d32443c899afbf4657 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Tue, 8 Oct 2024 13:55:32 -0700 Subject: [PATCH 2/4] [release-5.6] Remove tsbuildInfo specification error now that we need it for non incremental scenarios as well and there is no way to disable it (#59960) (#60002) --- src/compiler/diagnosticMessages.json | 4 ---- src/compiler/emitter.ts | 3 +-- src/compiler/program.ts | 8 +------- ...ldInfoFileWithoutIncrementalAndComposite.errors.txt | 7 ------- ...e-on-command-line-but-has-tsbuild-info-in-config.js | 10 +--------- 5 files changed, 3 insertions(+), 29 deletions(-) delete mode 100644 tests/baselines/reference/optionsTsBuildInfoFileWithoutIncrementalAndComposite.errors.txt diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 01cb974bc1242..b9291c6a2e027 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -4641,10 +4641,6 @@ "category": "Error", "code": 5110 }, - "Option 'tsBuildInfoFile' cannot be specified without specifying option 'incremental' or 'composite' or if not running 'tsc -b'.": { - "category": "Error", - "code": 5111 - }, "Generates a sourcemap for each corresponding '.d.ts' file.": { "category": "Message", diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index f79fdf2136407..771b1bee0adfd 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -499,8 +499,7 @@ export function getTsBuildInfoEmitOutputFilePath(options: CompilerOptions) { return buildInfoExtensionLess + Extension.TsBuildInfo; } -/** @internal */ -export function canEmitTsBuildInfo(options: CompilerOptions) { +function canEmitTsBuildInfo(options: CompilerOptions) { return isIncrementalCompilation(options) || !!options.tscBuild; } diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 06bb19f84d158..981e73503bde4 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -8,7 +8,6 @@ import { AsExpression, BuilderProgram, CancellationToken, - canEmitTsBuildInfo, canHaveDecorators, canHaveIllegalDecorators, chainDiagnosticMessages, @@ -4302,12 +4301,7 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg } const outputFile = options.outFile; - if (options.tsBuildInfoFile) { - if (!canEmitTsBuildInfo(options)) { - createDiagnosticForOptionName(Diagnostics.Option_tsBuildInfoFile_cannot_be_specified_without_specifying_option_incremental_or_composite_or_if_not_running_tsc_b, "tsBuildInfoFile"); - } - } - else if (options.incremental && !outputFile && !options.configFilePath) { + if (!options.tsBuildInfoFile && options.incremental && !outputFile && !options.configFilePath) { programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_incremental_can_only_be_specified_using_tsconfig_emitting_to_single_file_or_when_option_tsBuildInfoFile_is_specified)); } diff --git a/tests/baselines/reference/optionsTsBuildInfoFileWithoutIncrementalAndComposite.errors.txt b/tests/baselines/reference/optionsTsBuildInfoFileWithoutIncrementalAndComposite.errors.txt deleted file mode 100644 index b9e64cd960dc8..0000000000000 --- a/tests/baselines/reference/optionsTsBuildInfoFileWithoutIncrementalAndComposite.errors.txt +++ /dev/null @@ -1,7 +0,0 @@ -error TS5111: Option 'tsBuildInfoFile' cannot be specified without specifying option 'incremental' or 'composite' or if not running 'tsc -b'. - - -!!! error TS5111: Option 'tsBuildInfoFile' cannot be specified without specifying option 'incremental' or 'composite' or if not running 'tsc -b'. -==== optionsTsBuildInfoFileWithoutIncrementalAndComposite.ts (0 errors) ==== - const x = "Hello World"; - \ No newline at end of file diff --git a/tests/baselines/reference/tsc/composite/when-setting-composite-false-on-command-line-but-has-tsbuild-info-in-config.js b/tests/baselines/reference/tsc/composite/when-setting-composite-false-on-command-line-but-has-tsbuild-info-in-config.js index fdc3a6e6d6146..025b8a904bb24 100644 --- a/tests/baselines/reference/tsc/composite/when-setting-composite-false-on-command-line-but-has-tsbuild-info-in-config.js +++ b/tests/baselines/reference/tsc/composite/when-setting-composite-false-on-command-line-but-has-tsbuild-info-in-config.js @@ -35,15 +35,7 @@ export const x = 10; Output:: /lib/tsc --composite false --p src/project -src/project/tsconfig.json:6:9 - error TS5111: Option 'tsBuildInfoFile' cannot be specified without specifying option 'incremental' or 'composite' or if not running 'tsc -b'. - -6 "tsBuildInfoFile": "tsconfig.json.tsbuildinfo" -   ~~~~~~~~~~~~~~~~~ - - -Found 1 error in src/project/tsconfig.json:6 - -exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated +exitCode:: ExitStatus.Success //// [/src/project/src/main.js] From fefa70aa18df825b6b06e79ae3d5b54f17571128 Mon Sep 17 00:00:00 2001 From: TypeScript Bot <23042052+typescript-bot@users.noreply.github.com> Date: Tue, 8 Oct 2024 13:57:37 -0700 Subject: [PATCH 3/4] =?UTF-8?q?=F0=9F=A4=96=20Pick=20PR=20#60083=20(Don't?= =?UTF-8?q?=20issue=20implicit=20any=20when=20obtai...)=20into=20release-5?= =?UTF-8?q?.6=20(#60086)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Anders Hejlsberg --- src/compiler/checker.ts | 8 +- ...rameterDeclaration10(strict=false).symbols | 61 ++++++++ ...ParameterDeclaration10(strict=false).types | 99 +++++++++++++ ...arameterDeclaration10(strict=true).symbols | 61 ++++++++ ...gParameterDeclaration10(strict=true).types | 99 +++++++++++++ ...arameterDeclaration9(strict=false).symbols | 74 ++++++++++ ...gParameterDeclaration9(strict=false).types | 131 ++++++++++++++++++ ...ameterDeclaration9(strict=true).errors.txt | 49 +++++++ ...ParameterDeclaration9(strict=true).symbols | 71 ++++++++++ ...ngParameterDeclaration9(strict=true).types | 131 ++++++++++++++++++ .../destructuringParameterDeclaration10.ts | 30 ++++ .../destructuringParameterDeclaration9.ts | 51 +++++++ 12 files changed, 863 insertions(+), 2 deletions(-) create mode 100644 tests/baselines/reference/destructuringParameterDeclaration10(strict=false).symbols create mode 100644 tests/baselines/reference/destructuringParameterDeclaration10(strict=false).types create mode 100644 tests/baselines/reference/destructuringParameterDeclaration10(strict=true).symbols create mode 100644 tests/baselines/reference/destructuringParameterDeclaration10(strict=true).types create mode 100644 tests/baselines/reference/destructuringParameterDeclaration9(strict=false).symbols create mode 100644 tests/baselines/reference/destructuringParameterDeclaration9(strict=false).types create mode 100644 tests/baselines/reference/destructuringParameterDeclaration9(strict=true).errors.txt create mode 100644 tests/baselines/reference/destructuringParameterDeclaration9(strict=true).symbols create mode 100644 tests/baselines/reference/destructuringParameterDeclaration9(strict=true).types create mode 100644 tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration10.ts create mode 100644 tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration9.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index e3350d48bdf7a..860e8135b5d2c 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -11906,7 +11906,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { // contextual type or, if the element itself is a binding pattern, with the type implied by that binding // pattern. const contextualType = isBindingPattern(element.name) ? getTypeFromBindingPattern(element.name, /*includePatternInType*/ true, /*reportErrors*/ false) : unknownType; - return addOptionality(widenTypeInferredFromInitializer(element, checkDeclarationInitializer(element, CheckMode.Normal, contextualType))); + return addOptionality(getWidenedLiteralTypeForInitializer(element, checkDeclarationInitializer(element, CheckMode.Normal, contextualType))); } if (isBindingPattern(element.name)) { return getTypeFromBindingPattern(element.name, includePatternInType, reportErrors); @@ -40500,7 +40500,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } function widenTypeInferredFromInitializer(declaration: HasExpressionInitializer, type: Type) { - const widened = getCombinedNodeFlagsCached(declaration) & NodeFlags.Constant || isDeclarationReadonly(declaration) ? type : getWidenedLiteralType(type); + const widened = getWidenedLiteralTypeForInitializer(declaration, type); if (isInJSFile(declaration)) { if (isEmptyLiteralType(widened)) { reportImplicitAny(declaration, anyType); @@ -40514,6 +40514,10 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { return widened; } + function getWidenedLiteralTypeForInitializer(declaration: HasExpressionInitializer, type: Type) { + return getCombinedNodeFlagsCached(declaration) & NodeFlags.Constant || isDeclarationReadonly(declaration) ? type : getWidenedLiteralType(type); + } + function isLiteralOfContextualType(candidateType: Type, contextualType: Type | undefined): boolean { if (contextualType) { if (contextualType.flags & TypeFlags.UnionOrIntersection) { diff --git a/tests/baselines/reference/destructuringParameterDeclaration10(strict=false).symbols b/tests/baselines/reference/destructuringParameterDeclaration10(strict=false).symbols new file mode 100644 index 0000000000000..a0da095b3f6de --- /dev/null +++ b/tests/baselines/reference/destructuringParameterDeclaration10(strict=false).symbols @@ -0,0 +1,61 @@ +//// [tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration10.ts] //// + +=== destructuringParameterDeclaration10.ts === +export function prepareConfig({ +>prepareConfig : Symbol(prepareConfig, Decl(destructuringParameterDeclaration10.ts, 0, 0)) + + additionalFiles: { +>additionalFiles : Symbol(additionalFiles, Decl(destructuringParameterDeclaration10.ts, 4, 4)) + + json = [] +>json : Symbol(json, Decl(destructuringParameterDeclaration10.ts, 1, 22)) + + } = {} +}: { + additionalFiles?: Partial>; +>additionalFiles : Symbol(additionalFiles, Decl(destructuringParameterDeclaration10.ts, 4, 4)) +>Partial : Symbol(Partial, Decl(lib.es5.d.ts, --, --)) +>Record : Symbol(Record, Decl(lib.es5.d.ts, --, --)) + +} = {}) { + json // string[] +>json : Symbol(json, Decl(destructuringParameterDeclaration10.ts, 1, 22)) +} + +export function prepareConfigWithoutAnnotation({ +>prepareConfigWithoutAnnotation : Symbol(prepareConfigWithoutAnnotation, Decl(destructuringParameterDeclaration10.ts, 8, 1)) + + additionalFiles: { +>additionalFiles : Symbol(additionalFiles) + + json = [] +>json : Symbol(json, Decl(destructuringParameterDeclaration10.ts, 11, 22)) + + } = {} +} = {}) { + json +>json : Symbol(json, Decl(destructuringParameterDeclaration10.ts, 11, 22)) +} + +export const prepareConfigWithContextualSignature: (param:{ +>prepareConfigWithContextualSignature : Symbol(prepareConfigWithContextualSignature, Decl(destructuringParameterDeclaration10.ts, 18, 12)) +>param : Symbol(param, Decl(destructuringParameterDeclaration10.ts, 18, 52)) + + additionalFiles?: Partial>; +>additionalFiles : Symbol(additionalFiles, Decl(destructuringParameterDeclaration10.ts, 18, 59)) +>Partial : Symbol(Partial, Decl(lib.es5.d.ts, --, --)) +>Record : Symbol(Record, Decl(lib.es5.d.ts, --, --)) + +}) => void = ({ + additionalFiles: { +>additionalFiles : Symbol(additionalFiles, Decl(destructuringParameterDeclaration10.ts, 18, 59)) + + json = [] +>json : Symbol(json, Decl(destructuringParameterDeclaration10.ts, 21, 22)) + + } = {} +} = {}) => { + json // string[] +>json : Symbol(json, Decl(destructuringParameterDeclaration10.ts, 21, 22)) +} + diff --git a/tests/baselines/reference/destructuringParameterDeclaration10(strict=false).types b/tests/baselines/reference/destructuringParameterDeclaration10(strict=false).types new file mode 100644 index 0000000000000..721d45fc041df --- /dev/null +++ b/tests/baselines/reference/destructuringParameterDeclaration10(strict=false).types @@ -0,0 +1,99 @@ +//// [tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration10.ts] //// + +=== destructuringParameterDeclaration10.ts === +export function prepareConfig({ +>prepareConfig : ({ additionalFiles: { json } }?: { additionalFiles?: Partial>; }) => void +> : ^ ^^^ ^^^^^^^^^ + + additionalFiles: { +>additionalFiles : any +> : ^^^ + + json = [] +>json : string[] +> : ^^^^^^^^ +>[] : undefined[] +> : ^^^^^^^^^^^ + + } = {} +>{} : {} +> : ^^ + +}: { + additionalFiles?: Partial>; +>additionalFiles : Partial> +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +} = {}) { +>{} : {} +> : ^^ + + json // string[] +>json : string[] +> : ^^^^^^^^ +} + +export function prepareConfigWithoutAnnotation({ +>prepareConfigWithoutAnnotation : ({ additionalFiles: { json } }?: { additionalFiles?: { json?: any[]; }; }) => void +> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + additionalFiles: { +>additionalFiles : any +> : ^^^ + + json = [] +>json : any[] +> : ^^^^^ +>[] : undefined[] +> : ^^^^^^^^^^^ + + } = {} +>{} : {} +> : ^^ + +} = {}) { +>{} : {} +> : ^^ + + json +>json : any[] +> : ^^^^^ +} + +export const prepareConfigWithContextualSignature: (param:{ +>prepareConfigWithContextualSignature : (param: { additionalFiles?: Partial>; }) => void +> : ^ ^^ ^^^^^ +>param : { additionalFiles?: Partial>; } +> : ^^^^^^^^^^^^^^^^^^^^ ^^^ + + additionalFiles?: Partial>; +>additionalFiles : Partial> +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +}) => void = ({ +>({ additionalFiles: { json = [] } = {}} = {}) => { json // string[]} : ({ additionalFiles: { json } }?: { additionalFiles?: Partial>; }) => void +> : ^ ^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^ + + additionalFiles: { +>additionalFiles : any +> : ^^^ + + json = [] +>json : string[] +> : ^^^^^^^^ +>[] : undefined[] +> : ^^^^^^^^^^^ + + } = {} +>{} : {} +> : ^^ + +} = {}) => { +>{} : {} +> : ^^ + + json // string[] +>json : string[] +> : ^^^^^^^^ +} + diff --git a/tests/baselines/reference/destructuringParameterDeclaration10(strict=true).symbols b/tests/baselines/reference/destructuringParameterDeclaration10(strict=true).symbols new file mode 100644 index 0000000000000..a0da095b3f6de --- /dev/null +++ b/tests/baselines/reference/destructuringParameterDeclaration10(strict=true).symbols @@ -0,0 +1,61 @@ +//// [tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration10.ts] //// + +=== destructuringParameterDeclaration10.ts === +export function prepareConfig({ +>prepareConfig : Symbol(prepareConfig, Decl(destructuringParameterDeclaration10.ts, 0, 0)) + + additionalFiles: { +>additionalFiles : Symbol(additionalFiles, Decl(destructuringParameterDeclaration10.ts, 4, 4)) + + json = [] +>json : Symbol(json, Decl(destructuringParameterDeclaration10.ts, 1, 22)) + + } = {} +}: { + additionalFiles?: Partial>; +>additionalFiles : Symbol(additionalFiles, Decl(destructuringParameterDeclaration10.ts, 4, 4)) +>Partial : Symbol(Partial, Decl(lib.es5.d.ts, --, --)) +>Record : Symbol(Record, Decl(lib.es5.d.ts, --, --)) + +} = {}) { + json // string[] +>json : Symbol(json, Decl(destructuringParameterDeclaration10.ts, 1, 22)) +} + +export function prepareConfigWithoutAnnotation({ +>prepareConfigWithoutAnnotation : Symbol(prepareConfigWithoutAnnotation, Decl(destructuringParameterDeclaration10.ts, 8, 1)) + + additionalFiles: { +>additionalFiles : Symbol(additionalFiles) + + json = [] +>json : Symbol(json, Decl(destructuringParameterDeclaration10.ts, 11, 22)) + + } = {} +} = {}) { + json +>json : Symbol(json, Decl(destructuringParameterDeclaration10.ts, 11, 22)) +} + +export const prepareConfigWithContextualSignature: (param:{ +>prepareConfigWithContextualSignature : Symbol(prepareConfigWithContextualSignature, Decl(destructuringParameterDeclaration10.ts, 18, 12)) +>param : Symbol(param, Decl(destructuringParameterDeclaration10.ts, 18, 52)) + + additionalFiles?: Partial>; +>additionalFiles : Symbol(additionalFiles, Decl(destructuringParameterDeclaration10.ts, 18, 59)) +>Partial : Symbol(Partial, Decl(lib.es5.d.ts, --, --)) +>Record : Symbol(Record, Decl(lib.es5.d.ts, --, --)) + +}) => void = ({ + additionalFiles: { +>additionalFiles : Symbol(additionalFiles, Decl(destructuringParameterDeclaration10.ts, 18, 59)) + + json = [] +>json : Symbol(json, Decl(destructuringParameterDeclaration10.ts, 21, 22)) + + } = {} +} = {}) => { + json // string[] +>json : Symbol(json, Decl(destructuringParameterDeclaration10.ts, 21, 22)) +} + diff --git a/tests/baselines/reference/destructuringParameterDeclaration10(strict=true).types b/tests/baselines/reference/destructuringParameterDeclaration10(strict=true).types new file mode 100644 index 0000000000000..6eabd387b0b59 --- /dev/null +++ b/tests/baselines/reference/destructuringParameterDeclaration10(strict=true).types @@ -0,0 +1,99 @@ +//// [tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration10.ts] //// + +=== destructuringParameterDeclaration10.ts === +export function prepareConfig({ +>prepareConfig : ({ additionalFiles: { json } }?: { additionalFiles?: Partial>; }) => void +> : ^ ^^^ ^^^^^^^^^ + + additionalFiles: { +>additionalFiles : any +> : ^^^ + + json = [] +>json : string[] +> : ^^^^^^^^ +>[] : never[] +> : ^^^^^^^ + + } = {} +>{} : {} +> : ^^ + +}: { + additionalFiles?: Partial>; +>additionalFiles : Partial> | undefined +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +} = {}) { +>{} : {} +> : ^^ + + json // string[] +>json : string[] +> : ^^^^^^^^ +} + +export function prepareConfigWithoutAnnotation({ +>prepareConfigWithoutAnnotation : ({ additionalFiles: { json } }?: { additionalFiles?: { json?: never[] | undefined; } | undefined; }) => void +> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + additionalFiles: { +>additionalFiles : any +> : ^^^ + + json = [] +>json : never[] +> : ^^^^^^^ +>[] : never[] +> : ^^^^^^^ + + } = {} +>{} : {} +> : ^^ + +} = {}) { +>{} : {} +> : ^^ + + json +>json : never[] +> : ^^^^^^^ +} + +export const prepareConfigWithContextualSignature: (param:{ +>prepareConfigWithContextualSignature : (param: { additionalFiles?: Partial>; }) => void +> : ^ ^^ ^^^^^ +>param : { additionalFiles?: Partial>; } +> : ^^^^^^^^^^^^^^^^^^^^ ^^^ + + additionalFiles?: Partial>; +>additionalFiles : Partial> | undefined +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +}) => void = ({ +>({ additionalFiles: { json = [] } = {}} = {}) => { json // string[]} : ({ additionalFiles: { json } }?: { additionalFiles?: Partial>; }) => void +> : ^ ^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^ + + additionalFiles: { +>additionalFiles : any +> : ^^^ + + json = [] +>json : string[] +> : ^^^^^^^^ +>[] : never[] +> : ^^^^^^^ + + } = {} +>{} : {} +> : ^^ + +} = {}) => { +>{} : {} +> : ^^ + + json // string[] +>json : string[] +> : ^^^^^^^^ +} + diff --git a/tests/baselines/reference/destructuringParameterDeclaration9(strict=false).symbols b/tests/baselines/reference/destructuringParameterDeclaration9(strict=false).symbols new file mode 100644 index 0000000000000..da7a5cc68b4bb --- /dev/null +++ b/tests/baselines/reference/destructuringParameterDeclaration9(strict=false).symbols @@ -0,0 +1,74 @@ +//// [tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration9.ts] //// + +=== index.js === +/** + * @param {Object} [config] + * @param {Partial>} [config.additionalFiles] + */ +export function prepareConfig({ +>prepareConfig : Symbol(prepareConfig, Decl(index.js, 0, 0)) + + additionalFiles: { +>additionalFiles : Symbol(additionalFiles, Decl(index.js, 2, 3)) + + json = [] +>json : Symbol(json, Decl(index.js, 5, 22)) + + } = {} +} = {}) { + json // string[] +>json : Symbol(json, Decl(index.js, 5, 22)) +} + +export function prepareConfigWithoutAnnotation({ +>prepareConfigWithoutAnnotation : Symbol(prepareConfigWithoutAnnotation, Decl(index.js, 10, 1)) + + additionalFiles: { +>additionalFiles : Symbol(additionalFiles) + + json = [] +>json : Symbol(json, Decl(index.js, 13, 22)) + + } = {} +} = {}) { + json +>json : Symbol(json, Decl(index.js, 13, 22)) +} + +/** @type {(param: { + additionalFiles?: Partial>; +}) => void} */ +export const prepareConfigWithContextualSignature = ({ +>prepareConfigWithContextualSignature : Symbol(prepareConfigWithContextualSignature, Decl(index.js, 23, 12)) + + additionalFiles: { +>additionalFiles : Symbol(additionalFiles, Decl(index.js, 20, 20)) + + json = [] +>json : Symbol(json, Decl(index.js, 24, 22)) + + } = {} +} = {})=> { + json // string[] +>json : Symbol(json, Decl(index.js, 24, 22)) +} + +// Additional repros from https://github.com/microsoft/TypeScript/issues/59936 + +/** + * @param {{ a?: { json?: string[] }}} [config] + */ +function f1({ a: { json = [] } = {} } = {}) { return json } +>f1 : Symbol(f1, Decl(index.js, 29, 1)) +>a : Symbol(a, Decl(index.js, 34, 12)) +>json : Symbol(json, Decl(index.js, 36, 18)) +>json : Symbol(json, Decl(index.js, 36, 18)) + +/** + * @param {[[string[]?]?]} [x] + */ +function f2([[json = []] = []] = []) { return json } +>f2 : Symbol(f2, Decl(index.js, 36, 59)) +>json : Symbol(json, Decl(index.js, 41, 14)) +>json : Symbol(json, Decl(index.js, 41, 14)) + diff --git a/tests/baselines/reference/destructuringParameterDeclaration9(strict=false).types b/tests/baselines/reference/destructuringParameterDeclaration9(strict=false).types new file mode 100644 index 0000000000000..e827977063d76 --- /dev/null +++ b/tests/baselines/reference/destructuringParameterDeclaration9(strict=false).types @@ -0,0 +1,131 @@ +//// [tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration9.ts] //// + +=== index.js === +/** + * @param {Object} [config] + * @param {Partial>} [config.additionalFiles] + */ +export function prepareConfig({ +>prepareConfig : ({ additionalFiles: { json } }?: { additionalFiles?: Partial>;}) => void +> : ^ ^^^ ^^^ ^ ^^^^^^^^^ + + additionalFiles: { +>additionalFiles : any +> : ^^^ + + json = [] +>json : string[] +> : ^^^^^^^^ +>[] : undefined[] +> : ^^^^^^^^^^^ + + } = {} +>{} : {} +> : ^^ + +} = {}) { +>{} : {} +> : ^^ + + json // string[] +>json : string[] +> : ^^^^^^^^ +} + +export function prepareConfigWithoutAnnotation({ +>prepareConfigWithoutAnnotation : ({ additionalFiles: { json } }?: { additionalFiles?: { json?: any[]; }; }) => void +> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + additionalFiles: { +>additionalFiles : any +> : ^^^ + + json = [] +>json : any[] +> : ^^^^^ +>[] : undefined[] +> : ^^^^^^^^^^^ + + } = {} +>{} : {} +> : ^^ + +} = {}) { +>{} : {} +> : ^^ + + json +>json : any[] +> : ^^^^^ +} + +/** @type {(param: { + additionalFiles?: Partial>; +}) => void} */ +export const prepareConfigWithContextualSignature = ({ +>prepareConfigWithContextualSignature : (param: { additionalFiles?: Partial>; }) => void +> : ^ ^^ ^^^^^ +>({ additionalFiles: { json = [] } = {}} = {})=> { json // string[]} : ({ additionalFiles: { json } }?: { additionalFiles?: Partial>; }) => void +> : ^ ^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^ + + additionalFiles: { +>additionalFiles : any +> : ^^^ + + json = [] +>json : string[] +> : ^^^^^^^^ +>[] : undefined[] +> : ^^^^^^^^^^^ + + } = {} +>{} : {} +> : ^^ + +} = {})=> { +>{} : {} +> : ^^ + + json // string[] +>json : string[] +> : ^^^^^^^^ +} + +// Additional repros from https://github.com/microsoft/TypeScript/issues/59936 + +/** + * @param {{ a?: { json?: string[] }}} [config] + */ +function f1({ a: { json = [] } = {} } = {}) { return json } +>f1 : ({ a: { json } }?: { a?: { json?: string[]; }; }) => string[] +> : ^ ^^^ ^^^^^^^^^^^^^ +>a : any +> : ^^^ +>json : string[] +> : ^^^^^^^^ +>[] : undefined[] +> : ^^^^^^^^^^^ +>{} : {} +> : ^^ +>{} : {} +> : ^^ +>json : string[] +> : ^^^^^^^^ + +/** + * @param {[[string[]?]?]} [x] + */ +function f2([[json = []] = []] = []) { return json } +>f2 : ([[json]]?: [[string[]?]?]) => string[] +> : ^ ^^^ ^^^^^^^^^^^^^ +>json : string[] +> : ^^^^^^^^ +>[] : undefined[] +> : ^^^^^^^^^^^ +>[] : [] +> : ^^ +>[] : [] +> : ^^ +>json : string[] +> : ^^^^^^^^ + diff --git a/tests/baselines/reference/destructuringParameterDeclaration9(strict=true).errors.txt b/tests/baselines/reference/destructuringParameterDeclaration9(strict=true).errors.txt new file mode 100644 index 0000000000000..6f0315e55926d --- /dev/null +++ b/tests/baselines/reference/destructuringParameterDeclaration9(strict=true).errors.txt @@ -0,0 +1,49 @@ +index.js(15,9): error TS7031: Binding element 'json' implicitly has an 'any[]' type. + + +==== index.js (1 errors) ==== + /** + * @param {Object} [config] + * @param {Partial>} [config.additionalFiles] + */ + export function prepareConfig({ + additionalFiles: { + json = [] + } = {} + } = {}) { + json // string[] + } + + export function prepareConfigWithoutAnnotation({ + additionalFiles: { + json = [] + ~~~~ +!!! error TS7031: Binding element 'json' implicitly has an 'any[]' type. + } = {} + } = {}) { + json + } + + /** @type {(param: { + additionalFiles?: Partial>; + }) => void} */ + export const prepareConfigWithContextualSignature = ({ + additionalFiles: { + json = [] + } = {} + } = {})=> { + json // string[] + } + + // Additional repros from https://github.com/microsoft/TypeScript/issues/59936 + + /** + * @param {{ a?: { json?: string[] }}} [config] + */ + function f1({ a: { json = [] } = {} } = {}) { return json } + + /** + * @param {[[string[]?]?]} [x] + */ + function f2([[json = []] = []] = []) { return json } + \ No newline at end of file diff --git a/tests/baselines/reference/destructuringParameterDeclaration9(strict=true).symbols b/tests/baselines/reference/destructuringParameterDeclaration9(strict=true).symbols new file mode 100644 index 0000000000000..648e03984cab4 --- /dev/null +++ b/tests/baselines/reference/destructuringParameterDeclaration9(strict=true).symbols @@ -0,0 +1,71 @@ +//// [tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration9.ts] //// + +=== index.js === +/** + * @param {Object} [config] + * @param {Partial>} [config.additionalFiles] + */ +export function prepareConfig({ +>prepareConfig : Symbol(prepareConfig, Decl(index.js, 0, 0)) + + additionalFiles: { + json = [] +>json : Symbol(json, Decl(index.js, 5, 22)) + + } = {} +} = {}) { + json // string[] +>json : Symbol(json, Decl(index.js, 5, 22)) +} + +export function prepareConfigWithoutAnnotation({ +>prepareConfigWithoutAnnotation : Symbol(prepareConfigWithoutAnnotation, Decl(index.js, 10, 1)) + + additionalFiles: { +>additionalFiles : Symbol(additionalFiles) + + json = [] +>json : Symbol(json, Decl(index.js, 13, 22)) + + } = {} +} = {}) { + json +>json : Symbol(json, Decl(index.js, 13, 22)) +} + +/** @type {(param: { + additionalFiles?: Partial>; +}) => void} */ +export const prepareConfigWithContextualSignature = ({ +>prepareConfigWithContextualSignature : Symbol(prepareConfigWithContextualSignature, Decl(index.js, 23, 12)) + + additionalFiles: { +>additionalFiles : Symbol(additionalFiles, Decl(index.js, 20, 20)) + + json = [] +>json : Symbol(json, Decl(index.js, 24, 22)) + + } = {} +} = {})=> { + json // string[] +>json : Symbol(json, Decl(index.js, 24, 22)) +} + +// Additional repros from https://github.com/microsoft/TypeScript/issues/59936 + +/** + * @param {{ a?: { json?: string[] }}} [config] + */ +function f1({ a: { json = [] } = {} } = {}) { return json } +>f1 : Symbol(f1, Decl(index.js, 29, 1)) +>json : Symbol(json, Decl(index.js, 36, 18)) +>json : Symbol(json, Decl(index.js, 36, 18)) + +/** + * @param {[[string[]?]?]} [x] + */ +function f2([[json = []] = []] = []) { return json } +>f2 : Symbol(f2, Decl(index.js, 36, 59)) +>json : Symbol(json, Decl(index.js, 41, 14)) +>json : Symbol(json, Decl(index.js, 41, 14)) + diff --git a/tests/baselines/reference/destructuringParameterDeclaration9(strict=true).types b/tests/baselines/reference/destructuringParameterDeclaration9(strict=true).types new file mode 100644 index 0000000000000..8b6f457266be6 --- /dev/null +++ b/tests/baselines/reference/destructuringParameterDeclaration9(strict=true).types @@ -0,0 +1,131 @@ +//// [tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration9.ts] //// + +=== index.js === +/** + * @param {Object} [config] + * @param {Partial>} [config.additionalFiles] + */ +export function prepareConfig({ +>prepareConfig : ({ additionalFiles: { json } }?: { additionalFiles?: Partial> | undefined; } | undefined) => void +> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + additionalFiles: { +>additionalFiles : any +> : ^^^ + + json = [] +>json : string[] +> : ^^^^^^^^ +>[] : never[] +> : ^^^^^^^ + + } = {} +>{} : {} +> : ^^ + +} = {}) { +>{} : {} +> : ^^ + + json // string[] +>json : string[] +> : ^^^^^^^^ +} + +export function prepareConfigWithoutAnnotation({ +>prepareConfigWithoutAnnotation : ({ additionalFiles: { json } }?: { additionalFiles?: { json?: never[] | undefined; } | undefined; }) => void +> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + additionalFiles: { +>additionalFiles : any +> : ^^^ + + json = [] +>json : any[] +> : ^^^^^ +>[] : never[] +> : ^^^^^^^ + + } = {} +>{} : {} +> : ^^ + +} = {}) { +>{} : {} +> : ^^ + + json +>json : any[] +> : ^^^^^ +} + +/** @type {(param: { + additionalFiles?: Partial>; +}) => void} */ +export const prepareConfigWithContextualSignature = ({ +>prepareConfigWithContextualSignature : (param: { additionalFiles?: Partial>; }) => void +> : ^ ^^ ^^^^^ +>({ additionalFiles: { json = [] } = {}} = {})=> { json // string[]} : ({ additionalFiles: { json } }?: { additionalFiles?: Partial>; }) => void +> : ^ ^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^ + + additionalFiles: { +>additionalFiles : any +> : ^^^ + + json = [] +>json : string[] +> : ^^^^^^^^ +>[] : never[] +> : ^^^^^^^ + + } = {} +>{} : {} +> : ^^ + +} = {})=> { +>{} : {} +> : ^^ + + json // string[] +>json : string[] +> : ^^^^^^^^ +} + +// Additional repros from https://github.com/microsoft/TypeScript/issues/59936 + +/** + * @param {{ a?: { json?: string[] }}} [config] + */ +function f1({ a: { json = [] } = {} } = {}) { return json } +>f1 : ({ a: { json } }?: { a?: { json?: string[]; }; } | undefined) => string[] +> : ^ ^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>a : any +> : ^^^ +>json : string[] +> : ^^^^^^^^ +>[] : never[] +> : ^^^^^^^ +>{} : {} +> : ^^ +>{} : {} +> : ^^ +>json : string[] +> : ^^^^^^^^ + +/** + * @param {[[string[]?]?]} [x] + */ +function f2([[json = []] = []] = []) { return json } +>f2 : ([[json]]?: [([(string[] | undefined)?] | undefined)?] | undefined) => string[] +> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>json : string[] +> : ^^^^^^^^ +>[] : never[] +> : ^^^^^^^ +>[] : [] +> : ^^ +>[] : [] +> : ^^ +>json : string[] +> : ^^^^^^^^ + diff --git a/tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration10.ts b/tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration10.ts new file mode 100644 index 0000000000000..997341c7cb1a6 --- /dev/null +++ b/tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration10.ts @@ -0,0 +1,30 @@ +// @strict: true, false +// @noEmit: true + +export function prepareConfig({ + additionalFiles: { + json = [] + } = {} +}: { + additionalFiles?: Partial>; +} = {}) { + json // string[] +} + +export function prepareConfigWithoutAnnotation({ + additionalFiles: { + json = [] + } = {} +} = {}) { + json +} + +export const prepareConfigWithContextualSignature: (param:{ + additionalFiles?: Partial>; +}) => void = ({ + additionalFiles: { + json = [] + } = {} +} = {}) => { + json // string[] +} diff --git a/tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration9.ts b/tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration9.ts new file mode 100644 index 0000000000000..d033af2b0891e --- /dev/null +++ b/tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration9.ts @@ -0,0 +1,51 @@ +// @strict: true, false +// @noEmit: true +// @allowJs: true +// @checkJs: true + +// https://github.com/microsoft/TypeScript/issues/59936 + +// @filename: index.js + +/** + * @param {Object} [config] + * @param {Partial>} [config.additionalFiles] + */ +export function prepareConfig({ + additionalFiles: { + json = [] + } = {} +} = {}) { + json // string[] +} + +export function prepareConfigWithoutAnnotation({ + additionalFiles: { + json = [] + } = {} +} = {}) { + json +} + +/** @type {(param: { + additionalFiles?: Partial>; +}) => void} */ +export const prepareConfigWithContextualSignature = ({ + additionalFiles: { + json = [] + } = {} +} = {})=> { + json // string[] +} + +// Additional repros from https://github.com/microsoft/TypeScript/issues/59936 + +/** + * @param {{ a?: { json?: string[] }}} [config] + */ +function f1({ a: { json = [] } = {} } = {}) { return json } + +/** + * @param {[[string[]?]?]} [x] + */ +function f2([[json = []] = []] = []) { return json } From d48a5cf89a62a62d6c6ed53ffa18f070d9458b85 Mon Sep 17 00:00:00 2001 From: TypeScript Bot Date: Tue, 8 Oct 2024 21:20:15 +0000 Subject: [PATCH 4/4] Bump version to 5.6.3 and LKG --- lib/tsc.js | 16 +++++++--------- lib/typescript.js | 19 +++++++------------ lib/typingsInstaller.js | 2 +- package-lock.json | 4 ++-- package.json | 2 +- src/compiler/corePublic.ts | 2 +- 6 files changed, 19 insertions(+), 26 deletions(-) diff --git a/lib/tsc.js b/lib/tsc.js index 37e7f28602e63..3ea9087202585 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.6"; -var version = "5.6.2"; +var version = "5.6.3"; // src/compiler/core.ts var emptyArray = []; @@ -6885,7 +6885,6 @@ var Diagnostics = { Option_0_1_has_been_removed_Please_remove_it_from_your_configuration: diag(5108, 1 /* Error */, "Option_0_1_has_been_removed_Please_remove_it_from_your_configuration_5108", "Option '{0}={1}' has been removed. Please remove it from your configuration."), Option_moduleResolution_must_be_set_to_0_or_left_unspecified_when_option_module_is_set_to_1: diag(5109, 1 /* Error */, "Option_moduleResolution_must_be_set_to_0_or_left_unspecified_when_option_module_is_set_to_1_5109", "Option 'moduleResolution' must be set to '{0}' (or left unspecified) when option 'module' is set to '{1}'."), Option_module_must_be_set_to_0_when_option_moduleResolution_is_set_to_1: diag(5110, 1 /* Error */, "Option_module_must_be_set_to_0_when_option_moduleResolution_is_set_to_1_5110", "Option 'module' must be set to '{0}' when option 'moduleResolution' is set to '{1}'."), - Option_tsBuildInfoFile_cannot_be_specified_without_specifying_option_incremental_or_composite_or_if_not_running_tsc_b: diag(5111, 1 /* Error */, "Option_tsBuildInfoFile_cannot_be_specified_without_specifying_option_incremental_or_composite_or_if__5111", "Option 'tsBuildInfoFile' cannot be specified without specifying option 'incremental' or 'composite' or if not running 'tsc -b'."), Generates_a_sourcemap_for_each_corresponding_d_ts_file: diag(6e3, 3 /* Message */, "Generates_a_sourcemap_for_each_corresponding_d_ts_file_6000", "Generates a sourcemap for each corresponding '.d.ts' file."), Concatenate_and_emit_output_to_single_file: diag(6001, 3 /* Message */, "Concatenate_and_emit_output_to_single_file_6001", "Concatenate and emit output to single file."), Generates_corresponding_d_ts_file: diag(6002, 3 /* Message */, "Generates_corresponding_d_ts_file_6002", "Generates corresponding '.d.ts' file."), @@ -54960,7 +54959,7 @@ function createTypeChecker(host) { /*reportErrors*/ false ) : unknownType; - return addOptionality(widenTypeInferredFromInitializer(element, checkDeclarationInitializer(element, 0 /* Normal */, contextualType))); + return addOptionality(getWidenedLiteralTypeForInitializer(element, checkDeclarationInitializer(element, 0 /* Normal */, contextualType))); } if (isBindingPattern(element.name)) { return getTypeFromBindingPattern(element.name, includePatternInType, reportErrors2); @@ -78755,7 +78754,7 @@ function createTypeChecker(host) { return createTupleType(elementTypes, elementFlags, type.target.readonly); } function widenTypeInferredFromInitializer(declaration, type) { - const widened = getCombinedNodeFlagsCached(declaration) & 6 /* Constant */ || isDeclarationReadonly(declaration) ? type : getWidenedLiteralType(type); + const widened = getWidenedLiteralTypeForInitializer(declaration, type); if (isInJSFile(declaration)) { if (isEmptyLiteralType(widened)) { reportImplicitAny(declaration, anyType); @@ -78767,6 +78766,9 @@ function createTypeChecker(host) { } return widened; } + function getWidenedLiteralTypeForInitializer(declaration, type) { + return getCombinedNodeFlagsCached(declaration) & 6 /* Constant */ || isDeclarationReadonly(declaration) ? type : getWidenedLiteralType(type); + } function isLiteralOfContextualType(candidateType, contextualType) { if (contextualType) { if (contextualType.flags & 3145728 /* UnionOrIntersection */) { @@ -122129,11 +122131,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config } } const outputFile = options.outFile; - if (options.tsBuildInfoFile) { - if (!canEmitTsBuildInfo(options)) { - createDiagnosticForOptionName(Diagnostics.Option_tsBuildInfoFile_cannot_be_specified_without_specifying_option_incremental_or_composite_or_if_not_running_tsc_b, "tsBuildInfoFile"); - } - } else if (options.incremental && !outputFile && !options.configFilePath) { + if (!options.tsBuildInfoFile && options.incremental && !outputFile && !options.configFilePath) { programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_incremental_can_only_be_specified_using_tsconfig_emitting_to_single_file_or_when_option_tsBuildInfoFile_is_specified)); } verifyDeprecatedCompilerOptions(); diff --git a/lib/typescript.js b/lib/typescript.js index 90f3266ee69f2..0c2c66fb524e1 100644 --- a/lib/typescript.js +++ b/lib/typescript.js @@ -239,7 +239,6 @@ __export(typescript_exports, { buildOverload: () => buildOverload, bundlerModuleNameResolver: () => bundlerModuleNameResolver, canBeConvertedToAsync: () => canBeConvertedToAsync, - canEmitTsBuildInfo: () => canEmitTsBuildInfo, canHaveDecorators: () => canHaveDecorators, canHaveExportModifier: () => canHaveExportModifier, canHaveFlowNode: () => canHaveFlowNode, @@ -2263,7 +2262,7 @@ module.exports = __toCommonJS(typescript_exports); // src/compiler/corePublic.ts var versionMajorMinor = "5.6"; -var version = "5.6.2"; +var version = "5.6.3"; var Comparison = /* @__PURE__ */ ((Comparison3) => { Comparison3[Comparison3["LessThan"] = -1] = "LessThan"; Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo"; @@ -10283,7 +10282,6 @@ var Diagnostics = { Option_0_1_has_been_removed_Please_remove_it_from_your_configuration: diag(5108, 1 /* Error */, "Option_0_1_has_been_removed_Please_remove_it_from_your_configuration_5108", "Option '{0}={1}' has been removed. Please remove it from your configuration."), Option_moduleResolution_must_be_set_to_0_or_left_unspecified_when_option_module_is_set_to_1: diag(5109, 1 /* Error */, "Option_moduleResolution_must_be_set_to_0_or_left_unspecified_when_option_module_is_set_to_1_5109", "Option 'moduleResolution' must be set to '{0}' (or left unspecified) when option 'module' is set to '{1}'."), Option_module_must_be_set_to_0_when_option_moduleResolution_is_set_to_1: diag(5110, 1 /* Error */, "Option_module_must_be_set_to_0_when_option_moduleResolution_is_set_to_1_5110", "Option 'module' must be set to '{0}' when option 'moduleResolution' is set to '{1}'."), - Option_tsBuildInfoFile_cannot_be_specified_without_specifying_option_incremental_or_composite_or_if_not_running_tsc_b: diag(5111, 1 /* Error */, "Option_tsBuildInfoFile_cannot_be_specified_without_specifying_option_incremental_or_composite_or_if__5111", "Option 'tsBuildInfoFile' cannot be specified without specifying option 'incremental' or 'composite' or if not running 'tsc -b'."), Generates_a_sourcemap_for_each_corresponding_d_ts_file: diag(6e3, 3 /* Message */, "Generates_a_sourcemap_for_each_corresponding_d_ts_file_6000", "Generates a sourcemap for each corresponding '.d.ts' file."), Concatenate_and_emit_output_to_single_file: diag(6001, 3 /* Message */, "Concatenate_and_emit_output_to_single_file_6001", "Concatenate and emit output to single file."), Generates_corresponding_d_ts_file: diag(6002, 3 /* Message */, "Generates_corresponding_d_ts_file_6002", "Generates corresponding '.d.ts' file."), @@ -59580,7 +59578,7 @@ function createTypeChecker(host) { /*reportErrors*/ false ) : unknownType; - return addOptionality(widenTypeInferredFromInitializer(element, checkDeclarationInitializer(element, 0 /* Normal */, contextualType))); + return addOptionality(getWidenedLiteralTypeForInitializer(element, checkDeclarationInitializer(element, 0 /* Normal */, contextualType))); } if (isBindingPattern(element.name)) { return getTypeFromBindingPattern(element.name, includePatternInType, reportErrors2); @@ -83375,7 +83373,7 @@ function createTypeChecker(host) { return createTupleType(elementTypes, elementFlags, type.target.readonly); } function widenTypeInferredFromInitializer(declaration, type) { - const widened = getCombinedNodeFlagsCached(declaration) & 6 /* Constant */ || isDeclarationReadonly(declaration) ? type : getWidenedLiteralType(type); + const widened = getWidenedLiteralTypeForInitializer(declaration, type); if (isInJSFile(declaration)) { if (isEmptyLiteralType(widened)) { reportImplicitAny(declaration, anyType); @@ -83387,6 +83385,9 @@ function createTypeChecker(host) { } return widened; } + function getWidenedLiteralTypeForInitializer(declaration, type) { + return getCombinedNodeFlagsCached(declaration) & 6 /* Constant */ || isDeclarationReadonly(declaration) ? type : getWidenedLiteralType(type); + } function isLiteralOfContextualType(candidateType, contextualType) { if (contextualType) { if (contextualType.flags & 3145728 /* UnionOrIntersection */) { @@ -126988,11 +126989,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config } } const outputFile = options.outFile; - if (options.tsBuildInfoFile) { - if (!canEmitTsBuildInfo(options)) { - createDiagnosticForOptionName(Diagnostics.Option_tsBuildInfoFile_cannot_be_specified_without_specifying_option_incremental_or_composite_or_if_not_running_tsc_b, "tsBuildInfoFile"); - } - } else if (options.incremental && !outputFile && !options.configFilePath) { + if (!options.tsBuildInfoFile && options.incremental && !outputFile && !options.configFilePath) { programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_incremental_can_only_be_specified_using_tsconfig_emitting_to_single_file_or_when_option_tsBuildInfoFile_is_specified)); } verifyDeprecatedCompilerOptions(); @@ -179691,7 +179688,6 @@ __export(ts_exports2, { buildOverload: () => buildOverload, bundlerModuleNameResolver: () => bundlerModuleNameResolver, canBeConvertedToAsync: () => canBeConvertedToAsync, - canEmitTsBuildInfo: () => canEmitTsBuildInfo, canHaveDecorators: () => canHaveDecorators, canHaveExportModifier: () => canHaveExportModifier, canHaveFlowNode: () => canHaveFlowNode, @@ -194049,7 +194045,6 @@ if (typeof console !== "undefined") { buildOverload, bundlerModuleNameResolver, canBeConvertedToAsync, - canEmitTsBuildInfo, canHaveDecorators, canHaveExportModifier, canHaveFlowNode, diff --git a/lib/typingsInstaller.js b/lib/typingsInstaller.js index 64d72785f27d6..ea1a468627892 100644 --- a/lib/typingsInstaller.js +++ b/lib/typingsInstaller.js @@ -182,7 +182,7 @@ var NodeTypingsInstaller = class extends typescript_exports.server.typingsInstal this.log.writeLine(`Exec: ${command}`); } try { - const stdout = (0, import_child_process.execFileSync)(command, { ...options, encoding: "utf-8" }); + const stdout = (0, import_child_process.execSync)(command, { ...options, encoding: "utf-8" }); if (this.log.isEnabled()) { this.log.writeLine(` Succeeded. stdout:${indent(typescript_exports.sys.newLine, stdout)}`); } diff --git a/package-lock.json b/package-lock.json index a3c5548a4303e..254a95020023c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "typescript", - "version": "5.6.2", + "version": "5.6.3", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "typescript", - "version": "5.6.2", + "version": "5.6.3", "license": "Apache-2.0", "bin": { "tsc": "bin/tsc", diff --git a/package.json b/package.json index a72cb3ab769df..673cadfb05ed1 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "typescript", "author": "Microsoft Corp.", "homepage": "https://www.typescriptlang.org/", - "version": "5.6.2", + "version": "5.6.3", "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 2ab04085e8315..95072d8c397a7 100644 --- a/src/compiler/corePublic.ts +++ b/src/compiler/corePublic.ts @@ -3,7 +3,7 @@ export const versionMajorMinor = "5.6"; // The following is baselined as a literal template type without intervention /** The version of the TypeScript compiler release */ -export const version = "5.6.2" as string; +export const version = "5.6.3" as string; /** * Type of objects whose values are all of the same type. pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy