diff --git a/internal/tsoptions/parsinghelpers.go b/internal/tsoptions/parsinghelpers.go index 452883e37d..75662a7056 100644 --- a/internal/tsoptions/parsinghelpers.go +++ b/internal/tsoptions/parsinghelpers.go @@ -143,6 +143,8 @@ func ParseCompilerOptions(key string, value any, allOptions *core.CompilerOption switch key { case "allowJs": allOptions.AllowJs = parseTristate(value) + case "allowImportingTsExtensions": + allOptions.AllowImportingTsExtensions = parseTristate(value) case "allowSyntheticDefaultImports": allOptions.AllowSyntheticDefaultImports = parseTristate(value) case "allowNonTsExtensions": @@ -185,6 +187,10 @@ func ParseCompilerOptions(key string, value any, allOptions *core.CompilerOption allOptions.DeclarationMap = parseTristate(value) case "declaration": allOptions.Declaration = parseTristate(value) + case "downlevelIteration": + allOptions.DownlevelIteration = parseTristate(value) + case "emitDeclarationOnly": + allOptions.EmitDeclarationOnly = parseTristate(value) case "extendedDiagnostics": allOptions.ExtendedDiagnostics = parseTristate(value) case "emitDecoratorMetadata": @@ -261,6 +267,8 @@ func ParseCompilerOptions(key string, value any, allOptions *core.CompilerOption allOptions.NoFallthroughCasesInSwitch = parseTristate(value) case "noEmitForJsFiles": allOptions.NoEmitForJsFiles = parseTristate(value) + case "noErrorTruncation": + allOptions.NoErrorTruncation = parseTristate(value) case "noImplicitAny": allOptions.NoImplicitAny = parseTristate(value) case "noImplicitThis": @@ -311,6 +319,8 @@ func ParseCompilerOptions(key string, value any, allOptions *core.CompilerOption allOptions.ResolvePackageJsonImports = parseTristate(value) case "reactNamespace": allOptions.ReactNamespace = parseString(value) + case "rewriteRelativeImportExtensions": + allOptions.RewriteRelativeImportExtensions = parseTristate(value) case "rootDir": allOptions.RootDir = parseString(value) case "rootDirs": diff --git a/internal/tsoptions/parsinghelpers_test.go b/internal/tsoptions/parsinghelpers_test.go new file mode 100644 index 0000000000..8d356e7814 --- /dev/null +++ b/internal/tsoptions/parsinghelpers_test.go @@ -0,0 +1,41 @@ +package tsoptions + +import ( + "reflect" + "strings" + "testing" + + "github.com/microsoft/typescript-go/internal/core" +) + +func TestParseCompilerOptionNoMissingTristates(t *testing.T) { + t.Parallel() + + var missingKeys []string + for _, field := range reflect.VisibleFields(reflect.TypeFor[core.CompilerOptions]()) { + keyName := field.Name + // use the JSON key from the tag, if present + // e.g. `json:"dog[,anythingelse]"` --> dog + if jsonTag, ok := field.Tag.Lookup("json"); ok { + keyName = strings.SplitN(jsonTag, ",", 2)[0] + } + + isTristate := field.Type == reflect.TypeFor[core.Tristate]() + if isTristate { + // Set the field on a CompilerOptions to something other than the + // default (i.e. not TSUnknown), then check whether + // ParseCompilerOptions does actually update the value for that key. + testValue := core.TSTrue + co := core.CompilerOptions{} + ParseCompilerOptions(keyName, testValue, &co) + newSetValue := reflect.ValueOf(co).FieldByName(field.Name) + if !newSetValue.Equal(reflect.ValueOf(testValue)) { + missingKeys = append(missingKeys, keyName) + } + } + } + if len(missingKeys) > 0 { + t.Errorf("The following Tristate keys are missing entries in the ParseCompilerOptions"+ + " switch statement:\n%v", missingKeys) + } +} diff --git a/internal/tsoptions/tsconfigparsing_test.go b/internal/tsoptions/tsconfigparsing_test.go index 9eeeef505b..6e14e08110 100644 --- a/internal/tsoptions/tsconfigparsing_test.go +++ b/internal/tsoptions/tsconfigparsing_test.go @@ -741,6 +741,7 @@ func TestParseSrcCompiler(t *testing.T) { ConfigFilePath: tsconfigFileName, Declaration: core.TSTrue, DeclarationMap: core.TSTrue, + EmitDeclarationOnly: core.TSTrue, AlwaysStrict: core.TSTrue, Composite: core.TSTrue, IsolatedDeclarations: core.TSTrue, diff --git a/testdata/baselines/reference/submodule/compiler/classReferencedInContextualParameterWithinItsOwnBaseExpression.js b/testdata/baselines/reference/submodule/compiler/classReferencedInContextualParameterWithinItsOwnBaseExpression.js deleted file mode 100644 index 38db040579..0000000000 --- a/testdata/baselines/reference/submodule/compiler/classReferencedInContextualParameterWithinItsOwnBaseExpression.js +++ /dev/null @@ -1,51 +0,0 @@ -//// [tests/cases/compiler/classReferencedInContextualParameterWithinItsOwnBaseExpression.ts] //// - -//// [classReferencedInContextualParameterWithinItsOwnBaseExpression.ts] -interface Pretty { - (a: To): string; -} - -interface Schema { - readonly pretty?: Pretty; -} - -interface Class { - new (): A; -} - -declare const Class: ( - identifier: string, -) => ( - fields: Fields, - annotations?: Schema, -) => Class>; - -type Type = { - _TOutput: TOutput; -}; - -type OutputFrom = { - [K in keyof TFields]: "_TOutput" extends keyof TFields[K] - ? TFields[K]["_TOutput"] - : never; -}; - -declare function string(): Type; - -export class A extends Class("A")( - { a: string }, - { - pretty: (a) => JSON.stringify(a), - }, -) {} - - -//// [classReferencedInContextualParameterWithinItsOwnBaseExpression.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.A = void 0; -class A extends Class("A")({ a: string }, { - pretty: (a) => JSON.stringify(a), -}) { -} -exports.A = A; diff --git a/testdata/baselines/reference/submodule/compiler/classReferencedInContextualParameterWithinItsOwnBaseExpression.js.diff b/testdata/baselines/reference/submodule/compiler/classReferencedInContextualParameterWithinItsOwnBaseExpression.js.diff index fd7f231f90..da9865f66d 100644 --- a/testdata/baselines/reference/submodule/compiler/classReferencedInContextualParameterWithinItsOwnBaseExpression.js.diff +++ b/testdata/baselines/reference/submodule/compiler/classReferencedInContextualParameterWithinItsOwnBaseExpression.js.diff @@ -1,22 +1,54 @@ --- old.classReferencedInContextualParameterWithinItsOwnBaseExpression.js +++ new.classReferencedInContextualParameterWithinItsOwnBaseExpression.js -@@= skipped -39, +39 lines =@@ - ) {} - - +@@= skipped -0, +-1 lines =@@ +-//// [tests/cases/compiler/classReferencedInContextualParameterWithinItsOwnBaseExpression.ts] //// +- +-//// [classReferencedInContextualParameterWithinItsOwnBaseExpression.ts] +-interface Pretty { +- (a: To): string; +-} +- +-interface Schema { +- readonly pretty?: Pretty; +-} +- +-interface Class { +- new (): A; +-} +- +-declare const Class: ( +- identifier: string, +-) => ( +- fields: Fields, +- annotations?: Schema, +-) => Class>; +- +-type Type = { +- _TOutput: TOutput; +-}; +- +-type OutputFrom = { +- [K in keyof TFields]: "_TOutput" extends keyof TFields[K] +- ? TFields[K]["_TOutput"] +- : never; +-}; +- +-declare function string(): Type; +- +-export class A extends Class("A")( +- { a: string }, +- { +- pretty: (a) => JSON.stringify(a), +- }, +-) {} +- +- - - -//// [classReferencedInContextualParameterWithinItsOwnBaseExpression.d.ts] -interface Pretty { - (a: To): string; -+//// [classReferencedInContextualParameterWithinItsOwnBaseExpression.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.A = void 0; -+class A extends Class("A")({ a: string }, { -+ pretty: (a) => JSON.stringify(a), -+}) { - } +-} -interface Schema { - readonly pretty?: Pretty; -} @@ -37,4 +69,5 @@ -export declare class A extends A_base { -} -export {}; -+exports.A = A; +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/compiler/declFileEmitDeclarationOnly.js b/testdata/baselines/reference/submodule/compiler/declFileEmitDeclarationOnly.js deleted file mode 100644 index 28279eb285..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declFileEmitDeclarationOnly.js +++ /dev/null @@ -1,30 +0,0 @@ -//// [tests/cases/compiler/declFileEmitDeclarationOnly.ts] //// - -//// [helloworld.ts] -const Log = { - info(msg: string) {} -} - -class HelloWorld { - constructor(private name: string) { - } - - public hello() { - Log.info(`Hello ${this.name}`); - } -} - - -//// [helloworld.js] -const Log = { - info(msg) { } -}; -class HelloWorld { - name; - constructor(name) { - this.name = name; - } - hello() { - Log.info(`Hello ${this.name}`); - } -} diff --git a/testdata/baselines/reference/submodule/compiler/declFileEmitDeclarationOnly.js.diff b/testdata/baselines/reference/submodule/compiler/declFileEmitDeclarationOnly.js.diff index 7bc8a87e61..50576292c3 100644 --- a/testdata/baselines/reference/submodule/compiler/declFileEmitDeclarationOnly.js.diff +++ b/testdata/baselines/reference/submodule/compiler/declFileEmitDeclarationOnly.js.diff @@ -1,28 +1,33 @@ --- old.declFileEmitDeclarationOnly.js +++ new.declFileEmitDeclarationOnly.js -@@= skipped -14, +14 lines =@@ - } - - +@@= skipped -0, +-1 lines =@@ +-//// [tests/cases/compiler/declFileEmitDeclarationOnly.ts] //// +- +-//// [helloworld.ts] +-const Log = { +- info(msg: string) {} +-} +- +-class HelloWorld { +- constructor(private name: string) { +- } +- +- public hello() { +- Log.info(`Hello ${this.name}`); +- } +-} +- +- - - -//// [helloworld.d.ts] -declare const Log: { - info(msg: string): void; -+//// [helloworld.js] -+const Log = { -+ info(msg) { } - }; +-}; -declare class HelloWorld { - private name; - constructor(name: string); - hello(): void; -+class HelloWorld { -+ name; -+ constructor(name) { -+ this.name = name; -+ } -+ hello() { -+ Log.info(`Hello ${this.name}`); -+ } - } +-} +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/compiler/declFileEmitDeclarationOnlyError1.js b/testdata/baselines/reference/submodule/compiler/declFileEmitDeclarationOnlyError1.js deleted file mode 100644 index c6a6debeeb..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declFileEmitDeclarationOnlyError1.js +++ /dev/null @@ -1,8 +0,0 @@ -//// [tests/cases/compiler/declFileEmitDeclarationOnlyError1.ts] //// - -//// [hello.ts] -var hello = "yo!"; - - -//// [hello.js] -var hello = "yo!"; diff --git a/testdata/baselines/reference/submodule/compiler/declFileEmitDeclarationOnlyError1.js.diff b/testdata/baselines/reference/submodule/compiler/declFileEmitDeclarationOnlyError1.js.diff deleted file mode 100644 index ff8e6ce11c..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declFileEmitDeclarationOnlyError1.js.diff +++ /dev/null @@ -1,13 +0,0 @@ ---- old.declFileEmitDeclarationOnlyError1.js -+++ new.declFileEmitDeclarationOnlyError1.js -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+//// [tests/cases/compiler/declFileEmitDeclarationOnlyError1.ts] //// -+ -+//// [hello.ts] -+var hello = "yo!"; -+ -+ -+//// [hello.js] -+var hello = "yo!"; diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitBundlerConditions.js b/testdata/baselines/reference/submodule/compiler/declarationEmitBundlerConditions.js deleted file mode 100644 index 4731d8f0f1..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitBundlerConditions.js +++ /dev/null @@ -1,41 +0,0 @@ -//// [tests/cases/compiler/declarationEmitBundlerConditions.ts] //// - -//// [package.json] -{ - "name": "pkg", - "type": "module", - "exports": { - ".": { - "import": "./index.js", - "require": "./index.cjs" - } - } -} - -//// [index.d.ts] -export declare class C { - private p; -} - -//// [index.d.cts] -export {}; - -//// [makeC.ts] -import { C } from "pkg"; -export function makeC() { - return new C(); -} - -//// [index.ts] -import { makeC } from "./makeC"; -export const c = makeC(); - - -//// [makeC.js] -import { C } from "pkg"; -export function makeC() { - return new C(); -} -//// [index.js] -import { makeC } from "./makeC"; -export const c = makeC(); diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitBundlerConditions.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitBundlerConditions.js.diff index d54582bc76..016d549494 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitBundlerConditions.js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitBundlerConditions.js.diff @@ -1,20 +1,45 @@ --- old.declarationEmitBundlerConditions.js +++ new.declarationEmitBundlerConditions.js -@@= skipped -30, +30 lines =@@ - export const c = makeC(); - - +@@= skipped -0, +-1 lines =@@ +-//// [tests/cases/compiler/declarationEmitBundlerConditions.ts] //// +- +-//// [package.json] +-{ +- "name": "pkg", +- "type": "module", +- "exports": { +- ".": { +- "import": "./index.js", +- "require": "./index.cjs" +- } +- } +-} +- +-//// [index.d.ts] +-export declare class C { +- private p; +-} +- +-//// [index.d.cts] +-export {}; +- +-//// [makeC.ts] +-import { C } from "pkg"; +-export function makeC() { +- return new C(); +-} +- +-//// [index.ts] +-import { makeC } from "./makeC"; +-export const c = makeC(); +- +- - - -//// [makeC.d.ts] -+//// [makeC.js] - import { C } from "pkg"; +-import { C } from "pkg"; -export declare function makeC(): C; -//// [index.d.ts] -export declare const c: import("pkg").C; -+export function makeC() { -+ return new C(); -+} -+//// [index.js] -+import { makeC } from "./makeC"; -+export const c = makeC(); +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode1(strictnullchecks=false).js b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode1(strictnullchecks=false).js deleted file mode 100644 index dd5cec9b6e..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode1(strictnullchecks=false).js +++ /dev/null @@ -1,58 +0,0 @@ -//// [tests/cases/compiler/declarationEmitCastReusesTypeNode1.ts] //// - -//// [declarationEmitCastReusesTypeNode1.ts] -type P = { } & { name: string } - -export let vLet = null! as P -export const vConst = null! as P - -export function fn(p = null! as P) {} - -export function fnWithRequiredDefaultParam(p = null! as P, req: number) {} - -export class C { - field = null! as P; - optField? = null! as P; - readonly roFiled = null! as P; - method(p = null! as P) {} - methodWithRequiredDefault(p = null! as P, req: number) {} - - constructor(public ctorField = null! as P) {} - - get x() { return null! as P } - set x(v) { } -} - -export default null! as P; - -// allows `undefined` on the input side, thanks to the initializer -export function fnWithPartialAnnotationOnDefaultparam(x: P = null! as P, b: number) {} - -//// [declarationEmitCastReusesTypeNode1.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.C = exports.vConst = exports.vLet = void 0; -exports.fn = fn; -exports.fnWithRequiredDefaultParam = fnWithRequiredDefaultParam; -exports.fnWithPartialAnnotationOnDefaultparam = fnWithPartialAnnotationOnDefaultparam; -exports.vLet = null; -exports.vConst = null; -function fn(p = null) { } -function fnWithRequiredDefaultParam(p = null, req) { } -class C { - ctorField; - field = null; - optField = null; - roFiled = null; - method(p = null) { } - methodWithRequiredDefault(p = null, req) { } - constructor(ctorField = null) { - this.ctorField = ctorField; - } - get x() { return null; } - set x(v) { } -} -exports.C = C; -exports.default = null; -// allows `undefined` on the input side, thanks to the initializer -function fnWithPartialAnnotationOnDefaultparam(x = null, b) { } diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode1(strictnullchecks=false).js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode1(strictnullchecks=false).js.diff index 956a192595..44ba87390e 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode1(strictnullchecks=false).js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode1(strictnullchecks=false).js.diff @@ -1,9 +1,36 @@ --- old.declarationEmitCastReusesTypeNode1(strictnullchecks=false).js +++ new.declarationEmitCastReusesTypeNode1(strictnullchecks=false).js -@@= skipped -27, +27 lines =@@ - // allows `undefined` on the input side, thanks to the initializer - export function fnWithPartialAnnotationOnDefaultparam(x: P = null! as P, b: number) {} - +@@= skipped -0, +-1 lines =@@ +-//// [tests/cases/compiler/declarationEmitCastReusesTypeNode1.ts] //// +- +-//// [declarationEmitCastReusesTypeNode1.ts] +-type P = { } & { name: string } +- +-export let vLet = null! as P +-export const vConst = null! as P +- +-export function fn(p = null! as P) {} +- +-export function fnWithRequiredDefaultParam(p = null! as P, req: number) {} +- +-export class C { +- field = null! as P; +- optField? = null! as P; +- readonly roFiled = null! as P; +- method(p = null! as P) {} +- methodWithRequiredDefault(p = null! as P, req: number) {} +- +- constructor(public ctorField = null! as P) {} +- +- get x() { return null! as P } +- set x(v) { } +-} +- +-export default null! as P; +- +-// allows `undefined` on the input side, thanks to the initializer +-export function fnWithPartialAnnotationOnDefaultparam(x: P = null! as P, b: number) {} +- - - -//// [declarationEmitCastReusesTypeNode1.d.ts] @@ -24,34 +51,9 @@ - constructor(ctorField?: P); - get x(): P; - set x(v: P); -+//// [declarationEmitCastReusesTypeNode1.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.C = exports.vConst = exports.vLet = void 0; -+exports.fn = fn; -+exports.fnWithRequiredDefaultParam = fnWithRequiredDefaultParam; -+exports.fnWithPartialAnnotationOnDefaultparam = fnWithPartialAnnotationOnDefaultparam; -+exports.vLet = null; -+exports.vConst = null; -+function fn(p = null) { } -+function fnWithRequiredDefaultParam(p = null, req) { } -+class C { -+ ctorField; -+ field = null; -+ optField = null; -+ roFiled = null; -+ method(p = null) { } -+ methodWithRequiredDefault(p = null, req) { } -+ constructor(ctorField = null) { -+ this.ctorField = ctorField; -+ } -+ get x() { return null; } -+ set x(v) { } - } +-} -declare const _default: P; -export default _default; -export declare function fnWithPartialAnnotationOnDefaultparam(x: P, b: number): void; -+exports.C = C; -+exports.default = null; -+// allows `undefined` on the input side, thanks to the initializer -+function fnWithPartialAnnotationOnDefaultparam(x = null, b) { } +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode1(strictnullchecks=true).js b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode1(strictnullchecks=true).js deleted file mode 100644 index dd5cec9b6e..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode1(strictnullchecks=true).js +++ /dev/null @@ -1,58 +0,0 @@ -//// [tests/cases/compiler/declarationEmitCastReusesTypeNode1.ts] //// - -//// [declarationEmitCastReusesTypeNode1.ts] -type P = { } & { name: string } - -export let vLet = null! as P -export const vConst = null! as P - -export function fn(p = null! as P) {} - -export function fnWithRequiredDefaultParam(p = null! as P, req: number) {} - -export class C { - field = null! as P; - optField? = null! as P; - readonly roFiled = null! as P; - method(p = null! as P) {} - methodWithRequiredDefault(p = null! as P, req: number) {} - - constructor(public ctorField = null! as P) {} - - get x() { return null! as P } - set x(v) { } -} - -export default null! as P; - -// allows `undefined` on the input side, thanks to the initializer -export function fnWithPartialAnnotationOnDefaultparam(x: P = null! as P, b: number) {} - -//// [declarationEmitCastReusesTypeNode1.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.C = exports.vConst = exports.vLet = void 0; -exports.fn = fn; -exports.fnWithRequiredDefaultParam = fnWithRequiredDefaultParam; -exports.fnWithPartialAnnotationOnDefaultparam = fnWithPartialAnnotationOnDefaultparam; -exports.vLet = null; -exports.vConst = null; -function fn(p = null) { } -function fnWithRequiredDefaultParam(p = null, req) { } -class C { - ctorField; - field = null; - optField = null; - roFiled = null; - method(p = null) { } - methodWithRequiredDefault(p = null, req) { } - constructor(ctorField = null) { - this.ctorField = ctorField; - } - get x() { return null; } - set x(v) { } -} -exports.C = C; -exports.default = null; -// allows `undefined` on the input side, thanks to the initializer -function fnWithPartialAnnotationOnDefaultparam(x = null, b) { } diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode1(strictnullchecks=true).js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode1(strictnullchecks=true).js.diff index e0be668369..58aaa74649 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode1(strictnullchecks=true).js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode1(strictnullchecks=true).js.diff @@ -1,9 +1,36 @@ --- old.declarationEmitCastReusesTypeNode1(strictnullchecks=true).js +++ new.declarationEmitCastReusesTypeNode1(strictnullchecks=true).js -@@= skipped -27, +27 lines =@@ - // allows `undefined` on the input side, thanks to the initializer - export function fnWithPartialAnnotationOnDefaultparam(x: P = null! as P, b: number) {} - +@@= skipped -0, +-1 lines =@@ +-//// [tests/cases/compiler/declarationEmitCastReusesTypeNode1.ts] //// +- +-//// [declarationEmitCastReusesTypeNode1.ts] +-type P = { } & { name: string } +- +-export let vLet = null! as P +-export const vConst = null! as P +- +-export function fn(p = null! as P) {} +- +-export function fnWithRequiredDefaultParam(p = null! as P, req: number) {} +- +-export class C { +- field = null! as P; +- optField? = null! as P; +- readonly roFiled = null! as P; +- method(p = null! as P) {} +- methodWithRequiredDefault(p = null! as P, req: number) {} +- +- constructor(public ctorField = null! as P) {} +- +- get x() { return null! as P } +- set x(v) { } +-} +- +-export default null! as P; +- +-// allows `undefined` on the input side, thanks to the initializer +-export function fnWithPartialAnnotationOnDefaultparam(x: P = null! as P, b: number) {} +- - - -//// [declarationEmitCastReusesTypeNode1.d.ts] @@ -24,34 +51,9 @@ - constructor(ctorField?: P); - get x(): P; - set x(v: P); -+//// [declarationEmitCastReusesTypeNode1.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.C = exports.vConst = exports.vLet = void 0; -+exports.fn = fn; -+exports.fnWithRequiredDefaultParam = fnWithRequiredDefaultParam; -+exports.fnWithPartialAnnotationOnDefaultparam = fnWithPartialAnnotationOnDefaultparam; -+exports.vLet = null; -+exports.vConst = null; -+function fn(p = null) { } -+function fnWithRequiredDefaultParam(p = null, req) { } -+class C { -+ ctorField; -+ field = null; -+ optField = null; -+ roFiled = null; -+ method(p = null) { } -+ methodWithRequiredDefault(p = null, req) { } -+ constructor(ctorField = null) { -+ this.ctorField = ctorField; -+ } -+ get x() { return null; } -+ set x(v) { } - } +-} -declare const _default: P; -export default _default; -export declare function fnWithPartialAnnotationOnDefaultparam(x: P | undefined, b: number): void; -+exports.C = C; -+exports.default = null; -+// allows `undefined` on the input side, thanks to the initializer -+function fnWithPartialAnnotationOnDefaultparam(x = null, b) { } +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode2(strictnullchecks=false).js b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode2(strictnullchecks=false).js deleted file mode 100644 index 93b0d5c3b3..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode2(strictnullchecks=false).js +++ /dev/null @@ -1,56 +0,0 @@ -//// [tests/cases/compiler/declarationEmitCastReusesTypeNode2.ts] //// - -//// [declarationEmitCastReusesTypeNode2.ts] -export let vLet = null! as {} & { name: string } -export const vConst = null! as {} & { name: string } - -export function fn(p = null! as {} & { name: string }) {} - -export function fnWithRequiredDefaultParam(p = null! as {} & { name: string }, req: number) {} - -export class C { - field = null! as {} & { name: string }; - optField? = null! as {} & { name: string }; - readonly roFiled = null! as {} & { name: string }; - method(p = null! as {} & { name: string }) {} - methodWithRequiredDefault(p = null! as {} & { name: string }, req: number) {} - - constructor(public ctorField = null! as {} & { name: string }) {} - - get x() { return null! as {} & { name: string } } - set x(v) { } -} - -export default null! as {} & { name: string } - -// allows `undefined` on the input side, thanks to the initializer -export function fnWithPartialAnnotationOnDefaultparam(x: {} & { name: string } = null! as {} & { name: string }, b: number) {} - -//// [declarationEmitCastReusesTypeNode2.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.C = exports.vConst = exports.vLet = void 0; -exports.fn = fn; -exports.fnWithRequiredDefaultParam = fnWithRequiredDefaultParam; -exports.fnWithPartialAnnotationOnDefaultparam = fnWithPartialAnnotationOnDefaultparam; -exports.vLet = null; -exports.vConst = null; -function fn(p = null) { } -function fnWithRequiredDefaultParam(p = null, req) { } -class C { - ctorField; - field = null; - optField = null; - roFiled = null; - method(p = null) { } - methodWithRequiredDefault(p = null, req) { } - constructor(ctorField = null) { - this.ctorField = ctorField; - } - get x() { return null; } - set x(v) { } -} -exports.C = C; -exports.default = null; -// allows `undefined` on the input side, thanks to the initializer -function fnWithPartialAnnotationOnDefaultparam(x = null, b) { } diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode2(strictnullchecks=false).js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode2(strictnullchecks=false).js.diff index 3e8c0fda3a..3c139e9ea9 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode2(strictnullchecks=false).js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode2(strictnullchecks=false).js.diff @@ -1,9 +1,34 @@ --- old.declarationEmitCastReusesTypeNode2(strictnullchecks=false).js +++ new.declarationEmitCastReusesTypeNode2(strictnullchecks=false).js -@@= skipped -25, +25 lines =@@ - // allows `undefined` on the input side, thanks to the initializer - export function fnWithPartialAnnotationOnDefaultparam(x: {} & { name: string } = null! as {} & { name: string }, b: number) {} - +@@= skipped -0, +-1 lines =@@ +-//// [tests/cases/compiler/declarationEmitCastReusesTypeNode2.ts] //// +- +-//// [declarationEmitCastReusesTypeNode2.ts] +-export let vLet = null! as {} & { name: string } +-export const vConst = null! as {} & { name: string } +- +-export function fn(p = null! as {} & { name: string }) {} +- +-export function fnWithRequiredDefaultParam(p = null! as {} & { name: string }, req: number) {} +- +-export class C { +- field = null! as {} & { name: string }; +- optField? = null! as {} & { name: string }; +- readonly roFiled = null! as {} & { name: string }; +- method(p = null! as {} & { name: string }) {} +- methodWithRequiredDefault(p = null! as {} & { name: string }, req: number) {} +- +- constructor(public ctorField = null! as {} & { name: string }) {} +- +- get x() { return null! as {} & { name: string } } +- set x(v) { } +-} +- +-export default null! as {} & { name: string } +- +-// allows `undefined` on the input side, thanks to the initializer +-export function fnWithPartialAnnotationOnDefaultparam(x: {} & { name: string } = null! as {} & { name: string }, b: number) {} +- - - -//// [declarationEmitCastReusesTypeNode2.d.ts] @@ -47,30 +72,7 @@ - set x(v: {} & { - name: string; - }); -+//// [declarationEmitCastReusesTypeNode2.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.C = exports.vConst = exports.vLet = void 0; -+exports.fn = fn; -+exports.fnWithRequiredDefaultParam = fnWithRequiredDefaultParam; -+exports.fnWithPartialAnnotationOnDefaultparam = fnWithPartialAnnotationOnDefaultparam; -+exports.vLet = null; -+exports.vConst = null; -+function fn(p = null) { } -+function fnWithRequiredDefaultParam(p = null, req) { } -+class C { -+ ctorField; -+ field = null; -+ optField = null; -+ roFiled = null; -+ method(p = null) { } -+ methodWithRequiredDefault(p = null, req) { } -+ constructor(ctorField = null) { -+ this.ctorField = ctorField; -+ } -+ get x() { return null; } -+ set x(v) { } - } +-} -declare const _default: {} & { - name: string; -}; @@ -78,7 +80,5 @@ -export declare function fnWithPartialAnnotationOnDefaultparam(x: {} & { - name: string; -}, b: number): void; -+exports.C = C; -+exports.default = null; -+// allows `undefined` on the input side, thanks to the initializer -+function fnWithPartialAnnotationOnDefaultparam(x = null, b) { } +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode2(strictnullchecks=true).js b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode2(strictnullchecks=true).js deleted file mode 100644 index 93b0d5c3b3..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode2(strictnullchecks=true).js +++ /dev/null @@ -1,56 +0,0 @@ -//// [tests/cases/compiler/declarationEmitCastReusesTypeNode2.ts] //// - -//// [declarationEmitCastReusesTypeNode2.ts] -export let vLet = null! as {} & { name: string } -export const vConst = null! as {} & { name: string } - -export function fn(p = null! as {} & { name: string }) {} - -export function fnWithRequiredDefaultParam(p = null! as {} & { name: string }, req: number) {} - -export class C { - field = null! as {} & { name: string }; - optField? = null! as {} & { name: string }; - readonly roFiled = null! as {} & { name: string }; - method(p = null! as {} & { name: string }) {} - methodWithRequiredDefault(p = null! as {} & { name: string }, req: number) {} - - constructor(public ctorField = null! as {} & { name: string }) {} - - get x() { return null! as {} & { name: string } } - set x(v) { } -} - -export default null! as {} & { name: string } - -// allows `undefined` on the input side, thanks to the initializer -export function fnWithPartialAnnotationOnDefaultparam(x: {} & { name: string } = null! as {} & { name: string }, b: number) {} - -//// [declarationEmitCastReusesTypeNode2.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.C = exports.vConst = exports.vLet = void 0; -exports.fn = fn; -exports.fnWithRequiredDefaultParam = fnWithRequiredDefaultParam; -exports.fnWithPartialAnnotationOnDefaultparam = fnWithPartialAnnotationOnDefaultparam; -exports.vLet = null; -exports.vConst = null; -function fn(p = null) { } -function fnWithRequiredDefaultParam(p = null, req) { } -class C { - ctorField; - field = null; - optField = null; - roFiled = null; - method(p = null) { } - methodWithRequiredDefault(p = null, req) { } - constructor(ctorField = null) { - this.ctorField = ctorField; - } - get x() { return null; } - set x(v) { } -} -exports.C = C; -exports.default = null; -// allows `undefined` on the input side, thanks to the initializer -function fnWithPartialAnnotationOnDefaultparam(x = null, b) { } diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode2(strictnullchecks=true).js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode2(strictnullchecks=true).js.diff index f25fd427a3..4d04a7b791 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode2(strictnullchecks=true).js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode2(strictnullchecks=true).js.diff @@ -1,9 +1,34 @@ --- old.declarationEmitCastReusesTypeNode2(strictnullchecks=true).js +++ new.declarationEmitCastReusesTypeNode2(strictnullchecks=true).js -@@= skipped -25, +25 lines =@@ - // allows `undefined` on the input side, thanks to the initializer - export function fnWithPartialAnnotationOnDefaultparam(x: {} & { name: string } = null! as {} & { name: string }, b: number) {} - +@@= skipped -0, +-1 lines =@@ +-//// [tests/cases/compiler/declarationEmitCastReusesTypeNode2.ts] //// +- +-//// [declarationEmitCastReusesTypeNode2.ts] +-export let vLet = null! as {} & { name: string } +-export const vConst = null! as {} & { name: string } +- +-export function fn(p = null! as {} & { name: string }) {} +- +-export function fnWithRequiredDefaultParam(p = null! as {} & { name: string }, req: number) {} +- +-export class C { +- field = null! as {} & { name: string }; +- optField? = null! as {} & { name: string }; +- readonly roFiled = null! as {} & { name: string }; +- method(p = null! as {} & { name: string }) {} +- methodWithRequiredDefault(p = null! as {} & { name: string }, req: number) {} +- +- constructor(public ctorField = null! as {} & { name: string }) {} +- +- get x() { return null! as {} & { name: string } } +- set x(v) { } +-} +- +-export default null! as {} & { name: string } +- +-// allows `undefined` on the input side, thanks to the initializer +-export function fnWithPartialAnnotationOnDefaultparam(x: {} & { name: string } = null! as {} & { name: string }, b: number) {} +- - - -//// [declarationEmitCastReusesTypeNode2.d.ts] @@ -47,30 +72,7 @@ - set x(v: {} & { - name: string; - }); -+//// [declarationEmitCastReusesTypeNode2.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.C = exports.vConst = exports.vLet = void 0; -+exports.fn = fn; -+exports.fnWithRequiredDefaultParam = fnWithRequiredDefaultParam; -+exports.fnWithPartialAnnotationOnDefaultparam = fnWithPartialAnnotationOnDefaultparam; -+exports.vLet = null; -+exports.vConst = null; -+function fn(p = null) { } -+function fnWithRequiredDefaultParam(p = null, req) { } -+class C { -+ ctorField; -+ field = null; -+ optField = null; -+ roFiled = null; -+ method(p = null) { } -+ methodWithRequiredDefault(p = null, req) { } -+ constructor(ctorField = null) { -+ this.ctorField = ctorField; -+ } -+ get x() { return null; } -+ set x(v) { } - } +-} -declare const _default: {} & { - name: string; -}; @@ -78,7 +80,5 @@ -export declare function fnWithPartialAnnotationOnDefaultparam(x: ({} & { - name: string; -}) | undefined, b: number): void; -+exports.C = C; -+exports.default = null; -+// allows `undefined` on the input side, thanks to the initializer -+function fnWithPartialAnnotationOnDefaultparam(x = null, b) { } +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode3(strictnullchecks=false).js b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode3(strictnullchecks=false).js deleted file mode 100644 index f9fab7ebd5..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode3(strictnullchecks=false).js +++ /dev/null @@ -1,58 +0,0 @@ -//// [tests/cases/compiler/declarationEmitCastReusesTypeNode3.ts] //// - -//// [declarationEmitCastReusesTypeNode3.ts] -type P = { } & { name: string } - -export let vLet =

null! -export const vConst =

null! - -export function fn(p =

null!) {} - -export function fnWithRequiredDefaultParam(p =

null!, req: number) {} - -export class C { - field =

null! - optField? =

null! - readonly roFiled =

null!; - method(p =

null!) {} - methodWithRequiredDefault(p =

null!, req: number) {} - - constructor(public ctorField =

null!) {} - - get x() { return

null! } - set x(v) { } -} - -export default

null!; - -// allows `undefined` on the input side, thanks to the initializer -export function fnWithPartialAnnotationOnDefaultparam(x: P =

null!, b: number) {} - -//// [declarationEmitCastReusesTypeNode3.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.C = exports.vConst = exports.vLet = void 0; -exports.fn = fn; -exports.fnWithRequiredDefaultParam = fnWithRequiredDefaultParam; -exports.fnWithPartialAnnotationOnDefaultparam = fnWithPartialAnnotationOnDefaultparam; -exports.vLet = null; -exports.vConst = null; -function fn(p = null) { } -function fnWithRequiredDefaultParam(p = null, req) { } -class C { - ctorField; - field = null; - optField = null; - roFiled = null; - method(p = null) { } - methodWithRequiredDefault(p = null, req) { } - constructor(ctorField = null) { - this.ctorField = ctorField; - } - get x() { return null; } - set x(v) { } -} -exports.C = C; -exports.default = null; -// allows `undefined` on the input side, thanks to the initializer -function fnWithPartialAnnotationOnDefaultparam(x = null, b) { } diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode3(strictnullchecks=false).js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode3(strictnullchecks=false).js.diff index ed5fc13c3f..d5cde2ed90 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode3(strictnullchecks=false).js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode3(strictnullchecks=false).js.diff @@ -1,9 +1,36 @@ --- old.declarationEmitCastReusesTypeNode3(strictnullchecks=false).js +++ new.declarationEmitCastReusesTypeNode3(strictnullchecks=false).js -@@= skipped -27, +27 lines =@@ - // allows `undefined` on the input side, thanks to the initializer - export function fnWithPartialAnnotationOnDefaultparam(x: P =

null!, b: number) {} - +@@= skipped -0, +-1 lines =@@ +-//// [tests/cases/compiler/declarationEmitCastReusesTypeNode3.ts] //// +- +-//// [declarationEmitCastReusesTypeNode3.ts] +-type P = { } & { name: string } +- +-export let vLet =

null! +-export const vConst =

null! +- +-export function fn(p =

null!) {} +- +-export function fnWithRequiredDefaultParam(p =

null!, req: number) {} +- +-export class C { +- field =

null! +- optField? =

null! +- readonly roFiled =

null!; +- method(p =

null!) {} +- methodWithRequiredDefault(p =

null!, req: number) {} +- +- constructor(public ctorField =

null!) {} +- +- get x() { return

null! } +- set x(v) { } +-} +- +-export default

null!; +- +-// allows `undefined` on the input side, thanks to the initializer +-export function fnWithPartialAnnotationOnDefaultparam(x: P =

null!, b: number) {} +- - - -//// [declarationEmitCastReusesTypeNode3.d.ts] @@ -24,34 +51,9 @@ - constructor(ctorField?: P); - get x(): P; - set x(v: P); -+//// [declarationEmitCastReusesTypeNode3.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.C = exports.vConst = exports.vLet = void 0; -+exports.fn = fn; -+exports.fnWithRequiredDefaultParam = fnWithRequiredDefaultParam; -+exports.fnWithPartialAnnotationOnDefaultparam = fnWithPartialAnnotationOnDefaultparam; -+exports.vLet = null; -+exports.vConst = null; -+function fn(p = null) { } -+function fnWithRequiredDefaultParam(p = null, req) { } -+class C { -+ ctorField; -+ field = null; -+ optField = null; -+ roFiled = null; -+ method(p = null) { } -+ methodWithRequiredDefault(p = null, req) { } -+ constructor(ctorField = null) { -+ this.ctorField = ctorField; -+ } -+ get x() { return null; } -+ set x(v) { } - } +-} -declare const _default: P; -export default _default; -export declare function fnWithPartialAnnotationOnDefaultparam(x: P, b: number): void; -+exports.C = C; -+exports.default = null; -+// allows `undefined` on the input side, thanks to the initializer -+function fnWithPartialAnnotationOnDefaultparam(x = null, b) { } +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode3(strictnullchecks=true).js b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode3(strictnullchecks=true).js deleted file mode 100644 index f9fab7ebd5..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode3(strictnullchecks=true).js +++ /dev/null @@ -1,58 +0,0 @@ -//// [tests/cases/compiler/declarationEmitCastReusesTypeNode3.ts] //// - -//// [declarationEmitCastReusesTypeNode3.ts] -type P = { } & { name: string } - -export let vLet =

null! -export const vConst =

null! - -export function fn(p =

null!) {} - -export function fnWithRequiredDefaultParam(p =

null!, req: number) {} - -export class C { - field =

null! - optField? =

null! - readonly roFiled =

null!; - method(p =

null!) {} - methodWithRequiredDefault(p =

null!, req: number) {} - - constructor(public ctorField =

null!) {} - - get x() { return

null! } - set x(v) { } -} - -export default

null!; - -// allows `undefined` on the input side, thanks to the initializer -export function fnWithPartialAnnotationOnDefaultparam(x: P =

null!, b: number) {} - -//// [declarationEmitCastReusesTypeNode3.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.C = exports.vConst = exports.vLet = void 0; -exports.fn = fn; -exports.fnWithRequiredDefaultParam = fnWithRequiredDefaultParam; -exports.fnWithPartialAnnotationOnDefaultparam = fnWithPartialAnnotationOnDefaultparam; -exports.vLet = null; -exports.vConst = null; -function fn(p = null) { } -function fnWithRequiredDefaultParam(p = null, req) { } -class C { - ctorField; - field = null; - optField = null; - roFiled = null; - method(p = null) { } - methodWithRequiredDefault(p = null, req) { } - constructor(ctorField = null) { - this.ctorField = ctorField; - } - get x() { return null; } - set x(v) { } -} -exports.C = C; -exports.default = null; -// allows `undefined` on the input side, thanks to the initializer -function fnWithPartialAnnotationOnDefaultparam(x = null, b) { } diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode3(strictnullchecks=true).js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode3(strictnullchecks=true).js.diff index 254bd82cb8..a3db87e046 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode3(strictnullchecks=true).js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode3(strictnullchecks=true).js.diff @@ -1,9 +1,36 @@ --- old.declarationEmitCastReusesTypeNode3(strictnullchecks=true).js +++ new.declarationEmitCastReusesTypeNode3(strictnullchecks=true).js -@@= skipped -27, +27 lines =@@ - // allows `undefined` on the input side, thanks to the initializer - export function fnWithPartialAnnotationOnDefaultparam(x: P =

null!, b: number) {} - +@@= skipped -0, +-1 lines =@@ +-//// [tests/cases/compiler/declarationEmitCastReusesTypeNode3.ts] //// +- +-//// [declarationEmitCastReusesTypeNode3.ts] +-type P = { } & { name: string } +- +-export let vLet =

null! +-export const vConst =

null! +- +-export function fn(p =

null!) {} +- +-export function fnWithRequiredDefaultParam(p =

null!, req: number) {} +- +-export class C { +- field =

null! +- optField? =

null! +- readonly roFiled =

null!; +- method(p =

null!) {} +- methodWithRequiredDefault(p =

null!, req: number) {} +- +- constructor(public ctorField =

null!) {} +- +- get x() { return

null! } +- set x(v) { } +-} +- +-export default

null!; +- +-// allows `undefined` on the input side, thanks to the initializer +-export function fnWithPartialAnnotationOnDefaultparam(x: P =

null!, b: number) {} +- - - -//// [declarationEmitCastReusesTypeNode3.d.ts] @@ -24,34 +51,9 @@ - constructor(ctorField?: P); - get x(): P; - set x(v: P); -+//// [declarationEmitCastReusesTypeNode3.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.C = exports.vConst = exports.vLet = void 0; -+exports.fn = fn; -+exports.fnWithRequiredDefaultParam = fnWithRequiredDefaultParam; -+exports.fnWithPartialAnnotationOnDefaultparam = fnWithPartialAnnotationOnDefaultparam; -+exports.vLet = null; -+exports.vConst = null; -+function fn(p = null) { } -+function fnWithRequiredDefaultParam(p = null, req) { } -+class C { -+ ctorField; -+ field = null; -+ optField = null; -+ roFiled = null; -+ method(p = null) { } -+ methodWithRequiredDefault(p = null, req) { } -+ constructor(ctorField = null) { -+ this.ctorField = ctorField; -+ } -+ get x() { return null; } -+ set x(v) { } - } +-} -declare const _default: P; -export default _default; -export declare function fnWithPartialAnnotationOnDefaultparam(x: P | undefined, b: number): void; -+exports.C = C; -+exports.default = null; -+// allows `undefined` on the input side, thanks to the initializer -+function fnWithPartialAnnotationOnDefaultparam(x = null, b) { } +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode5(strictnullchecks=false).js b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode5(strictnullchecks=false).js deleted file mode 100644 index a8fbd40943..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode5(strictnullchecks=false).js +++ /dev/null @@ -1,52 +0,0 @@ -//// [tests/cases/compiler/declarationEmitCastReusesTypeNode5.ts] //// - -//// [declarationEmitCastReusesTypeNode5.ts] -export const vNumberLiteral = null! as 1 | 1 -export const vStringLiteral = null! as "1" | "1" -export const vLiteral = null! as "1" | "1" - -type R = { foo: string } - -export class C { - // under !strictNullChecks all types can be reused from the assertion - // under strictNullChecks we need to add undefined, and we can't always know we can - // Can't know if references contain undefined, fall back to inference - tsResolve? = null! as R | R; - tsResolve2? = null! as R | R | string; - // Simple type. we can add undefined - reuseType? = null! as ((p: R) => void) | string | string; - reuseType2? = null! as (new (p: R) => R) | string | string; - reuseType3? = null! as string | number | bigint | symbol | unknown | any | never | symbol; - reuseType4? = null! as [R, R, R] | [R, R, R]; - reuseType5? = null! as R[] | R[]; - reuseType6? = null! as 1 | "2" | 1n | 1n; - reuseType7? = null! as `A` | `A`; - reuseType8? = null! as `${string}-ok` | `${string}-ok`; - reuseType9? = null! as this | this; -} - -//// [declarationEmitCastReusesTypeNode5.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.C = exports.vLiteral = exports.vStringLiteral = exports.vNumberLiteral = void 0; -exports.vNumberLiteral = null; -exports.vStringLiteral = null; -exports.vLiteral = null; -class C { - // under !strictNullChecks all types can be reused from the assertion - // under strictNullChecks we need to add undefined, and we can't always know we can - // Can't know if references contain undefined, fall back to inference - tsResolve = null; - tsResolve2 = null; - // Simple type. we can add undefined - reuseType = null; - reuseType2 = null; - reuseType3 = null; - reuseType4 = null; - reuseType5 = null; - reuseType6 = null; - reuseType7 = null; - reuseType8 = null; - reuseType9 = null; -} -exports.C = C; diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode5(strictnullchecks=false).js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode5(strictnullchecks=false).js.diff index 7ccc59aeb0..789f569a29 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode5(strictnullchecks=false).js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode5(strictnullchecks=false).js.diff @@ -1,9 +1,33 @@ --- old.declarationEmitCastReusesTypeNode5(strictnullchecks=false).js +++ new.declarationEmitCastReusesTypeNode5(strictnullchecks=false).js -@@= skipped -24, +24 lines =@@ - reuseType9? = null! as this | this; - } - +@@= skipped -0, +-1 lines =@@ +-//// [tests/cases/compiler/declarationEmitCastReusesTypeNode5.ts] //// +- +-//// [declarationEmitCastReusesTypeNode5.ts] +-export const vNumberLiteral = null! as 1 | 1 +-export const vStringLiteral = null! as "1" | "1" +-export const vLiteral = null! as "1" | "1" +- +-type R = { foo: string } +- +-export class C { +- // under !strictNullChecks all types can be reused from the assertion +- // under strictNullChecks we need to add undefined, and we can't always know we can +- // Can't know if references contain undefined, fall back to inference +- tsResolve? = null! as R | R; +- tsResolve2? = null! as R | R | string; +- // Simple type. we can add undefined +- reuseType? = null! as ((p: R) => void) | string | string; +- reuseType2? = null! as (new (p: R) => R) | string | string; +- reuseType3? = null! as string | number | bigint | symbol | unknown | any | never | symbol; +- reuseType4? = null! as [R, R, R] | [R, R, R]; +- reuseType5? = null! as R[] | R[]; +- reuseType6? = null! as 1 | "2" | 1n | 1n; +- reuseType7? = null! as `A` | `A`; +- reuseType8? = null! as `${string}-ok` | `${string}-ok`; +- reuseType9? = null! as this | this; +-} +- - - -//// [declarationEmitCastReusesTypeNode5.d.ts] @@ -25,29 +49,7 @@ - reuseType7?: `A` | `A`; - reuseType8?: `${string}-ok` | `${string}-ok`; - reuseType9?: this | this; -+//// [declarationEmitCastReusesTypeNode5.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.C = exports.vLiteral = exports.vStringLiteral = exports.vNumberLiteral = void 0; -+exports.vNumberLiteral = null; -+exports.vStringLiteral = null; -+exports.vLiteral = null; -+class C { -+ // under !strictNullChecks all types can be reused from the assertion -+ // under strictNullChecks we need to add undefined, and we can't always know we can -+ // Can't know if references contain undefined, fall back to inference -+ tsResolve = null; -+ tsResolve2 = null; -+ // Simple type. we can add undefined -+ reuseType = null; -+ reuseType2 = null; -+ reuseType3 = null; -+ reuseType4 = null; -+ reuseType5 = null; -+ reuseType6 = null; -+ reuseType7 = null; -+ reuseType8 = null; -+ reuseType9 = null; - } +-} -export {}; -+exports.C = C; +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode5(strictnullchecks=true).js b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode5(strictnullchecks=true).js deleted file mode 100644 index a8fbd40943..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode5(strictnullchecks=true).js +++ /dev/null @@ -1,52 +0,0 @@ -//// [tests/cases/compiler/declarationEmitCastReusesTypeNode5.ts] //// - -//// [declarationEmitCastReusesTypeNode5.ts] -export const vNumberLiteral = null! as 1 | 1 -export const vStringLiteral = null! as "1" | "1" -export const vLiteral = null! as "1" | "1" - -type R = { foo: string } - -export class C { - // under !strictNullChecks all types can be reused from the assertion - // under strictNullChecks we need to add undefined, and we can't always know we can - // Can't know if references contain undefined, fall back to inference - tsResolve? = null! as R | R; - tsResolve2? = null! as R | R | string; - // Simple type. we can add undefined - reuseType? = null! as ((p: R) => void) | string | string; - reuseType2? = null! as (new (p: R) => R) | string | string; - reuseType3? = null! as string | number | bigint | symbol | unknown | any | never | symbol; - reuseType4? = null! as [R, R, R] | [R, R, R]; - reuseType5? = null! as R[] | R[]; - reuseType6? = null! as 1 | "2" | 1n | 1n; - reuseType7? = null! as `A` | `A`; - reuseType8? = null! as `${string}-ok` | `${string}-ok`; - reuseType9? = null! as this | this; -} - -//// [declarationEmitCastReusesTypeNode5.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.C = exports.vLiteral = exports.vStringLiteral = exports.vNumberLiteral = void 0; -exports.vNumberLiteral = null; -exports.vStringLiteral = null; -exports.vLiteral = null; -class C { - // under !strictNullChecks all types can be reused from the assertion - // under strictNullChecks we need to add undefined, and we can't always know we can - // Can't know if references contain undefined, fall back to inference - tsResolve = null; - tsResolve2 = null; - // Simple type. we can add undefined - reuseType = null; - reuseType2 = null; - reuseType3 = null; - reuseType4 = null; - reuseType5 = null; - reuseType6 = null; - reuseType7 = null; - reuseType8 = null; - reuseType9 = null; -} -exports.C = C; diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode5(strictnullchecks=true).js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode5(strictnullchecks=true).js.diff index fad0d284a6..5f96696d41 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode5(strictnullchecks=true).js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitCastReusesTypeNode5(strictnullchecks=true).js.diff @@ -1,9 +1,33 @@ --- old.declarationEmitCastReusesTypeNode5(strictnullchecks=true).js +++ new.declarationEmitCastReusesTypeNode5(strictnullchecks=true).js -@@= skipped -24, +24 lines =@@ - reuseType9? = null! as this | this; - } - +@@= skipped -0, +-1 lines =@@ +-//// [tests/cases/compiler/declarationEmitCastReusesTypeNode5.ts] //// +- +-//// [declarationEmitCastReusesTypeNode5.ts] +-export const vNumberLiteral = null! as 1 | 1 +-export const vStringLiteral = null! as "1" | "1" +-export const vLiteral = null! as "1" | "1" +- +-type R = { foo: string } +- +-export class C { +- // under !strictNullChecks all types can be reused from the assertion +- // under strictNullChecks we need to add undefined, and we can't always know we can +- // Can't know if references contain undefined, fall back to inference +- tsResolve? = null! as R | R; +- tsResolve2? = null! as R | R | string; +- // Simple type. we can add undefined +- reuseType? = null! as ((p: R) => void) | string | string; +- reuseType2? = null! as (new (p: R) => R) | string | string; +- reuseType3? = null! as string | number | bigint | symbol | unknown | any | never | symbol; +- reuseType4? = null! as [R, R, R] | [R, R, R]; +- reuseType5? = null! as R[] | R[]; +- reuseType6? = null! as 1 | "2" | 1n | 1n; +- reuseType7? = null! as `A` | `A`; +- reuseType8? = null! as `${string}-ok` | `${string}-ok`; +- reuseType9? = null! as this | this; +-} +- - - -//// [declarationEmitCastReusesTypeNode5.d.ts] @@ -25,29 +49,7 @@ - reuseType7?: `A` | `A`; - reuseType8?: `${string}-ok` | `${string}-ok`; - reuseType9?: this | this; -+//// [declarationEmitCastReusesTypeNode5.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.C = exports.vLiteral = exports.vStringLiteral = exports.vNumberLiteral = void 0; -+exports.vNumberLiteral = null; -+exports.vStringLiteral = null; -+exports.vLiteral = null; -+class C { -+ // under !strictNullChecks all types can be reused from the assertion -+ // under strictNullChecks we need to add undefined, and we can't always know we can -+ // Can't know if references contain undefined, fall back to inference -+ tsResolve = null; -+ tsResolve2 = null; -+ // Simple type. we can add undefined -+ reuseType = null; -+ reuseType2 = null; -+ reuseType3 = null; -+ reuseType4 = null; -+ reuseType5 = null; -+ reuseType6 = null; -+ reuseType7 = null; -+ reuseType8 = null; -+ reuseType9 = null; - } +-} -export {}; -+exports.C = C; +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitClassMemberWithComputedPropertyName.js b/testdata/baselines/reference/submodule/compiler/declarationEmitClassMemberWithComputedPropertyName.js deleted file mode 100644 index 0caded496b..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitClassMemberWithComputedPropertyName.js +++ /dev/null @@ -1,95 +0,0 @@ -//// [tests/cases/compiler/declarationEmitClassMemberWithComputedPropertyName.ts] //// - -//// [declarationEmitClassMemberWithComputedPropertyName.ts] -const k1 = Symbol(); -const k2 = 'foo' as const; - -const k3 = Symbol(); -const k4 = 'prop' as const; - -class Foo { - static [k1](): number { - return 1; - } - [k1](): string { - return ""; - } - - static [k2]() { - return 1; - } - [k2]() { - return ""; - } - - static m1() {} - m1() {} - - static [k3] = 1; - [k3] = 1; - - static [k4] = 1; - [k4] = 2; - - static p1 = 3; - p1 = 4; -} - -export const t1 = Foo[k1]; -export const t2 = new Foo()[k1]; - -export const t3 = Foo[k2]; -export const t4 = new Foo()[k2]; - -export const t5 = Foo.m1; -export const t6 = new Foo().m1; - -export const t7 = Foo[k3]; -export const t8 = new Foo()[k3]; - -export const t9 = Foo[k4]; -export const t10 = new Foo()[k4]; - -export const t11 = Foo.p1; -export const t12 = new Foo().p1; - - -//// [declarationEmitClassMemberWithComputedPropertyName.js] -const k1 = Symbol(); -const k2 = 'foo'; -const k3 = Symbol(); -const k4 = 'prop'; -class Foo { - static [k1]() { - return 1; - } - [k1]() { - return ""; - } - static [k2]() { - return 1; - } - [k2]() { - return ""; - } - static m1() { } - m1() { } - static [k3] = 1; - [k3] = 1; - static [k4] = 1; - [k4] = 2; - static p1 = 3; - p1 = 4; -} -export const t1 = Foo[k1]; -export const t2 = new Foo()[k1]; -export const t3 = Foo[k2]; -export const t4 = new Foo()[k2]; -export const t5 = Foo.m1; -export const t6 = new Foo().m1; -export const t7 = Foo[k3]; -export const t8 = new Foo()[k3]; -export const t9 = Foo[k4]; -export const t10 = new Foo()[k4]; -export const t11 = Foo.p1; -export const t12 = new Foo().p1; diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitClassMemberWithComputedPropertyName.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitClassMemberWithComputedPropertyName.js.diff index 4664bfcdc3..6581f648ba 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitClassMemberWithComputedPropertyName.js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitClassMemberWithComputedPropertyName.js.diff @@ -1,9 +1,62 @@ --- old.declarationEmitClassMemberWithComputedPropertyName.js +++ new.declarationEmitClassMemberWithComputedPropertyName.js -@@= skipped -53, +53 lines =@@ - export const t12 = new Foo().p1; - - +@@= skipped -0, +-1 lines =@@ +-//// [tests/cases/compiler/declarationEmitClassMemberWithComputedPropertyName.ts] //// +- +-//// [declarationEmitClassMemberWithComputedPropertyName.ts] +-const k1 = Symbol(); +-const k2 = 'foo' as const; +- +-const k3 = Symbol(); +-const k4 = 'prop' as const; +- +-class Foo { +- static [k1](): number { +- return 1; +- } +- [k1](): string { +- return ""; +- } +- +- static [k2]() { +- return 1; +- } +- [k2]() { +- return ""; +- } +- +- static m1() {} +- m1() {} +- +- static [k3] = 1; +- [k3] = 1; +- +- static [k4] = 1; +- [k4] = 2; +- +- static p1 = 3; +- p1 = 4; +-} +- +-export const t1 = Foo[k1]; +-export const t2 = new Foo()[k1]; +- +-export const t3 = Foo[k2]; +-export const t4 = new Foo()[k2]; +- +-export const t5 = Foo.m1; +-export const t6 = new Foo().m1; +- +-export const t7 = Foo[k3]; +-export const t8 = new Foo()[k3]; +- +-export const t9 = Foo[k4]; +-export const t10 = new Foo()[k4]; +- +-export const t11 = Foo.p1; +-export const t12 = new Foo().p1; +- +- - - -//// [declarationEmitClassMemberWithComputedPropertyName.d.ts] @@ -24,33 +77,7 @@ - [k4]: number; - static p1: number; - p1: number; -+//// [declarationEmitClassMemberWithComputedPropertyName.js] -+const k1 = Symbol(); -+const k2 = 'foo'; -+const k3 = Symbol(); -+const k4 = 'prop'; -+class Foo { -+ static [k1]() { -+ return 1; -+ } -+ [k1]() { -+ return ""; -+ } -+ static [k2]() { -+ return 1; -+ } -+ [k2]() { -+ return ""; -+ } -+ static m1() { } -+ m1() { } -+ static [k3] = 1; -+ [k3] = 1; -+ static [k4] = 1; -+ [k4] = 2; -+ static p1 = 3; -+ p1 = 4; - } +-} -export declare const t1: (typeof Foo)[typeof k1]; -export declare const t2: () => string; -export declare const t3: typeof Foo.foo; @@ -64,15 +91,5 @@ -export declare const t11: number; -export declare const t12: number; -export {}; -+export const t1 = Foo[k1]; -+export const t2 = new Foo()[k1]; -+export const t3 = Foo[k2]; -+export const t4 = new Foo()[k2]; -+export const t5 = Foo.m1; -+export const t6 = new Foo().m1; -+export const t7 = Foo[k3]; -+export const t8 = new Foo()[k3]; -+export const t9 = Foo[k4]; -+export const t10 = new Foo()[k4]; -+export const t11 = Foo.p1; -+export const t12 = new Foo().p1; +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitComputedPropertyName1.js b/testdata/baselines/reference/submodule/compiler/declarationEmitComputedPropertyName1.js deleted file mode 100644 index 1fdd99bd96..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitComputedPropertyName1.js +++ /dev/null @@ -1,33 +0,0 @@ -//// [tests/cases/compiler/declarationEmitComputedPropertyName1.ts] //// - -//// [declarationEmitComputedPropertyName1.ts] -// https://github.com/microsoft/TypeScript/issues/59107 - -declare function create(): T; - -export const c = create<{ - data: { - ["a_b_c"]: string; - ["sss"]: string; - s_d: string; - queryData?: string; - ["foo bar"]: string; - }; - ["a_b_c"]: string; -}>(); - -export interface IData { - ["a_b_c"]: string; - nested: { - ["d_e_f"]: string; - value: string; - ["qwe rty"]: string; - }; -} - - -//// [declarationEmitComputedPropertyName1.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.c = void 0; -exports.c = create(); diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitComputedPropertyName1.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitComputedPropertyName1.js.diff index 2f0ab7e061..94a3502740 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitComputedPropertyName1.js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitComputedPropertyName1.js.diff @@ -1,9 +1,34 @@ --- old.declarationEmitComputedPropertyName1.js +++ new.declarationEmitComputedPropertyName1.js -@@= skipped -25, +25 lines =@@ - } - - +@@= skipped -0, +-1 lines =@@ +-//// [tests/cases/compiler/declarationEmitComputedPropertyName1.ts] //// +- +-//// [declarationEmitComputedPropertyName1.ts] +-// https://github.com/microsoft/TypeScript/issues/59107 +- +-declare function create(): T; +- +-export const c = create<{ +- data: { +- ["a_b_c"]: string; +- ["sss"]: string; +- s_d: string; +- queryData?: string; +- ["foo bar"]: string; +- }; +- ["a_b_c"]: string; +-}>(); +- +-export interface IData { +- ["a_b_c"]: string; +- nested: { +- ["d_e_f"]: string; +- value: string; +- ["qwe rty"]: string; +- }; +-} +- +- - - -//// [declarationEmitComputedPropertyName1.d.ts] @@ -25,8 +50,5 @@ - ["qwe rty"]: string; - }; -} -+//// [declarationEmitComputedPropertyName1.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.c = void 0; -+exports.c = create(); +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitComputedPropertyNameEnum1.js b/testdata/baselines/reference/submodule/compiler/declarationEmitComputedPropertyNameEnum1.js deleted file mode 100644 index 02d47f439e..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitComputedPropertyNameEnum1.js +++ /dev/null @@ -1,30 +0,0 @@ -//// [tests/cases/compiler/declarationEmitComputedPropertyNameEnum1.ts] //// - -//// [type.ts] -export enum Enum { - A = "a", - B = "b" -} - -export type Type = { x?: { [Enum.A]: 0 } }; - -//// [index.ts] -import { type Type } from "./type"; - -export const foo = { ...({} as Type) }; - - -//// [type.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Enum = void 0; -var Enum; -(function (Enum) { - Enum["A"] = "a"; - Enum["B"] = "b"; -})(Enum || (exports.Enum = Enum = {})); -//// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.foo = void 0; -exports.foo = { ...{} }; diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitComputedPropertyNameEnum1.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitComputedPropertyNameEnum1.js.diff index e6d9736db9..dfc0554d21 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitComputedPropertyNameEnum1.js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitComputedPropertyNameEnum1.js.diff @@ -1,9 +1,22 @@ --- old.declarationEmitComputedPropertyNameEnum1.js +++ new.declarationEmitComputedPropertyNameEnum1.js -@@= skipped -13, +13 lines =@@ - export const foo = { ...({} as Type) }; - - +@@= skipped -0, +-1 lines =@@ +-//// [tests/cases/compiler/declarationEmitComputedPropertyNameEnum1.ts] //// +- +-//// [type.ts] +-export enum Enum { +- A = "a", +- B = "b" +-} +- +-export type Type = { x?: { [Enum.A]: 0 } }; +- +-//// [index.ts] +-import { type Type } from "./type"; +- +-export const foo = { ...({} as Type) }; +- +- - - -//// [type.d.ts] @@ -22,17 +35,5 @@ - a: 0; - }; -}; -+//// [type.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.Enum = void 0; -+var Enum; -+(function (Enum) { -+ Enum["A"] = "a"; -+ Enum["B"] = "b"; -+})(Enum || (exports.Enum = Enum = {})); -+//// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.foo = void 0; -+exports.foo = { ...{} }; +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitComputedPropertyNameEnum2.js b/testdata/baselines/reference/submodule/compiler/declarationEmitComputedPropertyNameEnum2.js deleted file mode 100644 index ce942fe346..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitComputedPropertyNameEnum2.js +++ /dev/null @@ -1,19 +0,0 @@ -//// [tests/cases/compiler/declarationEmitComputedPropertyNameEnum2.ts] //// - -//// [type.ts] -export type Type = { x?: { [Enum.A]: 0 } }; - -//// [index.ts] -import { type Type } from "./type"; - -export const foo = { ...({} as Type) }; - - -//// [type.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -//// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.foo = void 0; -exports.foo = { ...{} }; diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitComputedPropertyNameEnum2.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitComputedPropertyNameEnum2.js.diff index 37b6f02e36..62d46d0460 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitComputedPropertyNameEnum2.js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitComputedPropertyNameEnum2.js.diff @@ -1,9 +1,17 @@ --- old.declarationEmitComputedPropertyNameEnum2.js +++ new.declarationEmitComputedPropertyNameEnum2.js -@@= skipped -8, +8 lines =@@ - export const foo = { ...({} as Type) }; - - +@@= skipped -0, +-1 lines =@@ +-//// [tests/cases/compiler/declarationEmitComputedPropertyNameEnum2.ts] //// +- +-//// [type.ts] +-export type Type = { x?: { [Enum.A]: 0 } }; +- +-//// [index.ts] +-import { type Type } from "./type"; +- +-export const foo = { ...({} as Type) }; +- +- - - -//// [type.d.ts] @@ -16,11 +24,5 @@ - [Enum.A]: 0; - }; -}; -+//// [type.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+//// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.foo = void 0; -+exports.foo = { ...{} }; +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitComputedPropertyNameEnum3.js b/testdata/baselines/reference/submodule/compiler/declarationEmitComputedPropertyNameEnum3.js deleted file mode 100644 index 90b0ac2b48..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitComputedPropertyNameEnum3.js +++ /dev/null @@ -1,34 +0,0 @@ -//// [tests/cases/compiler/declarationEmitComputedPropertyNameEnum3.ts] //// - -//// [type.ts] -export namespace Foo { - export enum Enum { - A = "a", - B = "b", - } -} -export type Type = { x?: { [Foo.Enum]: 0 } }; - -//// [index.ts] -import { type Type } from "./type"; - -export const foo = { ...({} as Type) }; - - -//// [type.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Foo = void 0; -var Foo; -(function (Foo) { - let Enum; - (function (Enum) { - Enum["A"] = "a"; - Enum["B"] = "b"; - })(Enum = Foo.Enum || (Foo.Enum = {})); -})(Foo || (exports.Foo = Foo = {})); -//// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.foo = void 0; -exports.foo = { ...{} }; diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitComputedPropertyNameEnum3.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitComputedPropertyNameEnum3.js.diff index bd2c1bc2b1..95a5cdb867 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitComputedPropertyNameEnum3.js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitComputedPropertyNameEnum3.js.diff @@ -1,9 +1,23 @@ --- old.declarationEmitComputedPropertyNameEnum3.js +++ new.declarationEmitComputedPropertyNameEnum3.js -@@= skipped -14, +14 lines =@@ - export const foo = { ...({} as Type) }; - - +@@= skipped -0, +-1 lines =@@ +-//// [tests/cases/compiler/declarationEmitComputedPropertyNameEnum3.ts] //// +- +-//// [type.ts] +-export namespace Foo { +- export enum Enum { +- A = "a", +- B = "b", +- } +-} +-export type Type = { x?: { [Foo.Enum]: 0 } }; +- +-//// [index.ts] +-import { type Type } from "./type"; +- +-export const foo = { ...({} as Type) }; +- +- - - -//// [type.d.ts] @@ -20,20 +34,5 @@ -export declare const foo: { - x?: {}; -}; -+//// [type.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.Foo = void 0; -+var Foo; -+(function (Foo) { -+ let Enum; -+ (function (Enum) { -+ Enum["A"] = "a"; -+ Enum["B"] = "b"; -+ })(Enum = Foo.Enum || (Foo.Enum = {})); -+})(Foo || (exports.Foo = Foo = {})); -+//// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.foo = void 0; -+exports.foo = { ...{} }; +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitComputedPropertyNameSymbol1.js b/testdata/baselines/reference/submodule/compiler/declarationEmitComputedPropertyNameSymbol1.js deleted file mode 100644 index 8e04291276..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitComputedPropertyNameSymbol1.js +++ /dev/null @@ -1,27 +0,0 @@ -//// [tests/cases/compiler/declarationEmitComputedPropertyNameSymbol1.ts] //// - -//// [type.ts] -export namespace Foo { - export const sym = Symbol(); -} -export type Type = { x?: { [Foo.sym]: 0 } }; - -//// [index.ts] -import { type Type } from "./type"; - -export const foo = { ...({} as Type) }; - - -//// [type.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Foo = void 0; -var Foo; -(function (Foo) { - Foo.sym = Symbol(); -})(Foo || (exports.Foo = Foo = {})); -//// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.foo = void 0; -exports.foo = { ...{} }; diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitComputedPropertyNameSymbol1.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitComputedPropertyNameSymbol1.js.diff index 25358b964f..432e5e860f 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitComputedPropertyNameSymbol1.js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitComputedPropertyNameSymbol1.js.diff @@ -1,9 +1,20 @@ --- old.declarationEmitComputedPropertyNameSymbol1.js +++ new.declarationEmitComputedPropertyNameSymbol1.js -@@= skipped -11, +11 lines =@@ - export const foo = { ...({} as Type) }; - - +@@= skipped -0, +-1 lines =@@ +-//// [tests/cases/compiler/declarationEmitComputedPropertyNameSymbol1.ts] //// +- +-//// [type.ts] +-export namespace Foo { +- export const sym = Symbol(); +-} +-export type Type = { x?: { [Foo.sym]: 0 } }; +- +-//// [index.ts] +-import { type Type } from "./type"; +- +-export const foo = { ...({} as Type) }; +- +- - - -//// [type.d.ts] @@ -15,16 +26,5 @@ - [Foo.sym]: 0; - }; -}; -+//// [type.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.Foo = void 0; -+var Foo; -+(function (Foo) { -+ Foo.sym = Symbol(); -+})(Foo || (exports.Foo = Foo = {})); -+//// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.foo = void 0; -+exports.foo = { ...{} }; +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitComputedPropertyNameSymbol2.js b/testdata/baselines/reference/submodule/compiler/declarationEmitComputedPropertyNameSymbol2.js deleted file mode 100644 index 40aa8b1caa..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitComputedPropertyNameSymbol2.js +++ /dev/null @@ -1,26 +0,0 @@ -//// [tests/cases/compiler/declarationEmitComputedPropertyNameSymbol2.ts] //// - -//// [type.ts] -namespace Foo { - export const sym = Symbol(); -} -export type Type = { x?: { [Foo.sym]: 0 } }; - -//// [index.ts] -import { type Type } from "./type"; - -export const foo = { ...({} as Type) }; - - -//// [type.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var Foo; -(function (Foo) { - Foo.sym = Symbol(); -})(Foo || (Foo = {})); -//// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.foo = void 0; -exports.foo = { ...{} }; diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitComputedPropertyNameSymbol2.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitComputedPropertyNameSymbol2.js.diff index ab07f42846..6dbd250c4f 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitComputedPropertyNameSymbol2.js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitComputedPropertyNameSymbol2.js.diff @@ -1,9 +1,20 @@ --- old.declarationEmitComputedPropertyNameSymbol2.js +++ new.declarationEmitComputedPropertyNameSymbol2.js -@@= skipped -11, +11 lines =@@ - export const foo = { ...({} as Type) }; - - +@@= skipped -0, +-1 lines =@@ +-//// [tests/cases/compiler/declarationEmitComputedPropertyNameSymbol2.ts] //// +- +-//// [type.ts] +-namespace Foo { +- export const sym = Symbol(); +-} +-export type Type = { x?: { [Foo.sym]: 0 } }; +- +-//// [index.ts] +-import { type Type } from "./type"; +- +-export const foo = { ...({} as Type) }; +- +- - - -//// [type.d.ts] @@ -16,15 +27,5 @@ - }; -}; -export {}; -+//// [type.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+var Foo; -+(function (Foo) { -+ Foo.sym = Symbol(); -+})(Foo || (Foo = {})); -+//// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.foo = void 0; -+exports.foo = { ...{} }; +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitDuplicateParameterDestructuring.js b/testdata/baselines/reference/submodule/compiler/declarationEmitDuplicateParameterDestructuring.js deleted file mode 100644 index 0896d6be1b..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitDuplicateParameterDestructuring.js +++ /dev/null @@ -1,16 +0,0 @@ -//// [tests/cases/compiler/declarationEmitDuplicateParameterDestructuring.ts] //// - -//// [declarationEmitDuplicateParameterDestructuring.ts] -export const fn1 = ({ prop: a, prop: b }: { prop: number }) => a + b; - -export const fn2 = ({ prop: a }: { prop: number }, { prop: b }: { prop: number }) => a + b; - - -//// [declarationEmitDuplicateParameterDestructuring.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.fn2 = exports.fn1 = void 0; -const fn1 = ({ prop: a, prop: b }) => a + b; -exports.fn1 = fn1; -const fn2 = ({ prop: a }, { prop: b }) => a + b; -exports.fn2 = fn2; diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitDuplicateParameterDestructuring.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitDuplicateParameterDestructuring.js.diff index e060bd3b5c..2bb58d8962 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitDuplicateParameterDestructuring.js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitDuplicateParameterDestructuring.js.diff @@ -1,9 +1,14 @@ --- old.declarationEmitDuplicateParameterDestructuring.js +++ new.declarationEmitDuplicateParameterDestructuring.js -@@= skipped -5, +5 lines =@@ - export const fn2 = ({ prop: a }: { prop: number }, { prop: b }: { prop: number }) => a + b; - - +@@= skipped -0, +-1 lines =@@ +-//// [tests/cases/compiler/declarationEmitDuplicateParameterDestructuring.ts] //// +- +-//// [declarationEmitDuplicateParameterDestructuring.ts] +-export const fn1 = ({ prop: a, prop: b }: { prop: number }) => a + b; +- +-export const fn2 = ({ prop: a }: { prop: number }, { prop: b }: { prop: number }) => a + b; +- +- - - -//// [declarationEmitDuplicateParameterDestructuring.d.ts] @@ -15,11 +20,5 @@ -}, { prop: b }: { - prop: number; -}) => number; -+//// [declarationEmitDuplicateParameterDestructuring.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.fn2 = exports.fn1 = void 0; -+const fn1 = ({ prop: a, prop: b }) => a + b; -+exports.fn1 = fn1; -+const fn2 = ({ prop: a }, { prop: b }) => a + b; -+exports.fn2 = fn2; +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitGlobalThisPreserved.js b/testdata/baselines/reference/submodule/compiler/declarationEmitGlobalThisPreserved.js deleted file mode 100644 index 3a84375237..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitGlobalThisPreserved.js +++ /dev/null @@ -1,206 +0,0 @@ -//// [tests/cases/compiler/declarationEmitGlobalThisPreserved.ts] //// - -//// [declarationEmitGlobalThisPreserved.ts] -// Adding this makes tooltips fail too. -// declare global { -// namespace isNaN { -// const prop: number; -// } -// } - -// Broken inference cases. - -export const a1 = (isNaN: typeof globalThis.isNaN): typeof globalThis.isNaN => isNaN; -export const a2 = (isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN): typeof globalThis.isNaN => bar ?? isNaN; -export const a3 = (isNaN: number, bar: typeof globalThis.isNaN): typeof globalThis.isNaN => bar; -export const a4 = (isNaN: number): typeof globalThis.isNaN => globalThis.isNaN; - -export const aObj = { - a1: (isNaN: typeof globalThis.isNaN): typeof globalThis.isNaN => isNaN, - a2: (isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN): typeof globalThis.isNaN => bar ?? isNaN, - a3: (isNaN: number, bar: typeof globalThis.isNaN): typeof globalThis.isNaN => bar, - a4: (isNaN: number): typeof globalThis.isNaN => globalThis.isNaN, -} - -export type a4Return = ReturnType>; -export type a4oReturn = ReturnType>; - -export const b1 = (isNaN: typeof globalThis.isNaN) => isNaN; -export const b2 = (isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN) => bar ?? isNaN; -export const b3 = (isNaN: number, bar: typeof globalThis.isNaN) => bar; -export const b4 = (isNaN: number) => globalThis.isNaN; - -export const bObj = { - b1: (isNaN: typeof globalThis.isNaN) => isNaN, - b2: (isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN) => bar ?? isNaN, - b3: (isNaN: number, bar: typeof globalThis.isNaN) => bar, - b4: (isNaN: number) => globalThis.isNaN, -} - -export type b4Return = ReturnType>; -export type b4oReturn = ReturnType>; - -export function c1(isNaN: typeof globalThis.isNaN) { return isNaN } -export function c2(isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN) { return bar ?? isNaN } -export function c3(isNaN: number, bar: typeof globalThis.isNaN) { return bar } -export function c4(isNaN: number) { return globalThis.isNaN; } - -export const cObj = { - c1(isNaN: typeof globalThis.isNaN) { return isNaN }, - c2(isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN) { return bar ?? isNaN }, - c3(isNaN: number, bar: typeof globalThis.isNaN) { return bar }, - c4(isNaN: number) { return globalThis.isNaN; }, -} - -export type c4Return = ReturnType>; -export type c4oReturn = ReturnType>; - -export function d1() { - const fn = (isNaN: typeof globalThis.isNaN): typeof globalThis.isNaN => isNaN; - return function() { return fn }; -} - -export function d2() { - const fn = (isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN): typeof globalThis.isNaN => bar ?? isNaN; - return function() { return fn }; -} - -export function d3() { - const fn = (isNaN: number, bar: typeof globalThis.isNaN): typeof globalThis.isNaN => bar; - return function() { return fn }; -} - -export function d4() { - const fn = (isNaN: number): typeof globalThis.isNaN => globalThis.isNaN; - return function() { return fn }; -} - -export type d4Return = ReturnType>>>; - -export class A { - method1(isNaN: typeof globalThis.isNaN) { return isNaN } - method2(isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN) { return bar ?? isNaN } - method3(isNaN: number, bar: typeof globalThis.isNaN) { return bar } - method4(isNaN: number) { return globalThis.isNaN; } -} - -export function fromParameter(isNaN: number, bar: typeof globalThis.isNaN) { - return function() { return { bar } }; -} - -// Non-inference cases. - -export const explicitlyTypedVariable: (isNaN: typeof globalThis.isNaN) => typeof globalThis.isNaN = (isNaN) => isNaN; - -export function explicitlyTypedFunction(isNaN: typeof globalThis.isNaN): typeof globalThis.isNaN { - return isNaN; -}; - -export type AsObjectProperty = { - isNaN: typeof globalThis.isNaN; -} - -export class AsClassProperty { - isNaN?: typeof globalThis.isNaN; -} - -export type AsFunctionType = (isNaN: typeof globalThis.isNaN) => typeof globalThis.isNaN; - - - -//// [declarationEmitGlobalThisPreserved.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.AsClassProperty = exports.explicitlyTypedVariable = exports.A = exports.cObj = exports.bObj = exports.b4 = exports.b3 = exports.b2 = exports.b1 = exports.aObj = exports.a4 = exports.a3 = exports.a2 = exports.a1 = void 0; -exports.c1 = c1; -exports.c2 = c2; -exports.c3 = c3; -exports.c4 = c4; -exports.d1 = d1; -exports.d2 = d2; -exports.d3 = d3; -exports.d4 = d4; -exports.fromParameter = fromParameter; -exports.explicitlyTypedFunction = explicitlyTypedFunction; -// Adding this makes tooltips fail too. -// declare global { -// namespace isNaN { -// const prop: number; -// } -// } -// Broken inference cases. -const a1 = (isNaN) => isNaN; -exports.a1 = a1; -const a2 = (isNaN, bar) => bar ?? isNaN; -exports.a2 = a2; -const a3 = (isNaN, bar) => bar; -exports.a3 = a3; -const a4 = (isNaN) => globalThis.isNaN; -exports.a4 = a4; -exports.aObj = { - a1: (isNaN) => isNaN, - a2: (isNaN, bar) => bar ?? isNaN, - a3: (isNaN, bar) => bar, - a4: (isNaN) => globalThis.isNaN, -}; -const b1 = (isNaN) => isNaN; -exports.b1 = b1; -const b2 = (isNaN, bar) => bar ?? isNaN; -exports.b2 = b2; -const b3 = (isNaN, bar) => bar; -exports.b3 = b3; -const b4 = (isNaN) => globalThis.isNaN; -exports.b4 = b4; -exports.bObj = { - b1: (isNaN) => isNaN, - b2: (isNaN, bar) => bar ?? isNaN, - b3: (isNaN, bar) => bar, - b4: (isNaN) => globalThis.isNaN, -}; -function c1(isNaN) { return isNaN; } -function c2(isNaN, bar) { return bar ?? isNaN; } -function c3(isNaN, bar) { return bar; } -function c4(isNaN) { return globalThis.isNaN; } -exports.cObj = { - c1(isNaN) { return isNaN; }, - c2(isNaN, bar) { return bar ?? isNaN; }, - c3(isNaN, bar) { return bar; }, - c4(isNaN) { return globalThis.isNaN; }, -}; -function d1() { - const fn = (isNaN) => isNaN; - return function () { return fn; }; -} -function d2() { - const fn = (isNaN, bar) => bar ?? isNaN; - return function () { return fn; }; -} -function d3() { - const fn = (isNaN, bar) => bar; - return function () { return fn; }; -} -function d4() { - const fn = (isNaN) => globalThis.isNaN; - return function () { return fn; }; -} -class A { - method1(isNaN) { return isNaN; } - method2(isNaN, bar) { return bar ?? isNaN; } - method3(isNaN, bar) { return bar; } - method4(isNaN) { return globalThis.isNaN; } -} -exports.A = A; -function fromParameter(isNaN, bar) { - return function () { return { bar }; }; -} -// Non-inference cases. -const explicitlyTypedVariable = (isNaN) => isNaN; -exports.explicitlyTypedVariable = explicitlyTypedVariable; -function explicitlyTypedFunction(isNaN) { - return isNaN; -} -; -class AsClassProperty { - isNaN; -} -exports.AsClassProperty = AsClassProperty; diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitGlobalThisPreserved.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitGlobalThisPreserved.js.diff index c3e60b27c5..84e48da4ef 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitGlobalThisPreserved.js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitGlobalThisPreserved.js.diff @@ -1,9 +1,116 @@ --- old.declarationEmitGlobalThisPreserved.js +++ new.declarationEmitGlobalThisPreserved.js -@@= skipped -107, +107 lines =@@ - - - +@@= skipped -0, +-1 lines =@@ +-//// [tests/cases/compiler/declarationEmitGlobalThisPreserved.ts] //// +- +-//// [declarationEmitGlobalThisPreserved.ts] +-// Adding this makes tooltips fail too. +-// declare global { +-// namespace isNaN { +-// const prop: number; +-// } +-// } +- +-// Broken inference cases. +- +-export const a1 = (isNaN: typeof globalThis.isNaN): typeof globalThis.isNaN => isNaN; +-export const a2 = (isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN): typeof globalThis.isNaN => bar ?? isNaN; +-export const a3 = (isNaN: number, bar: typeof globalThis.isNaN): typeof globalThis.isNaN => bar; +-export const a4 = (isNaN: number): typeof globalThis.isNaN => globalThis.isNaN; +- +-export const aObj = { +- a1: (isNaN: typeof globalThis.isNaN): typeof globalThis.isNaN => isNaN, +- a2: (isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN): typeof globalThis.isNaN => bar ?? isNaN, +- a3: (isNaN: number, bar: typeof globalThis.isNaN): typeof globalThis.isNaN => bar, +- a4: (isNaN: number): typeof globalThis.isNaN => globalThis.isNaN, +-} +- +-export type a4Return = ReturnType>; +-export type a4oReturn = ReturnType>; +- +-export const b1 = (isNaN: typeof globalThis.isNaN) => isNaN; +-export const b2 = (isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN) => bar ?? isNaN; +-export const b3 = (isNaN: number, bar: typeof globalThis.isNaN) => bar; +-export const b4 = (isNaN: number) => globalThis.isNaN; +- +-export const bObj = { +- b1: (isNaN: typeof globalThis.isNaN) => isNaN, +- b2: (isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN) => bar ?? isNaN, +- b3: (isNaN: number, bar: typeof globalThis.isNaN) => bar, +- b4: (isNaN: number) => globalThis.isNaN, +-} +- +-export type b4Return = ReturnType>; +-export type b4oReturn = ReturnType>; +- +-export function c1(isNaN: typeof globalThis.isNaN) { return isNaN } +-export function c2(isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN) { return bar ?? isNaN } +-export function c3(isNaN: number, bar: typeof globalThis.isNaN) { return bar } +-export function c4(isNaN: number) { return globalThis.isNaN; } +- +-export const cObj = { +- c1(isNaN: typeof globalThis.isNaN) { return isNaN }, +- c2(isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN) { return bar ?? isNaN }, +- c3(isNaN: number, bar: typeof globalThis.isNaN) { return bar }, +- c4(isNaN: number) { return globalThis.isNaN; }, +-} +- +-export type c4Return = ReturnType>; +-export type c4oReturn = ReturnType>; +- +-export function d1() { +- const fn = (isNaN: typeof globalThis.isNaN): typeof globalThis.isNaN => isNaN; +- return function() { return fn }; +-} +- +-export function d2() { +- const fn = (isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN): typeof globalThis.isNaN => bar ?? isNaN; +- return function() { return fn }; +-} +- +-export function d3() { +- const fn = (isNaN: number, bar: typeof globalThis.isNaN): typeof globalThis.isNaN => bar; +- return function() { return fn }; +-} +- +-export function d4() { +- const fn = (isNaN: number): typeof globalThis.isNaN => globalThis.isNaN; +- return function() { return fn }; +-} +- +-export type d4Return = ReturnType>>>; +- +-export class A { +- method1(isNaN: typeof globalThis.isNaN) { return isNaN } +- method2(isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN) { return bar ?? isNaN } +- method3(isNaN: number, bar: typeof globalThis.isNaN) { return bar } +- method4(isNaN: number) { return globalThis.isNaN; } +-} +- +-export function fromParameter(isNaN: number, bar: typeof globalThis.isNaN) { +- return function() { return { bar } }; +-} +- +-// Non-inference cases. +- +-export const explicitlyTypedVariable: (isNaN: typeof globalThis.isNaN) => typeof globalThis.isNaN = (isNaN) => isNaN; +- +-export function explicitlyTypedFunction(isNaN: typeof globalThis.isNaN): typeof globalThis.isNaN { +- return isNaN; +-}; +- +-export type AsObjectProperty = { +- isNaN: typeof globalThis.isNaN; +-} +- +-export class AsClassProperty { +- isNaN?: typeof globalThis.isNaN; +-} +- +-export type AsFunctionType = (isNaN: typeof globalThis.isNaN) => typeof globalThis.isNaN; +- +- +- - - -//// [declarationEmitGlobalThisPreserved.d.ts] @@ -16,41 +123,7 @@ - a2: (isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN) => typeof globalThis.isNaN; - a3: (isNaN: number, bar: typeof globalThis.isNaN) => typeof globalThis.isNaN; - a4: (isNaN: number) => typeof globalThis.isNaN; -+//// [declarationEmitGlobalThisPreserved.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.AsClassProperty = exports.explicitlyTypedVariable = exports.A = exports.cObj = exports.bObj = exports.b4 = exports.b3 = exports.b2 = exports.b1 = exports.aObj = exports.a4 = exports.a3 = exports.a2 = exports.a1 = void 0; -+exports.c1 = c1; -+exports.c2 = c2; -+exports.c3 = c3; -+exports.c4 = c4; -+exports.d1 = d1; -+exports.d2 = d2; -+exports.d3 = d3; -+exports.d4 = d4; -+exports.fromParameter = fromParameter; -+exports.explicitlyTypedFunction = explicitlyTypedFunction; -+// Adding this makes tooltips fail too. -+// declare global { -+// namespace isNaN { -+// const prop: number; -+// } -+// } -+// Broken inference cases. -+const a1 = (isNaN) => isNaN; -+exports.a1 = a1; -+const a2 = (isNaN, bar) => bar ?? isNaN; -+exports.a2 = a2; -+const a3 = (isNaN, bar) => bar; -+exports.a3 = a3; -+const a4 = (isNaN) => globalThis.isNaN; -+exports.a4 = a4; -+exports.aObj = { -+ a1: (isNaN) => isNaN, -+ a2: (isNaN, bar) => bar ?? isNaN, -+ a3: (isNaN, bar) => bar, -+ a4: (isNaN) => globalThis.isNaN, - }; +-}; -export type a4Return = ReturnType>; -export type a4oReturn = ReturnType>; -export declare const b1: (isNaN: typeof globalThis.isNaN) => typeof globalThis.isNaN; @@ -62,20 +135,7 @@ - b2: (isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN) => typeof globalThis.isNaN; - b3: (isNaN: number, bar: typeof globalThis.isNaN) => typeof globalThis.isNaN; - b4: (isNaN: number) => typeof globalThis.isNaN; -+const b1 = (isNaN) => isNaN; -+exports.b1 = b1; -+const b2 = (isNaN, bar) => bar ?? isNaN; -+exports.b2 = b2; -+const b3 = (isNaN, bar) => bar; -+exports.b3 = b3; -+const b4 = (isNaN) => globalThis.isNaN; -+exports.b4 = b4; -+exports.bObj = { -+ b1: (isNaN) => isNaN, -+ b2: (isNaN, bar) => bar ?? isNaN, -+ b3: (isNaN, bar) => bar, -+ b4: (isNaN) => globalThis.isNaN, - }; +-}; -export type b4Return = ReturnType>; -export type b4oReturn = ReturnType>; -export declare function c1(isNaN: typeof globalThis.isNaN): typeof globalThis.isNaN; @@ -87,16 +147,7 @@ - c2(isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN): typeof globalThis.isNaN; - c3(isNaN: number, bar: typeof globalThis.isNaN): typeof globalThis.isNaN; - c4(isNaN: number): typeof globalThis.isNaN; -+function c1(isNaN) { return isNaN; } -+function c2(isNaN, bar) { return bar ?? isNaN; } -+function c3(isNaN, bar) { return bar; } -+function c4(isNaN) { return globalThis.isNaN; } -+exports.cObj = { -+ c1(isNaN) { return isNaN; }, -+ c2(isNaN, bar) { return bar ?? isNaN; }, -+ c3(isNaN, bar) { return bar; }, -+ c4(isNaN) { return globalThis.isNaN; }, - }; +-}; -export type c4Return = ReturnType>; -export type c4oReturn = ReturnType>; -export declare function d1(): () => (isNaN: typeof globalThis.isNaN) => typeof globalThis.isNaN; @@ -109,10 +160,7 @@ - method2(isNaN: typeof globalThis.isNaN, bar?: typeof globalThis.isNaN): typeof globalThis.isNaN; - method3(isNaN: number, bar: typeof globalThis.isNaN): typeof globalThis.isNaN; - method4(isNaN: number): typeof globalThis.isNaN; -+function d1() { -+ const fn = (isNaN) => isNaN; -+ return function () { return fn; }; - } +-} -export declare function fromParameter(isNaN: number, bar: typeof globalThis.isNaN): () => { - bar: typeof globalThis.isNaN; -}; @@ -123,37 +171,7 @@ -}; -export declare class AsClassProperty { - isNaN?: typeof globalThis.isNaN; -+function d2() { -+ const fn = (isNaN, bar) => bar ?? isNaN; -+ return function () { return fn; }; - } +-} -export type AsFunctionType = (isNaN: typeof globalThis.isNaN) => typeof globalThis.isNaN; -+function d3() { -+ const fn = (isNaN, bar) => bar; -+ return function () { return fn; }; -+} -+function d4() { -+ const fn = (isNaN) => globalThis.isNaN; -+ return function () { return fn; }; -+} -+class A { -+ method1(isNaN) { return isNaN; } -+ method2(isNaN, bar) { return bar ?? isNaN; } -+ method3(isNaN, bar) { return bar; } -+ method4(isNaN) { return globalThis.isNaN; } -+} -+exports.A = A; -+function fromParameter(isNaN, bar) { -+ return function () { return { bar }; }; -+} -+// Non-inference cases. -+const explicitlyTypedVariable = (isNaN) => isNaN; -+exports.explicitlyTypedVariable = explicitlyTypedVariable; -+function explicitlyTypedFunction(isNaN) { -+ return isNaN; -+} -+; -+class AsClassProperty { -+ isNaN; -+} -+exports.AsClassProperty = AsClassProperty; +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitHigherOrderRetainedGenerics.js b/testdata/baselines/reference/submodule/compiler/declarationEmitHigherOrderRetainedGenerics.js deleted file mode 100644 index 1533eac3a5..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitHigherOrderRetainedGenerics.js +++ /dev/null @@ -1,124 +0,0 @@ -//// [tests/cases/compiler/declarationEmitHigherOrderRetainedGenerics.ts] //// - -//// [declarationEmitHigherOrderRetainedGenerics.ts] -export interface TypeLambda { - readonly In: unknown - readonly Out2: unknown - readonly Out1: unknown - readonly Target: unknown -} -export namespace Types { - export type Invariant = (_: A) => A - export type Covariant = (_: never) => A - export type Contravariant = (_: A) => void -} - -export declare const URI: unique symbol; -export interface TypeClass { - readonly [URI]?: F -} - -export interface Invariant extends TypeClass { - readonly imap: { - ( - to: (a: A) => B, - from: (b: B) => A - ): (self: Kind) => Kind - ( - self: Kind, - to: (a: A) => B, - from: (b: B) => A - ): Kind - } -} - -export interface Covariant extends Invariant { - readonly map: { - (f: (a: A) => B): (self: Kind) => Kind - (self: Kind, f: (a: A) => B): Kind - } -} - - -export type Kind = F extends { - readonly type: unknown -} ? (F & { - readonly In: In - readonly Out2: Out2 - readonly Out1: Out1 - readonly Target: Target -})["type"] - : { - readonly F: F - readonly In: Types.Contravariant - readonly Out2: Types.Covariant - readonly Out1: Types.Covariant - readonly Target: Types.Invariant - } - -export interface SemiProduct extends Invariant { - readonly product: ( - self: Kind, - that: Kind - ) => Kind - - readonly productMany: ( - self: Kind, - collection: Iterable> - ) => Kind]> -} -export interface SemiApplicative extends SemiProduct, Covariant { } - - -export const SK = (_: A, b: B): B => b; - -export declare const dual: { - ) => any, DataFirst extends (...args: Array) => any>( - arity: Parameters["length"], - body: DataFirst - ): DataLast & DataFirst - ) => any, DataFirst extends (...args: Array) => any>( - isDataFirst: (args: IArguments) => boolean, - body: DataFirst - ): DataLast & DataFirst -}; - -export const zipWith = (F: SemiApplicative): { - ( - that: Kind, - f: (a: A, b: B) => C - ): (self: Kind) => Kind - ( - self: Kind, - that: Kind, - f: (a: A, b: B) => C - ): Kind -} => - dual( - 3, - ( - self: Kind, - that: Kind, - f: (a: A, b: B) => C - ): Kind => F.map(F.product(self, that), ([a, b]) => f(a, b)) - ); - - -export const zipRight = (F: SemiApplicative): { - ( - that: Kind - ): (self: Kind) => Kind - ( - self: Kind, - that: Kind - ): Kind -} => - dual(2, ( - self: Kind, - that: Kind - ): Kind => zipWith(F)(self, that, SK)); - -//// [declarationEmitHigherOrderRetainedGenerics.js] -export const SK = (_, b) => b; -export const zipWith = (F) => dual(3, (self, that, f) => F.map(F.product(self, that), ([a, b]) => f(a, b))); -export const zipRight = (F) => dual(2, (self, that) => zipWith(F)(self, that, SK)); diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitHigherOrderRetainedGenerics.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitHigherOrderRetainedGenerics.js.diff index c4fa476705..f9f5006c63 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitHigherOrderRetainedGenerics.js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitHigherOrderRetainedGenerics.js.diff @@ -1,9 +1,126 @@ --- old.declarationEmitHigherOrderRetainedGenerics.js +++ new.declarationEmitHigherOrderRetainedGenerics.js -@@= skipped -117, +117 lines =@@ - that: Kind - ): Kind => zipWith(F)(self, that, SK)); - +@@= skipped -0, +-1 lines =@@ +-//// [tests/cases/compiler/declarationEmitHigherOrderRetainedGenerics.ts] //// +- +-//// [declarationEmitHigherOrderRetainedGenerics.ts] +-export interface TypeLambda { +- readonly In: unknown +- readonly Out2: unknown +- readonly Out1: unknown +- readonly Target: unknown +-} +-export namespace Types { +- export type Invariant = (_: A) => A +- export type Covariant = (_: never) => A +- export type Contravariant = (_: A) => void +-} +- +-export declare const URI: unique symbol; +-export interface TypeClass { +- readonly [URI]?: F +-} +- +-export interface Invariant extends TypeClass { +- readonly imap: { +- ( +- to: (a: A) => B, +- from: (b: B) => A +- ): (self: Kind) => Kind +- ( +- self: Kind, +- to: (a: A) => B, +- from: (b: B) => A +- ): Kind +- } +-} +- +-export interface Covariant extends Invariant { +- readonly map: { +- (f: (a: A) => B): (self: Kind) => Kind +- (self: Kind, f: (a: A) => B): Kind +- } +-} +- +- +-export type Kind = F extends { +- readonly type: unknown +-} ? (F & { +- readonly In: In +- readonly Out2: Out2 +- readonly Out1: Out1 +- readonly Target: Target +-})["type"] +- : { +- readonly F: F +- readonly In: Types.Contravariant +- readonly Out2: Types.Covariant +- readonly Out1: Types.Covariant +- readonly Target: Types.Invariant +- } +- +-export interface SemiProduct extends Invariant { +- readonly product: ( +- self: Kind, +- that: Kind +- ) => Kind +- +- readonly productMany: ( +- self: Kind, +- collection: Iterable> +- ) => Kind]> +-} +-export interface SemiApplicative extends SemiProduct, Covariant { } +- +- +-export const SK = (_: A, b: B): B => b; +- +-export declare const dual: { +- ) => any, DataFirst extends (...args: Array) => any>( +- arity: Parameters["length"], +- body: DataFirst +- ): DataLast & DataFirst +- ) => any, DataFirst extends (...args: Array) => any>( +- isDataFirst: (args: IArguments) => boolean, +- body: DataFirst +- ): DataLast & DataFirst +-}; +- +-export const zipWith = (F: SemiApplicative): { +- ( +- that: Kind, +- f: (a: A, b: B) => C +- ): (self: Kind) => Kind +- ( +- self: Kind, +- that: Kind, +- f: (a: A, b: B) => C +- ): Kind +-} => +- dual( +- 3, +- ( +- self: Kind, +- that: Kind, +- f: (a: A, b: B) => C +- ): Kind => F.map(F.product(self, that), ([a, b]) => f(a, b)) +- ); +- +- +-export const zipRight = (F: SemiApplicative): { +- ( +- that: Kind +- ): (self: Kind) => Kind +- ( +- self: Kind, +- that: Kind +- ): Kind +-} => +- dual(2, ( +- self: Kind, +- that: Kind +- ): Kind => zipWith(F)(self, that, SK)); +- - - -//// [declarationEmitHigherOrderRetainedGenerics.d.ts] @@ -67,7 +184,5 @@ - (that: Kind): (self: Kind) => Kind; - (self: Kind, that: Kind): Kind; -}; -+//// [declarationEmitHigherOrderRetainedGenerics.js] -+export const SK = (_, b) => b; -+export const zipWith = (F) => dual(3, (self, that, f) => F.map(F.product(self, that), ([a, b]) => f(a, b))); -+export const zipRight = (F) => dual(2, (self, that) => zipWith(F)(self, that, SK)); +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitObjectLiteralAccessors1.js b/testdata/baselines/reference/submodule/compiler/declarationEmitObjectLiteralAccessors1.js deleted file mode 100644 index 35d64c1639..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitObjectLiteralAccessors1.js +++ /dev/null @@ -1,68 +0,0 @@ -//// [tests/cases/compiler/declarationEmitObjectLiteralAccessors1.ts] //// - -//// [declarationEmitObjectLiteralAccessors1.ts] -// same type accessors -export const obj1 = { - /** my awesome getter (first in source order) */ - get x(): string { - return ""; - }, - /** my awesome setter (second in source order) */ - set x(a: string) {}, -}; - -// divergent accessors -export const obj2 = { - /** my awesome getter */ - get x(): string { - return ""; - }, - /** my awesome setter */ - set x(a: number) {}, -}; - -export const obj3 = { - /** my awesome getter */ - get x(): string { - return ""; - }, -}; - -export const obj4 = { - /** my awesome setter */ - set x(a: number) {}, -}; - - -//// [declarationEmitObjectLiteralAccessors1.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.obj4 = exports.obj3 = exports.obj2 = exports.obj1 = void 0; -// same type accessors -exports.obj1 = { - /** my awesome getter (first in source order) */ - get x() { - return ""; - }, - /** my awesome setter (second in source order) */ - set x(a) { }, -}; -// divergent accessors -exports.obj2 = { - /** my awesome getter */ - get x() { - return ""; - }, - /** my awesome setter */ - set x(a) { }, -}; -exports.obj3 = { - /** my awesome getter */ - get x() { - return ""; - }, -}; -exports.obj4 = { - /** my awesome setter */ - set x(a) { }, -}; diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitObjectLiteralAccessors1.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitObjectLiteralAccessors1.js.diff index f14e56cb07..cecb730098 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitObjectLiteralAccessors1.js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitObjectLiteralAccessors1.js.diff @@ -1,50 +1,62 @@ --- old.declarationEmitObjectLiteralAccessors1.js +++ new.declarationEmitObjectLiteralAccessors1.js -@@= skipped -33, +33 lines =@@ - }; - - +@@= skipped -0, +-1 lines =@@ +-//// [tests/cases/compiler/declarationEmitObjectLiteralAccessors1.ts] //// +- +-//// [declarationEmitObjectLiteralAccessors1.ts] +-// same type accessors +-export const obj1 = { +- /** my awesome getter (first in source order) */ +- get x(): string { +- return ""; +- }, +- /** my awesome setter (second in source order) */ +- set x(a: string) {}, +-}; +- +-// divergent accessors +-export const obj2 = { +- /** my awesome getter */ +- get x(): string { +- return ""; +- }, +- /** my awesome setter */ +- set x(a: number) {}, +-}; +- +-export const obj3 = { +- /** my awesome getter */ +- get x(): string { +- return ""; +- }, +-}; +- +-export const obj4 = { +- /** my awesome setter */ +- set x(a: number) {}, +-}; +- +- - - -//// [declarationEmitObjectLiteralAccessors1.d.ts] -export declare const obj1: { -+//// [declarationEmitObjectLiteralAccessors1.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.obj4 = exports.obj3 = exports.obj2 = exports.obj1 = void 0; -+// same type accessors -+exports.obj1 = { - /** my awesome getter (first in source order) */ +- /** my awesome getter (first in source order) */ - x: string; -+ get x() { -+ return ""; -+ }, -+ /** my awesome setter (second in source order) */ -+ set x(a) { }, - }; +-}; -export declare const obj2: { -+// divergent accessors -+exports.obj2 = { - /** my awesome getter */ +- /** my awesome getter */ - get x(): string; -+ get x() { -+ return ""; -+ }, - /** my awesome setter */ +- /** my awesome setter */ - set x(a: number); -+ set x(a) { }, - }; +-}; -export declare const obj3: { -+exports.obj3 = { - /** my awesome getter */ +- /** my awesome getter */ - readonly x: string; -+ get x() { -+ return ""; -+ }, - }; +-}; -export declare const obj4: { -+exports.obj4 = { - /** my awesome setter */ +- /** my awesome setter */ - x: number; -+ set x(a) { }, - }; +-}; +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitRedundantTripleSlashModuleAugmentation.js b/testdata/baselines/reference/submodule/compiler/declarationEmitRedundantTripleSlashModuleAugmentation.js deleted file mode 100644 index 4accba0ac6..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitRedundantTripleSlashModuleAugmentation.js +++ /dev/null @@ -1,27 +0,0 @@ -//// [tests/cases/compiler/declarationEmitRedundantTripleSlashModuleAugmentation.ts] //// - -//// [index.d.ts] -declare module "foo" { - export interface Original {} -} - -//// [augmentation.ts] -export interface FooOptions {} -declare module "foo" { - export interface Augmentation {} -} - -//// [index.ts] -import { Original, Augmentation } from "foo"; -import type { FooOptions } from "./augmentation"; -export interface _ { - original: Original; - augmentation: Augmentation; - options: FooOptions; -} - - -//// [augmentation.js] -export {}; -//// [index.js] -export {}; diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitRedundantTripleSlashModuleAugmentation.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitRedundantTripleSlashModuleAugmentation.js.diff index a23354ed35..b8b86017e7 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitRedundantTripleSlashModuleAugmentation.js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitRedundantTripleSlashModuleAugmentation.js.diff @@ -1,9 +1,29 @@ --- old.declarationEmitRedundantTripleSlashModuleAugmentation.js +++ new.declarationEmitRedundantTripleSlashModuleAugmentation.js -@@= skipped -20, +20 lines =@@ - } - - +@@= skipped -0, +-1 lines =@@ +-//// [tests/cases/compiler/declarationEmitRedundantTripleSlashModuleAugmentation.ts] //// +- +-//// [index.d.ts] +-declare module "foo" { +- export interface Original {} +-} +- +-//// [augmentation.ts] +-export interface FooOptions {} +-declare module "foo" { +- export interface Augmentation {} +-} +- +-//// [index.ts] +-import { Original, Augmentation } from "foo"; +-import type { FooOptions } from "./augmentation"; +-export interface _ { +- original: Original; +- augmentation: Augmentation; +- options: FooOptions; +-} +- +- - - -//// [augmentation.d.ts] @@ -21,7 +41,5 @@ - augmentation: Augmentation; - options: FooOptions; -} -+//// [augmentation.js] -+export {}; -+//// [index.js] -+export {}; +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitTripleSlashReferenceAmbientModule.js b/testdata/baselines/reference/submodule/compiler/declarationEmitTripleSlashReferenceAmbientModule.js deleted file mode 100644 index dfda2f4280..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitTripleSlashReferenceAmbientModule.js +++ /dev/null @@ -1,38 +0,0 @@ -//// [tests/cases/compiler/declarationEmitTripleSlashReferenceAmbientModule.ts] //// - -//// [index.d.ts] -declare module "url" { - export class Url {} - export function parse(): Url; -} - -//// [usage1.ts] -export { parse } from "url"; - -//// [usage2.ts] -import { parse } from "url"; -export const thing: import("url").Url = parse(); - -//// [usage3.ts] -import { parse } from "url"; -export const thing = parse(); - - -//// [usage1.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.parse = void 0; -const url_1 = require("url"); -Object.defineProperty(exports, "parse", { enumerable: true, get: function () { return url_1.parse; } }); -//// [usage2.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.thing = void 0; -const url_1 = require("url"); -exports.thing = (0, url_1.parse)(); -//// [usage3.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.thing = void 0; -const url_1 = require("url"); -exports.thing = (0, url_1.parse)(); diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitTripleSlashReferenceAmbientModule.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitTripleSlashReferenceAmbientModule.js.diff index a2877f3142..6f33d4f4ea 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitTripleSlashReferenceAmbientModule.js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitTripleSlashReferenceAmbientModule.js.diff @@ -1,9 +1,26 @@ --- old.declarationEmitTripleSlashReferenceAmbientModule.js +++ new.declarationEmitTripleSlashReferenceAmbientModule.js -@@= skipped -17, +17 lines =@@ - export const thing = parse(); - - +@@= skipped -0, +-1 lines =@@ +-//// [tests/cases/compiler/declarationEmitTripleSlashReferenceAmbientModule.ts] //// +- +-//// [index.d.ts] +-declare module "url" { +- export class Url {} +- export function parse(): Url; +-} +- +-//// [usage1.ts] +-export { parse } from "url"; +- +-//// [usage2.ts] +-import { parse } from "url"; +-export const thing: import("url").Url = parse(); +- +-//// [usage3.ts] +-import { parse } from "url"; +-export const thing = parse(); +- +- - - -//// [usage1.d.ts] @@ -12,21 +29,5 @@ -export declare const thing: import("url").Url; -//// [usage3.d.ts] -export declare const thing: import("url").Url; -+//// [usage1.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.parse = void 0; -+const url_1 = require("url"); -+Object.defineProperty(exports, "parse", { enumerable: true, get: function () { return url_1.parse; } }); -+//// [usage2.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.thing = void 0; -+const url_1 = require("url"); -+exports.thing = (0, url_1.parse)(); -+//// [usage3.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.thing = void 0; -+const url_1 = require("url"); -+exports.thing = (0, url_1.parse)(); +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitVarInElidedBlock.js b/testdata/baselines/reference/submodule/compiler/declarationEmitVarInElidedBlock.js deleted file mode 100644 index 81a021c077..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitVarInElidedBlock.js +++ /dev/null @@ -1,15 +0,0 @@ -//// [tests/cases/compiler/declarationEmitVarInElidedBlock.ts] //// - -//// [declarationEmitVarInElidedBlock.ts] -{ - var a = ""; -} -export let b: typeof a; - -//// [declarationEmitVarInElidedBlock.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.b = void 0; -{ - var a = ""; -} diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitVarInElidedBlock.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitVarInElidedBlock.js.diff deleted file mode 100644 index 03bad613a9..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitVarInElidedBlock.js.diff +++ /dev/null @@ -1,20 +0,0 @@ ---- old.declarationEmitVarInElidedBlock.js -+++ new.declarationEmitVarInElidedBlock.js -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+//// [tests/cases/compiler/declarationEmitVarInElidedBlock.ts] //// -+ -+//// [declarationEmitVarInElidedBlock.ts] -+{ -+ var a = ""; -+} -+export let b: typeof a; -+ -+//// [declarationEmitVarInElidedBlock.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.b = void 0; -+{ -+ var a = ""; -+} diff --git a/testdata/baselines/reference/submodule/compiler/dtsEmitTripleSlashAvoidUnnecessaryResolutionMode.js b/testdata/baselines/reference/submodule/compiler/dtsEmitTripleSlashAvoidUnnecessaryResolutionMode.js deleted file mode 100644 index f054efe762..0000000000 --- a/testdata/baselines/reference/submodule/compiler/dtsEmitTripleSlashAvoidUnnecessaryResolutionMode.js +++ /dev/null @@ -1,27 +0,0 @@ -//// [tests/cases/compiler/dtsEmitTripleSlashAvoidUnnecessaryResolutionMode.ts] //// - -//// [package.json] -{ - "name": "@types/node", - "version": "1.0.0", - "types": "index.d.ts" -} - -//// [globals.d.ts] -declare namespace NodeJS { - interface ReadableStream {} -} - -//// [index.d.ts] -/// - -//// [app.mts] -/// -export async function drainStream(stream: NodeJS.ReadableStream): Promise { -} - - -//// [app.mjs] -/// -export async function drainStream(stream) { -} diff --git a/testdata/baselines/reference/submodule/compiler/dtsEmitTripleSlashAvoidUnnecessaryResolutionMode.js.diff b/testdata/baselines/reference/submodule/compiler/dtsEmitTripleSlashAvoidUnnecessaryResolutionMode.js.diff index 2320e53060..bd38f17238 100644 --- a/testdata/baselines/reference/submodule/compiler/dtsEmitTripleSlashAvoidUnnecessaryResolutionMode.js.diff +++ b/testdata/baselines/reference/submodule/compiler/dtsEmitTripleSlashAvoidUnnecessaryResolutionMode.js.diff @@ -1,14 +1,33 @@ --- old.dtsEmitTripleSlashAvoidUnnecessaryResolutionMode.js +++ new.dtsEmitTripleSlashAvoidUnnecessaryResolutionMode.js -@@= skipped -20, +20 lines =@@ - } - - +@@= skipped -0, +-1 lines =@@ +-//// [tests/cases/compiler/dtsEmitTripleSlashAvoidUnnecessaryResolutionMode.ts] //// +- +-//// [package.json] +-{ +- "name": "@types/node", +- "version": "1.0.0", +- "types": "index.d.ts" +-} +- +-//// [globals.d.ts] +-declare namespace NodeJS { +- interface ReadableStream {} +-} +- +-//// [index.d.ts] +-/// +- +-//// [app.mts] +-/// +-export async function drainStream(stream: NodeJS.ReadableStream): Promise { +-} +- +- - - -//// [app.d.mts] -+//// [app.mjs] - /// +-/// -export declare function drainStream(stream: NodeJS.ReadableStream): Promise; -+export async function drainStream(stream) { -+} +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/compiler/mappedTypeGenericInstantiationPreservesInlineForm.js b/testdata/baselines/reference/submodule/compiler/mappedTypeGenericInstantiationPreservesInlineForm.js deleted file mode 100644 index 9bf0f94801..0000000000 --- a/testdata/baselines/reference/submodule/compiler/mappedTypeGenericInstantiationPreservesInlineForm.js +++ /dev/null @@ -1,24 +0,0 @@ -//// [tests/cases/compiler/mappedTypeGenericInstantiationPreservesInlineForm.ts] //// - -//// [mappedTypeGenericInstantiationPreservesInlineForm.ts] -// repro from #53109 - -export const test1 = >(schema: { - [K in keyof Required]: T[K]; -}) => {} - -export function test2>(schema: { - [K in keyof Required]: T[K]; -}) {}; - - -//// [mappedTypeGenericInstantiationPreservesInlineForm.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.test1 = void 0; -exports.test2 = test2; -// repro from #53109 -const test1 = (schema) => { }; -exports.test1 = test1; -function test2(schema) { } -; diff --git a/testdata/baselines/reference/submodule/compiler/mappedTypeGenericInstantiationPreservesInlineForm.js.diff b/testdata/baselines/reference/submodule/compiler/mappedTypeGenericInstantiationPreservesInlineForm.js.diff index f8675bf9d2..a110162aec 100644 --- a/testdata/baselines/reference/submodule/compiler/mappedTypeGenericInstantiationPreservesInlineForm.js.diff +++ b/testdata/baselines/reference/submodule/compiler/mappedTypeGenericInstantiationPreservesInlineForm.js.diff @@ -1,9 +1,20 @@ --- old.mappedTypeGenericInstantiationPreservesInlineForm.js +++ new.mappedTypeGenericInstantiationPreservesInlineForm.js -@@= skipped -11, +11 lines =@@ - }) {}; - - +@@= skipped -0, +-1 lines =@@ +-//// [tests/cases/compiler/mappedTypeGenericInstantiationPreservesInlineForm.ts] //// +- +-//// [mappedTypeGenericInstantiationPreservesInlineForm.ts] +-// repro from #53109 +- +-export const test1 = >(schema: { +- [K in keyof Required]: T[K]; +-}) => {} +- +-export function test2>(schema: { +- [K in keyof Required]: T[K]; +-}) {}; +- +- - - -//// [mappedTypeGenericInstantiationPreservesInlineForm.d.ts] @@ -11,13 +22,5 @@ -export declare function test2>(schema: { - [K in keyof Required]: T[K]; -}): void; -+//// [mappedTypeGenericInstantiationPreservesInlineForm.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.test1 = void 0; -+exports.test2 = test2; -+// repro from #53109 -+const test1 = (schema) => { }; -+exports.test1 = test1; -+function test2(schema) { } -+; +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/compiler/noCheckDoesNotReportError.js b/testdata/baselines/reference/submodule/compiler/noCheckDoesNotReportError.js deleted file mode 100644 index e75ac456c5..0000000000 --- a/testdata/baselines/reference/submodule/compiler/noCheckDoesNotReportError.js +++ /dev/null @@ -1,11 +0,0 @@ -//// [tests/cases/compiler/noCheckDoesNotReportError.ts] //// - -//// [noCheckDoesNotReportError.ts] -export const a: number = "not ok"; - - -//// [noCheckDoesNotReportError.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.a = void 0; -exports.a = "not ok"; diff --git a/testdata/baselines/reference/submodule/compiler/noCheckDoesNotReportError.js.diff b/testdata/baselines/reference/submodule/compiler/noCheckDoesNotReportError.js.diff index 2a463d1ce3..e6bbaed805 100644 --- a/testdata/baselines/reference/submodule/compiler/noCheckDoesNotReportError.js.diff +++ b/testdata/baselines/reference/submodule/compiler/noCheckDoesNotReportError.js.diff @@ -1,15 +1,15 @@ --- old.noCheckDoesNotReportError.js +++ new.noCheckDoesNotReportError.js -@@= skipped -3, +3 lines =@@ - export const a: number = "not ok"; - - +@@= skipped -0, +-1 lines =@@ +-//// [tests/cases/compiler/noCheckDoesNotReportError.ts] //// +- +-//// [noCheckDoesNotReportError.ts] +-export const a: number = "not ok"; +- +- - - -//// [noCheckDoesNotReportError.d.ts] -export declare const a: number; -+//// [noCheckDoesNotReportError.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.a = void 0; -+exports.a = "not ok"; +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/compiler/outModuleConcatCommonjsDeclarationOnly.js.map b/testdata/baselines/reference/submodule/compiler/outModuleConcatCommonjsDeclarationOnly.js.map deleted file mode 100644 index 4a6226ebe6..0000000000 --- a/testdata/baselines/reference/submodule/compiler/outModuleConcatCommonjsDeclarationOnly.js.map +++ /dev/null @@ -1,4 +0,0 @@ -//// [b.js.map] -{"version":3,"file":"b.js","sourceRoot":"","sources":["b.ts"],"names":[],"mappings":";;;AAAA,+BAA0B;AAC1B,OAAe,SAAQ,KAAC;CAAI"} -//// [a.js.map] -{"version":3,"file":"a.js","sourceRoot":"","sources":["a.ts"],"names":[],"mappings":";;;AAAA;CAAkB"} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/outModuleConcatCommonjsDeclarationOnly.js.map.diff b/testdata/baselines/reference/submodule/compiler/outModuleConcatCommonjsDeclarationOnly.js.map.diff deleted file mode 100644 index e5ed1056e3..0000000000 --- a/testdata/baselines/reference/submodule/compiler/outModuleConcatCommonjsDeclarationOnly.js.map.diff +++ /dev/null @@ -1,9 +0,0 @@ ---- old.outModuleConcatCommonjsDeclarationOnly.js.map -+++ new.outModuleConcatCommonjsDeclarationOnly.js.map -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+//// [b.js.map] -+{"version":3,"file":"b.js","sourceRoot":"","sources":["b.ts"],"names":[],"mappings":";;;AAAA,+BAA0B;AAC1B,OAAe,SAAQ,KAAC;CAAI"} -+//// [a.js.map] -+{"version":3,"file":"a.js","sourceRoot":"","sources":["a.ts"],"names":[],"mappings":";;;AAAA;CAAkB"} diff --git a/testdata/baselines/reference/submodule/compiler/outModuleConcatCommonjsDeclarationOnly.sourcemap.txt b/testdata/baselines/reference/submodule/compiler/outModuleConcatCommonjsDeclarationOnly.sourcemap.txt deleted file mode 100644 index c9be4ffddc..0000000000 --- a/testdata/baselines/reference/submodule/compiler/outModuleConcatCommonjsDeclarationOnly.sourcemap.txt +++ /dev/null @@ -1,70 +0,0 @@ -=================================================================== -JsFile: a.js -mapUrl: a.js.map -sourceRoot: -sources: a.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:ref/a.js -sourceFile:a.ts -------------------------------------------------------------------- ->>>"use strict"; ->>>Object.defineProperty(exports, "__esModule", { value: true }); ->>>exports.A = void 0; ->>>class A { -1 > -2 >^^-> -1 > -1 >Emitted(4, 1) Source(1, 1) + SourceIndex(0) ---- ->>>} -1->^ -2 > ^^^^^^^^^^^^^^-> -1->export class A { } -1->Emitted(5, 2) Source(1, 19) + SourceIndex(0) ---- ->>>exports.A = A; ->>>//# sourceMappingURL=a.js.map=================================================================== -JsFile: b.js -mapUrl: b.js.map -sourceRoot: -sources: b.ts -=================================================================== -------------------------------------------------------------------- -emittedFile:b.js -sourceFile:b.ts -------------------------------------------------------------------- ->>>"use strict"; ->>>Object.defineProperty(exports, "__esModule", { value: true }); ->>>exports.B = void 0; ->>>const a_1 = require("./ref/a"); -1 > -2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 > -2 >import {A} from "./ref/a"; -1 >Emitted(4, 1) Source(1, 1) + SourceIndex(0) -2 >Emitted(4, 32) Source(1, 27) + SourceIndex(0) ---- ->>>class B extends a_1.A { -1 > -2 >^^^^^^^ -3 > ^^^^^^^^^ -4 > ^^^^^ -1 > - > -2 >export class B -3 > extends -4 > A -1 >Emitted(5, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(5, 8) Source(2, 16) + SourceIndex(0) -3 >Emitted(5, 17) Source(2, 24) + SourceIndex(0) -4 >Emitted(5, 22) Source(2, 25) + SourceIndex(0) ---- ->>>} -1 >^ -2 > ^^^^^^^^^^^^^^-> -1 > { } -1 >Emitted(6, 2) Source(2, 29) + SourceIndex(0) ---- ->>>exports.B = B; ->>>//# sourceMappingURL=b.js.map \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/outModuleConcatCommonjsDeclarationOnly.sourcemap.txt.diff b/testdata/baselines/reference/submodule/compiler/outModuleConcatCommonjsDeclarationOnly.sourcemap.txt.diff deleted file mode 100644 index bd0bdaa572..0000000000 --- a/testdata/baselines/reference/submodule/compiler/outModuleConcatCommonjsDeclarationOnly.sourcemap.txt.diff +++ /dev/null @@ -1,75 +0,0 @@ ---- old.outModuleConcatCommonjsDeclarationOnly.sourcemap.txt -+++ new.outModuleConcatCommonjsDeclarationOnly.sourcemap.txt -@@= skipped -0, +-1 lines =@@ -- -@@= skipped --1, +1 lines =@@ -+=================================================================== -+JsFile: a.js -+mapUrl: a.js.map -+sourceRoot: -+sources: a.ts -+=================================================================== -+------------------------------------------------------------------- -+emittedFile:ref/a.js -+sourceFile:a.ts -+------------------------------------------------------------------- -+>>>"use strict"; -+>>>Object.defineProperty(exports, "__esModule", { value: true }); -+>>>exports.A = void 0; -+>>>class A { -+1 > -+2 >^^-> -+1 > -+1 >Emitted(4, 1) Source(1, 1) + SourceIndex(0) -+--- -+>>>} -+1->^ -+2 > ^^^^^^^^^^^^^^-> -+1->export class A { } -+1->Emitted(5, 2) Source(1, 19) + SourceIndex(0) -+--- -+>>>exports.A = A; -+>>>//# sourceMappingURL=a.js.map=================================================================== -+JsFile: b.js -+mapUrl: b.js.map -+sourceRoot: -+sources: b.ts -+=================================================================== -+------------------------------------------------------------------- -+emittedFile:b.js -+sourceFile:b.ts -+------------------------------------------------------------------- -+>>>"use strict"; -+>>>Object.defineProperty(exports, "__esModule", { value: true }); -+>>>exports.B = void 0; -+>>>const a_1 = require("./ref/a"); -+1 > -+2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -+1 > -+2 >import {A} from "./ref/a"; -+1 >Emitted(4, 1) Source(1, 1) + SourceIndex(0) -+2 >Emitted(4, 32) Source(1, 27) + SourceIndex(0) -+--- -+>>>class B extends a_1.A { -+1 > -+2 >^^^^^^^ -+3 > ^^^^^^^^^ -+4 > ^^^^^ -+1 > -+ > -+2 >export class B -+3 > extends -+4 > A -+1 >Emitted(5, 1) Source(2, 1) + SourceIndex(0) -+2 >Emitted(5, 8) Source(2, 16) + SourceIndex(0) -+3 >Emitted(5, 17) Source(2, 24) + SourceIndex(0) -+4 >Emitted(5, 22) Source(2, 25) + SourceIndex(0) -+--- -+>>>} -+1 >^ -+2 > ^^^^^^^^^^^^^^-> -+1 > { } -+1 >Emitted(6, 2) Source(2, 29) + SourceIndex(0) -+--- -+>>>exports.B = B; -+>>>//# sourceMappingURL=b.js.map diff --git a/testdata/baselines/reference/submodule/conformance/ES5For-of36.errors.txt b/testdata/baselines/reference/submodule/conformance/ES5For-of36.errors.txt index 010c3eff21..2c9458b431 100644 --- a/testdata/baselines/reference/submodule/conformance/ES5For-of36.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/ES5For-of36.errors.txt @@ -1,10 +1,10 @@ -ES5For-of36.ts(1,10): error TS2461: Type 'number' is not an array type. +ES5For-of36.ts(1,10): error TS2548: Type 'number' is not an array type or does not have a '[Symbol.iterator]()' method that returns an iterator. ==== ES5For-of36.ts (1 errors) ==== for (let [a = 0, b = 1] of [2, 3]) { ~~~~~~~~~~~~~~ -!!! error TS2461: Type 'number' is not an array type. +!!! error TS2548: Type 'number' is not an array type or does not have a '[Symbol.iterator]()' method that returns an iterator. a; b; } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/ES5For-of36.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/ES5For-of36.errors.txt.diff deleted file mode 100644 index b1602c1c4c..0000000000 --- a/testdata/baselines/reference/submodule/conformance/ES5For-of36.errors.txt.diff +++ /dev/null @@ -1,15 +0,0 @@ ---- old.ES5For-of36.errors.txt -+++ new.ES5For-of36.errors.txt -@@= skipped -0, +0 lines =@@ --ES5For-of36.ts(1,10): error TS2548: Type 'number' is not an array type or does not have a '[Symbol.iterator]()' method that returns an iterator. -+ES5For-of36.ts(1,10): error TS2461: Type 'number' is not an array type. - - - ==== ES5For-of36.ts (1 errors) ==== - for (let [a = 0, b = 1] of [2, 3]) { - ~~~~~~~~~~~~~~ --!!! error TS2548: Type 'number' is not an array type or does not have a '[Symbol.iterator]()' method that returns an iterator. -+!!! error TS2461: Type 'number' is not an array type. - a; - b; - } diff --git a/testdata/baselines/reference/submodule/conformance/destructuringArrayBindingPatternAndAssignment4.errors.txt b/testdata/baselines/reference/submodule/conformance/destructuringArrayBindingPatternAndAssignment4.errors.txt deleted file mode 100644 index 7828a32e85..0000000000 --- a/testdata/baselines/reference/submodule/conformance/destructuringArrayBindingPatternAndAssignment4.errors.txt +++ /dev/null @@ -1,12 +0,0 @@ -destructuringArrayBindingPatternAndAssignment4.ts(5,7): error TS2802: Type 'number[] | null' can only be iterated through when using the '--downlevelIteration' flag or with a '--target' of 'es2015' or higher. - - -==== destructuringArrayBindingPatternAndAssignment4.ts (1 errors) ==== - // #35497 - - - declare const data: number[] | null; - const [value] = data; // Error - ~~~~~~~ -!!! error TS2802: Type 'number[] | null' can only be iterated through when using the '--downlevelIteration' flag or with a '--target' of 'es2015' or higher. - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/destructuringArrayBindingPatternAndAssignment4.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/destructuringArrayBindingPatternAndAssignment4.errors.txt.diff index 7393b19a90..2353e31da4 100644 --- a/testdata/baselines/reference/submodule/conformance/destructuringArrayBindingPatternAndAssignment4.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/destructuringArrayBindingPatternAndAssignment4.errors.txt.diff @@ -1,15 +1,17 @@ --- old.destructuringArrayBindingPatternAndAssignment4.errors.txt +++ new.destructuringArrayBindingPatternAndAssignment4.errors.txt -@@= skipped -0, +0 lines =@@ +@@= skipped -0, +-1 lines =@@ -destructuringArrayBindingPatternAndAssignment4.ts(5,7): error TS2548: Type 'number[] | null' is not an array type or does not have a '[Symbol.iterator]()' method that returns an iterator. -+destructuringArrayBindingPatternAndAssignment4.ts(5,7): error TS2802: Type 'number[] | null' can only be iterated through when using the '--downlevelIteration' flag or with a '--target' of 'es2015' or higher. - - - ==== destructuringArrayBindingPatternAndAssignment4.ts (1 errors) ==== -@@= skipped -7, +7 lines =@@ - declare const data: number[] | null; - const [value] = data; // Error - ~~~~~~~ +- +- +-==== destructuringArrayBindingPatternAndAssignment4.ts (1 errors) ==== +- // #35497 +- +- +- declare const data: number[] | null; +- const [value] = data; // Error +- ~~~~~~~ -!!! error TS2548: Type 'number[] | null' is not an array type or does not have a '[Symbol.iterator]()' method that returns an iterator. -+!!! error TS2802: Type 'number[] | null' can only be iterated through when using the '--downlevelIteration' flag or with a '--target' of 'es2015' or higher. - +- +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/conformance/destructuringArrayBindingPatternAndAssignment4.types b/testdata/baselines/reference/submodule/conformance/destructuringArrayBindingPatternAndAssignment4.types index 8eec04be85..50fab237f3 100644 --- a/testdata/baselines/reference/submodule/conformance/destructuringArrayBindingPatternAndAssignment4.types +++ b/testdata/baselines/reference/submodule/conformance/destructuringArrayBindingPatternAndAssignment4.types @@ -8,6 +8,6 @@ declare const data: number[] | null; >data : number[] | null const [value] = data; // Error ->value : any +>value : number >data : number[] | null diff --git a/testdata/baselines/reference/submodule/conformance/destructuringArrayBindingPatternAndAssignment4.types.diff b/testdata/baselines/reference/submodule/conformance/destructuringArrayBindingPatternAndAssignment4.types.diff new file mode 100644 index 0000000000..6193e4fb8a --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/destructuringArrayBindingPatternAndAssignment4.types.diff @@ -0,0 +1,10 @@ +--- old.destructuringArrayBindingPatternAndAssignment4.types ++++ new.destructuringArrayBindingPatternAndAssignment4.types +@@= skipped -7, +7 lines =@@ + >data : number[] | null + + const [value] = data; // Error +->value : any ++>value : number + >data : number[] | null + diff --git a/testdata/baselines/reference/submodule/conformance/leaveOptionalParameterAsWritten.js b/testdata/baselines/reference/submodule/conformance/leaveOptionalParameterAsWritten.js deleted file mode 100644 index 46bdbd9417..0000000000 --- a/testdata/baselines/reference/submodule/conformance/leaveOptionalParameterAsWritten.js +++ /dev/null @@ -1,25 +0,0 @@ -//// [tests/cases/conformance/declarationEmit/leaveOptionalParameterAsWritten.ts] //// - -//// [a.ts] -export interface Foo {} - -//// [b.ts] -import * as a from "./a"; -declare global { - namespace teams { - export namespace calling { - export import Foo = a.Foo; - } - } -} - -//// [c.ts] -type Foo = teams.calling.Foo; -export const bar = (p?: Foo) => {} - -//// [a.js] -export {}; -//// [b.js] -export {}; -//// [c.js] -export const bar = (p) => { }; diff --git a/testdata/baselines/reference/submodule/conformance/leaveOptionalParameterAsWritten.js.diff b/testdata/baselines/reference/submodule/conformance/leaveOptionalParameterAsWritten.js.diff index c65129c782..fb494b6c0c 100644 --- a/testdata/baselines/reference/submodule/conformance/leaveOptionalParameterAsWritten.js.diff +++ b/testdata/baselines/reference/submodule/conformance/leaveOptionalParameterAsWritten.js.diff @@ -1,9 +1,25 @@ --- old.leaveOptionalParameterAsWritten.js +++ new.leaveOptionalParameterAsWritten.js -@@= skipped -16, +16 lines =@@ - type Foo = teams.calling.Foo; - export const bar = (p?: Foo) => {} - +@@= skipped -0, +-1 lines =@@ +-//// [tests/cases/conformance/declarationEmit/leaveOptionalParameterAsWritten.ts] //// +- +-//// [a.ts] +-export interface Foo {} +- +-//// [b.ts] +-import * as a from "./a"; +-declare global { +- namespace teams { +- export namespace calling { +- export import Foo = a.Foo; +- } +- } +-} +- +-//// [c.ts] +-type Foo = teams.calling.Foo; +-export const bar = (p?: Foo) => {} +- - - -//// [a.d.ts] @@ -21,9 +37,6 @@ -//// [c.d.ts] -type Foo = teams.calling.Foo; -export declare const bar: (p?: Foo) => void; -+//// [a.js] - export {}; -+//// [b.js] -+export {}; -+//// [c.js] -+export const bar = (p) => { }; +-export {}; +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/conformance/resolutionModeTripleSlash2.js b/testdata/baselines/reference/submodule/conformance/resolutionModeTripleSlash2.js deleted file mode 100644 index d40d630b01..0000000000 --- a/testdata/baselines/reference/submodule/conformance/resolutionModeTripleSlash2.js +++ /dev/null @@ -1,41 +0,0 @@ -//// [tests/cases/conformance/moduleResolution/resolutionModeTripleSlash2.ts] //// - -//// [package.json] -{ - "name": "@types/foo", - "version": "1.0.0", - "exports": { - ".": { - "import": "./index.d.mts", - "require": "./index.d.cts" - } - } -} - -//// [index.d.mts] -export {}; -declare global { - const MODULE: any; -} - -//// [index.d.cts] -export {}; -declare global { - const SCRIPT: any; -} - -//// [app.ts] -/// -MODULE; // error -SCRIPT; // ok -function foo() { - return SCRIPT; -} - -//// [app.js] -/// -MODULE; // error -SCRIPT; // ok -function foo() { - return SCRIPT; -} diff --git a/testdata/baselines/reference/submodule/conformance/resolutionModeTripleSlash2.js.diff b/testdata/baselines/reference/submodule/conformance/resolutionModeTripleSlash2.js.diff index c7698974a2..b80eb5815c 100644 --- a/testdata/baselines/reference/submodule/conformance/resolutionModeTripleSlash2.js.diff +++ b/testdata/baselines/reference/submodule/conformance/resolutionModeTripleSlash2.js.diff @@ -1,17 +1,43 @@ --- old.resolutionModeTripleSlash2.js +++ new.resolutionModeTripleSlash2.js -@@= skipped -31, +31 lines =@@ - return SCRIPT; - } - +@@= skipped -0, +-1 lines =@@ +-//// [tests/cases/conformance/moduleResolution/resolutionModeTripleSlash2.ts] //// +- +-//// [package.json] +-{ +- "name": "@types/foo", +- "version": "1.0.0", +- "exports": { +- ".": { +- "import": "./index.d.mts", +- "require": "./index.d.cts" +- } +- } +-} +- +-//// [index.d.mts] +-export {}; +-declare global { +- const MODULE: any; +-} +- +-//// [index.d.cts] +-export {}; +-declare global { +- const SCRIPT: any; +-} +- +-//// [app.ts] +-/// +-MODULE; // error +-SCRIPT; // ok +-function foo() { +- return SCRIPT; +-} +- - - -//// [app.d.ts] -declare function foo(): any; -+//// [app.js] -+/// -+MODULE; // error -+SCRIPT; // ok -+function foo() { -+ return SCRIPT; -+} +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/conformance/resolutionModeTypeOnlyImport1(moduleresolution=bundler).js b/testdata/baselines/reference/submodule/conformance/resolutionModeTypeOnlyImport1(moduleresolution=bundler).js deleted file mode 100644 index 570b2f4e51..0000000000 --- a/testdata/baselines/reference/submodule/conformance/resolutionModeTypeOnlyImport1(moduleresolution=bundler).js +++ /dev/null @@ -1,50 +0,0 @@ -//// [tests/cases/conformance/moduleResolution/resolutionModeTypeOnlyImport1.ts] //// - -//// [package.json] -{ - "name": "@types/foo", - "version": "1.0.0", - "exports": { - ".": { - "import": "./index.d.mts", - "require": "./index.d.cts" - } - } -} - -//// [index.d.mts] -export declare const x: "module"; - -//// [index.d.cts] -export declare const x: "script"; - -//// [app.ts] -import type { x as Default } from "foo"; -import type { x as Import } from "foo" assert { "resolution-mode": "import" }; -import type { x as Require } from "foo" assert { "resolution-mode": "require" }; -type _Default = typeof Default; -type _Import = typeof Import; -type _Require = typeof Require; - -// resolution-mode does not enforce file extension in `bundler`, just sets conditions -import type { x as ImportRelative } from "./other" assert { "resolution-mode": "import" }; -import type { x as RequireRelative } from "./other" assert { "resolution-mode": "require" }; -type _ImportRelative = typeof ImportRelative; -type _RequireRelative = typeof RequireRelative; - -export { - _Default, - _Import, - _Require, - _ImportRelative, - _RequireRelative -} - -//// [other.ts] -export const x = "other"; - - -//// [other.js] -export const x = "other"; -//// [app.js] -export {}; diff --git a/testdata/baselines/reference/submodule/conformance/resolutionModeTypeOnlyImport1(moduleresolution=bundler).js.diff b/testdata/baselines/reference/submodule/conformance/resolutionModeTypeOnlyImport1(moduleresolution=bundler).js.diff index 38b9910853..0ca91a00aa 100644 --- a/testdata/baselines/reference/submodule/conformance/resolutionModeTypeOnlyImport1(moduleresolution=bundler).js.diff +++ b/testdata/baselines/reference/submodule/conformance/resolutionModeTypeOnlyImport1(moduleresolution=bundler).js.diff @@ -1,9 +1,52 @@ --- old.resolutionModeTypeOnlyImport1(moduleresolution=bundler).js +++ new.resolutionModeTypeOnlyImport1(moduleresolution=bundler).js -@@= skipped -43, +43 lines =@@ - export const x = "other"; - - +@@= skipped -0, +-1 lines =@@ +-//// [tests/cases/conformance/moduleResolution/resolutionModeTypeOnlyImport1.ts] //// +- +-//// [package.json] +-{ +- "name": "@types/foo", +- "version": "1.0.0", +- "exports": { +- ".": { +- "import": "./index.d.mts", +- "require": "./index.d.cts" +- } +- } +-} +- +-//// [index.d.mts] +-export declare const x: "module"; +- +-//// [index.d.cts] +-export declare const x: "script"; +- +-//// [app.ts] +-import type { x as Default } from "foo"; +-import type { x as Import } from "foo" assert { "resolution-mode": "import" }; +-import type { x as Require } from "foo" assert { "resolution-mode": "require" }; +-type _Default = typeof Default; +-type _Import = typeof Import; +-type _Require = typeof Require; +- +-// resolution-mode does not enforce file extension in `bundler`, just sets conditions +-import type { x as ImportRelative } from "./other" assert { "resolution-mode": "import" }; +-import type { x as RequireRelative } from "./other" assert { "resolution-mode": "require" }; +-type _ImportRelative = typeof ImportRelative; +-type _RequireRelative = typeof RequireRelative; +- +-export { +- _Default, +- _Import, +- _Require, +- _ImportRelative, +- _RequireRelative +-} +- +-//// [other.ts] +-export const x = "other"; +- +- - - -//// [other.d.ts] @@ -20,7 +63,5 @@ -type _ImportRelative = typeof ImportRelative; -type _RequireRelative = typeof RequireRelative; -export { _Default, _Import, _Require, _ImportRelative, _RequireRelative }; -+//// [other.js] -+export const x = "other"; -+//// [app.js] -+export {}; +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/conformance/resolutionModeTypeOnlyImport1(moduleresolution=classic).js b/testdata/baselines/reference/submodule/conformance/resolutionModeTypeOnlyImport1(moduleresolution=classic).js deleted file mode 100644 index 570b2f4e51..0000000000 --- a/testdata/baselines/reference/submodule/conformance/resolutionModeTypeOnlyImport1(moduleresolution=classic).js +++ /dev/null @@ -1,50 +0,0 @@ -//// [tests/cases/conformance/moduleResolution/resolutionModeTypeOnlyImport1.ts] //// - -//// [package.json] -{ - "name": "@types/foo", - "version": "1.0.0", - "exports": { - ".": { - "import": "./index.d.mts", - "require": "./index.d.cts" - } - } -} - -//// [index.d.mts] -export declare const x: "module"; - -//// [index.d.cts] -export declare const x: "script"; - -//// [app.ts] -import type { x as Default } from "foo"; -import type { x as Import } from "foo" assert { "resolution-mode": "import" }; -import type { x as Require } from "foo" assert { "resolution-mode": "require" }; -type _Default = typeof Default; -type _Import = typeof Import; -type _Require = typeof Require; - -// resolution-mode does not enforce file extension in `bundler`, just sets conditions -import type { x as ImportRelative } from "./other" assert { "resolution-mode": "import" }; -import type { x as RequireRelative } from "./other" assert { "resolution-mode": "require" }; -type _ImportRelative = typeof ImportRelative; -type _RequireRelative = typeof RequireRelative; - -export { - _Default, - _Import, - _Require, - _ImportRelative, - _RequireRelative -} - -//// [other.ts] -export const x = "other"; - - -//// [other.js] -export const x = "other"; -//// [app.js] -export {}; diff --git a/testdata/baselines/reference/submodule/conformance/resolutionModeTypeOnlyImport1(moduleresolution=classic).js.diff b/testdata/baselines/reference/submodule/conformance/resolutionModeTypeOnlyImport1(moduleresolution=classic).js.diff index 1d81ee7942..4329962b08 100644 --- a/testdata/baselines/reference/submodule/conformance/resolutionModeTypeOnlyImport1(moduleresolution=classic).js.diff +++ b/testdata/baselines/reference/submodule/conformance/resolutionModeTypeOnlyImport1(moduleresolution=classic).js.diff @@ -1,9 +1,52 @@ --- old.resolutionModeTypeOnlyImport1(moduleresolution=classic).js +++ new.resolutionModeTypeOnlyImport1(moduleresolution=classic).js -@@= skipped -43, +43 lines =@@ - export const x = "other"; - - +@@= skipped -0, +-1 lines =@@ +-//// [tests/cases/conformance/moduleResolution/resolutionModeTypeOnlyImport1.ts] //// +- +-//// [package.json] +-{ +- "name": "@types/foo", +- "version": "1.0.0", +- "exports": { +- ".": { +- "import": "./index.d.mts", +- "require": "./index.d.cts" +- } +- } +-} +- +-//// [index.d.mts] +-export declare const x: "module"; +- +-//// [index.d.cts] +-export declare const x: "script"; +- +-//// [app.ts] +-import type { x as Default } from "foo"; +-import type { x as Import } from "foo" assert { "resolution-mode": "import" }; +-import type { x as Require } from "foo" assert { "resolution-mode": "require" }; +-type _Default = typeof Default; +-type _Import = typeof Import; +-type _Require = typeof Require; +- +-// resolution-mode does not enforce file extension in `bundler`, just sets conditions +-import type { x as ImportRelative } from "./other" assert { "resolution-mode": "import" }; +-import type { x as RequireRelative } from "./other" assert { "resolution-mode": "require" }; +-type _ImportRelative = typeof ImportRelative; +-type _RequireRelative = typeof RequireRelative; +- +-export { +- _Default, +- _Import, +- _Require, +- _ImportRelative, +- _RequireRelative +-} +- +-//// [other.ts] +-export const x = "other"; +- +- - - -//// [other.d.ts] @@ -20,7 +63,5 @@ -type _ImportRelative = typeof ImportRelative; -type _RequireRelative = typeof RequireRelative; -export { _Default, _Import, _Require, _ImportRelative, _RequireRelative }; -+//// [other.js] -+export const x = "other"; -+//// [app.js] -+export {}; +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/conformance/resolutionModeTypeOnlyImport1(moduleresolution=node10).js b/testdata/baselines/reference/submodule/conformance/resolutionModeTypeOnlyImport1(moduleresolution=node10).js deleted file mode 100644 index 570b2f4e51..0000000000 --- a/testdata/baselines/reference/submodule/conformance/resolutionModeTypeOnlyImport1(moduleresolution=node10).js +++ /dev/null @@ -1,50 +0,0 @@ -//// [tests/cases/conformance/moduleResolution/resolutionModeTypeOnlyImport1.ts] //// - -//// [package.json] -{ - "name": "@types/foo", - "version": "1.0.0", - "exports": { - ".": { - "import": "./index.d.mts", - "require": "./index.d.cts" - } - } -} - -//// [index.d.mts] -export declare const x: "module"; - -//// [index.d.cts] -export declare const x: "script"; - -//// [app.ts] -import type { x as Default } from "foo"; -import type { x as Import } from "foo" assert { "resolution-mode": "import" }; -import type { x as Require } from "foo" assert { "resolution-mode": "require" }; -type _Default = typeof Default; -type _Import = typeof Import; -type _Require = typeof Require; - -// resolution-mode does not enforce file extension in `bundler`, just sets conditions -import type { x as ImportRelative } from "./other" assert { "resolution-mode": "import" }; -import type { x as RequireRelative } from "./other" assert { "resolution-mode": "require" }; -type _ImportRelative = typeof ImportRelative; -type _RequireRelative = typeof RequireRelative; - -export { - _Default, - _Import, - _Require, - _ImportRelative, - _RequireRelative -} - -//// [other.ts] -export const x = "other"; - - -//// [other.js] -export const x = "other"; -//// [app.js] -export {}; diff --git a/testdata/baselines/reference/submodule/conformance/resolutionModeTypeOnlyImport1(moduleresolution=node10).js.diff b/testdata/baselines/reference/submodule/conformance/resolutionModeTypeOnlyImport1(moduleresolution=node10).js.diff index bf8d3db27e..a36fb916f1 100644 --- a/testdata/baselines/reference/submodule/conformance/resolutionModeTypeOnlyImport1(moduleresolution=node10).js.diff +++ b/testdata/baselines/reference/submodule/conformance/resolutionModeTypeOnlyImport1(moduleresolution=node10).js.diff @@ -1,9 +1,52 @@ --- old.resolutionModeTypeOnlyImport1(moduleresolution=node10).js +++ new.resolutionModeTypeOnlyImport1(moduleresolution=node10).js -@@= skipped -43, +43 lines =@@ - export const x = "other"; - - +@@= skipped -0, +-1 lines =@@ +-//// [tests/cases/conformance/moduleResolution/resolutionModeTypeOnlyImport1.ts] //// +- +-//// [package.json] +-{ +- "name": "@types/foo", +- "version": "1.0.0", +- "exports": { +- ".": { +- "import": "./index.d.mts", +- "require": "./index.d.cts" +- } +- } +-} +- +-//// [index.d.mts] +-export declare const x: "module"; +- +-//// [index.d.cts] +-export declare const x: "script"; +- +-//// [app.ts] +-import type { x as Default } from "foo"; +-import type { x as Import } from "foo" assert { "resolution-mode": "import" }; +-import type { x as Require } from "foo" assert { "resolution-mode": "require" }; +-type _Default = typeof Default; +-type _Import = typeof Import; +-type _Require = typeof Require; +- +-// resolution-mode does not enforce file extension in `bundler`, just sets conditions +-import type { x as ImportRelative } from "./other" assert { "resolution-mode": "import" }; +-import type { x as RequireRelative } from "./other" assert { "resolution-mode": "require" }; +-type _ImportRelative = typeof ImportRelative; +-type _RequireRelative = typeof RequireRelative; +- +-export { +- _Default, +- _Import, +- _Require, +- _ImportRelative, +- _RequireRelative +-} +- +-//// [other.ts] +-export const x = "other"; +- +- - - -//// [other.d.ts] @@ -20,7 +63,5 @@ -type _ImportRelative = typeof ImportRelative; -type _RequireRelative = typeof RequireRelative; -export { _Default, _Import, _Require, _ImportRelative, _RequireRelative }; -+//// [other.js] -+export const x = "other"; -+//// [app.js] -+export {}; +@@= skipped --1, +1 lines =@@ ++ diff --git a/testdata/baselines/reference/submodule/conformance/weakTypesAndLiterals01.js b/testdata/baselines/reference/submodule/conformance/weakTypesAndLiterals01.js deleted file mode 100644 index 55e9f25398..0000000000 --- a/testdata/baselines/reference/submodule/conformance/weakTypesAndLiterals01.js +++ /dev/null @@ -1,85 +0,0 @@ -//// [tests/cases/conformance/types/typeRelationships/comparable/weakTypesAndLiterals01.ts] //// - -//// [weakTypesAndLiterals01.ts] -type WeakTypes = - | { optional?: true; } - | { toLowerCase?(): string } - | { toUpperCase?(): string, otherOptionalProp?: number }; - -type LiteralsOrWeakTypes = - | "A" - | "B" - | WeakTypes; - -declare let aOrB: "A" | "B"; - -const f = (arg: LiteralsOrWeakTypes) => { - if (arg === "A") { - return arg; - } - else { - return arg; - } -} - -const g = (arg: WeakTypes) => { - if (arg === "A") { - return arg; - } - else { - return arg; - } -} - -const h = (arg: LiteralsOrWeakTypes) => { - if (arg === aOrB) { - return arg; - } - else { - return arg; - } -} - -const i = (arg: WeakTypes) => { - if (arg === aOrB) { - return arg; - } - else { - return arg; - } -} - - -//// [weakTypesAndLiterals01.js] -const f = (arg) => { - if (arg === "A") { - return arg; - } - else { - return arg; - } -}; -const g = (arg) => { - if (arg === "A") { - return arg; - } - else { - return arg; - } -}; -const h = (arg) => { - if (arg === aOrB) { - return arg; - } - else { - return arg; - } -}; -const i = (arg) => { - if (arg === aOrB) { - return arg; - } - else { - return arg; - } -}; diff --git a/testdata/baselines/reference/submodule/conformance/weakTypesAndLiterals01.js.diff b/testdata/baselines/reference/submodule/conformance/weakTypesAndLiterals01.js.diff index f141d63c22..ff5d78322f 100644 --- a/testdata/baselines/reference/submodule/conformance/weakTypesAndLiterals01.js.diff +++ b/testdata/baselines/reference/submodule/conformance/weakTypesAndLiterals01.js.diff @@ -1,9 +1,58 @@ --- old.weakTypesAndLiterals01.js +++ new.weakTypesAndLiterals01.js -@@= skipped -49, +49 lines =@@ - } - - +@@= skipped -0, +-1 lines =@@ +-//// [tests/cases/conformance/types/typeRelationships/comparable/weakTypesAndLiterals01.ts] //// +- +-//// [weakTypesAndLiterals01.ts] +-type WeakTypes = +- | { optional?: true; } +- | { toLowerCase?(): string } +- | { toUpperCase?(): string, otherOptionalProp?: number }; +- +-type LiteralsOrWeakTypes = +- | "A" +- | "B" +- | WeakTypes; +- +-declare let aOrB: "A" | "B"; +- +-const f = (arg: LiteralsOrWeakTypes) => { +- if (arg === "A") { +- return arg; +- } +- else { +- return arg; +- } +-} +- +-const g = (arg: WeakTypes) => { +- if (arg === "A") { +- return arg; +- } +- else { +- return arg; +- } +-} +- +-const h = (arg: LiteralsOrWeakTypes) => { +- if (arg === aOrB) { +- return arg; +- } +- else { +- return arg; +- } +-} +- +-const i = (arg: WeakTypes) => { +- if (arg === aOrB) { +- return arg; +- } +- else { +- return arg; +- } +-} +- +- - - -//// [weakTypesAndLiterals01.d.ts] @@ -14,42 +63,12 @@ -} | { - toUpperCase?(): string; - otherOptionalProp?: number; -+//// [weakTypesAndLiterals01.js] -+const f = (arg) => { -+ if (arg === "A") { -+ return arg; -+ } -+ else { -+ return arg; -+ } - }; +-}; -type LiteralsOrWeakTypes = "A" | "B" | WeakTypes; -declare let aOrB: "A" | "B"; -declare const f: (arg: LiteralsOrWeakTypes) => "A" | "B" | WeakTypes; -declare const g: (arg: WeakTypes) => WeakTypes; -declare const h: (arg: LiteralsOrWeakTypes) => LiteralsOrWeakTypes; -declare const i: (arg: WeakTypes) => WeakTypes; -+const g = (arg) => { -+ if (arg === "A") { -+ return arg; -+ } -+ else { -+ return arg; -+ } -+}; -+const h = (arg) => { -+ if (arg === aOrB) { -+ return arg; -+ } -+ else { -+ return arg; -+ } -+}; -+const i = (arg) => { -+ if (arg === aOrB) { -+ return arg; -+ } -+ else { -+ return arg; -+ } -+}; +@@= skipped --1, +1 lines =@@ ++