diff --git a/internal/checker/nodebuilderimpl.go b/internal/checker/nodebuilderimpl.go index afdc9494d7..aa15c4d586 100644 --- a/internal/checker/nodebuilderimpl.go +++ b/internal/checker/nodebuilderimpl.go @@ -1693,8 +1693,7 @@ type SignatureToSignatureDeclarationOptions struct { func (b *nodeBuilderImpl) signatureToSignatureDeclarationHelper(signature *Signature, kind ast.Kind, options *SignatureToSignatureDeclarationOptions) *ast.Node { var typeParameters []*ast.Node - expandedParams := b.ch.getExpandedParameters(signature, true /*skipUnionExpanding*/)[0] - cleanup := b.enterNewScope(signature.declaration, expandedParams, signature.typeParameters, signature.parameters, signature.mapper) + cleanup := b.enterNewScope(signature.declaration, signature.parameters, signature.typeParameters, signature.parameters, signature.mapper) b.ctx.approximateLength += 3 // Usually a signature contributes a few more characters than this, but 3 is the minimum @@ -1710,10 +1709,7 @@ func (b *nodeBuilderImpl) signatureToSignatureDeclarationHelper(signature *Signa restoreFlags := b.saveRestoreFlags() b.ctx.flags &^= nodebuilder.FlagsSuppressAnyReturnType - // If the expanded parameter list had a variadic in a non-trailing position, don't expand it - parameters := core.Map(core.IfElse(core.Some(expandedParams, func(p *ast.Symbol) bool { - return p != expandedParams[len(expandedParams)-1] && p.CheckFlags&ast.CheckFlagsRestParameter != 0 - }), signature.parameters, expandedParams), func(parameter *ast.Symbol) *ast.Node { + parameters := core.Map(signature.parameters, func(parameter *ast.Symbol) *ast.Node { return b.symbolToParameterDeclaration(parameter, kind == ast.KindConstructor) }) var thisParameter *ast.Node diff --git a/testdata/baselines/reference/submodule/compiler/argumentsSpreadRestIterables(target=es5).types b/testdata/baselines/reference/submodule/compiler/argumentsSpreadRestIterables(target=es5).types index 86d42676f7..7a4cfe4e5f 100644 --- a/testdata/baselines/reference/submodule/compiler/argumentsSpreadRestIterables(target=es5).types +++ b/testdata/baselines/reference/submodule/compiler/argumentsSpreadRestIterables(target=es5).types @@ -24,8 +24,8 @@ declare const itNum: Iterable ;(function(a, ...rest) {})('', true, ...itNum) >(function(a, ...rest) {})('', true, ...itNum) : void ->(function(a, ...rest) {}) : (a: string, rest_0: boolean, ...rest: Iterable[]) => void ->function(a, ...rest) {} : (a: string, rest_0: boolean, ...rest: Iterable[]) => void +>(function(a, ...rest) {}) : (a: string, ...rest: [boolean, ...Iterable[]]) => void +>function(a, ...rest) {} : (a: string, ...rest: [boolean, ...Iterable[]]) => void >a : string >rest : [boolean, ...Iterable[]] >'' : "" diff --git a/testdata/baselines/reference/submodule/compiler/argumentsSpreadRestIterables(target=es5).types.diff b/testdata/baselines/reference/submodule/compiler/argumentsSpreadRestIterables(target=es5).types.diff new file mode 100644 index 0000000000..f9be207508 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/argumentsSpreadRestIterables(target=es5).types.diff @@ -0,0 +1,13 @@ +--- old.argumentsSpreadRestIterables(target=es5).types ++++ new.argumentsSpreadRestIterables(target=es5).types +@@= skipped -23, +23 lines =@@ + + ;(function(a, ...rest) {})('', true, ...itNum) + >(function(a, ...rest) {})('', true, ...itNum) : void +->(function(a, ...rest) {}) : (a: string, rest_0: boolean, ...rest: Iterable[]) => void +->function(a, ...rest) {} : (a: string, rest_0: boolean, ...rest: Iterable[]) => void ++>(function(a, ...rest) {}) : (a: string, ...rest: [boolean, ...Iterable[]]) => void ++>function(a, ...rest) {} : (a: string, ...rest: [boolean, ...Iterable[]]) => void + >a : string + >rest : [boolean, ...Iterable[]] + >'' : "" \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/argumentsSpreadRestIterables(target=esnext).types b/testdata/baselines/reference/submodule/compiler/argumentsSpreadRestIterables(target=esnext).types index bb4940e6d4..b62a0af84c 100644 --- a/testdata/baselines/reference/submodule/compiler/argumentsSpreadRestIterables(target=esnext).types +++ b/testdata/baselines/reference/submodule/compiler/argumentsSpreadRestIterables(target=esnext).types @@ -24,8 +24,8 @@ declare const itNum: Iterable ;(function(a, ...rest) {})('', true, ...itNum) >(function(a, ...rest) {})('', true, ...itNum) : void ->(function(a, ...rest) {}) : (a: string, rest_0: boolean, ...rest: number[]) => void ->function(a, ...rest) {} : (a: string, rest_0: boolean, ...rest: number[]) => void +>(function(a, ...rest) {}) : (a: string, ...rest: [boolean, ...number[]]) => void +>function(a, ...rest) {} : (a: string, ...rest: [boolean, ...number[]]) => void >a : string >rest : [boolean, ...number[]] >'' : "" diff --git a/testdata/baselines/reference/submodule/compiler/argumentsSpreadRestIterables(target=esnext).types.diff b/testdata/baselines/reference/submodule/compiler/argumentsSpreadRestIterables(target=esnext).types.diff new file mode 100644 index 0000000000..056e5e9fe2 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/argumentsSpreadRestIterables(target=esnext).types.diff @@ -0,0 +1,13 @@ +--- old.argumentsSpreadRestIterables(target=esnext).types ++++ new.argumentsSpreadRestIterables(target=esnext).types +@@= skipped -23, +23 lines =@@ + + ;(function(a, ...rest) {})('', true, ...itNum) + >(function(a, ...rest) {})('', true, ...itNum) : void +->(function(a, ...rest) {}) : (a: string, rest_0: boolean, ...rest: number[]) => void +->function(a, ...rest) {} : (a: string, rest_0: boolean, ...rest: number[]) => void ++>(function(a, ...rest) {}) : (a: string, ...rest: [boolean, ...number[]]) => void ++>function(a, ...rest) {} : (a: string, ...rest: [boolean, ...number[]]) => void + >a : string + >rest : [boolean, ...number[]] + >'' : "" \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/bindingPatternCannotBeOnlyInferenceSource.types b/testdata/baselines/reference/submodule/compiler/bindingPatternCannotBeOnlyInferenceSource.types index 9f518a22fe..970727e6c4 100644 --- a/testdata/baselines/reference/submodule/compiler/bindingPatternCannotBeOnlyInferenceSource.types +++ b/testdata/baselines/reference/submodule/compiler/bindingPatternCannotBeOnlyInferenceSource.types @@ -76,19 +76,19 @@ declare function useReduxDispatch1>(destructur >destructuring : Destructuring<{ funcA: (a: boolean) => void; funcB: (b: string, bb: string) => void; funcC: (c: number, cc: number, ccc: boolean) => void; }, T> const {} = useReduxDispatch1( ->useReduxDispatch1( (d, f) => ({ funcA: (...p) => d(f.funcA(...p)), // p should be inferrable funcB: (...p) => d(f.funcB(...p)), funcC: (...p) => d(f.funcC(...p)), })) : { funcA: (a: boolean) => void; funcB: (b: string, bb: string) => void; funcC: (c: number, cc: number, ccc: boolean) => void; } +>useReduxDispatch1( (d, f) => ({ funcA: (...p) => d(f.funcA(...p)), // p should be inferrable funcB: (...p) => d(f.funcB(...p)), funcC: (...p) => d(f.funcC(...p)), })) : { funcA: (...p: [a: boolean]) => void; funcB: (...p: [b: string, bb: string]) => void; funcC: (...p: [c: number, cc: number, ccc: boolean]) => void; } >useReduxDispatch1 : void; funcB: (b: string, bb: string) => void; funcC: (c: number, cc: number, ccc: boolean) => void; }>>(destructuring: Destructuring<{ funcA: (a: boolean) => void; funcB: (b: string, bb: string) => void; funcC: (c: number, cc: number, ccc: boolean) => void; }, T>) => T (d, f) => ({ ->(d, f) => ({ funcA: (...p) => d(f.funcA(...p)), // p should be inferrable funcB: (...p) => d(f.funcB(...p)), funcC: (...p) => d(f.funcC(...p)), }) : (d: Dispatch, f: { funcA: (a: boolean) => void; funcB: (b: string, bb: string) => void; funcC: (c: number, cc: number, ccc: boolean) => void; }) => { funcA: (a: boolean) => void; funcB: (b: string, bb: string) => void; funcC: (c: number, cc: number, ccc: boolean) => void; } +>(d, f) => ({ funcA: (...p) => d(f.funcA(...p)), // p should be inferrable funcB: (...p) => d(f.funcB(...p)), funcC: (...p) => d(f.funcC(...p)), }) : (d: Dispatch, f: { funcA: (a: boolean) => void; funcB: (b: string, bb: string) => void; funcC: (c: number, cc: number, ccc: boolean) => void; }) => { funcA: (...p: [a: boolean]) => void; funcB: (...p: [b: string, bb: string]) => void; funcC: (...p: [c: number, cc: number, ccc: boolean]) => void; } >d : Dispatch >f : { funcA: (a: boolean) => void; funcB: (b: string, bb: string) => void; funcC: (c: number, cc: number, ccc: boolean) => void; } ->({ funcA: (...p) => d(f.funcA(...p)), // p should be inferrable funcB: (...p) => d(f.funcB(...p)), funcC: (...p) => d(f.funcC(...p)), }) : { funcA: (a: boolean) => void; funcB: (b: string, bb: string) => void; funcC: (c: number, cc: number, ccc: boolean) => void; } ->{ funcA: (...p) => d(f.funcA(...p)), // p should be inferrable funcB: (...p) => d(f.funcB(...p)), funcC: (...p) => d(f.funcC(...p)), } : { funcA: (a: boolean) => void; funcB: (b: string, bb: string) => void; funcC: (c: number, cc: number, ccc: boolean) => void; } +>({ funcA: (...p) => d(f.funcA(...p)), // p should be inferrable funcB: (...p) => d(f.funcB(...p)), funcC: (...p) => d(f.funcC(...p)), }) : { funcA: (...p: [a: boolean]) => void; funcB: (...p: [b: string, bb: string]) => void; funcC: (...p: [c: number, cc: number, ccc: boolean]) => void; } +>{ funcA: (...p) => d(f.funcA(...p)), // p should be inferrable funcB: (...p) => d(f.funcB(...p)), funcC: (...p) => d(f.funcC(...p)), } : { funcA: (...p: [a: boolean]) => void; funcB: (...p: [b: string, bb: string]) => void; funcC: (...p: [c: number, cc: number, ccc: boolean]) => void; } funcA: (...p) => d(f.funcA(...p)), // p should be inferrable ->funcA : (a: boolean) => void ->(...p) => d(f.funcA(...p)) : (a: boolean) => void +>funcA : (...p: [a: boolean]) => void +>(...p) => d(f.funcA(...p)) : (...p: [a: boolean]) => void >p : [a: boolean] >d(f.funcA(...p)) : void >d : Dispatch @@ -100,8 +100,8 @@ const {} = useReduxDispatch1( >p : [a: boolean] funcB: (...p) => d(f.funcB(...p)), ->funcB : (b: string, bb: string) => void ->(...p) => d(f.funcB(...p)) : (b: string, bb: string) => void +>funcB : (...p: [b: string, bb: string]) => void +>(...p) => d(f.funcB(...p)) : (...p: [b: string, bb: string]) => void >p : [b: string, bb: string] >d(f.funcB(...p)) : void >d : Dispatch @@ -113,8 +113,8 @@ const {} = useReduxDispatch1( >p : [b: string, bb: string] funcC: (...p) => d(f.funcC(...p)), ->funcC : (c: number, cc: number, ccc: boolean) => void ->(...p) => d(f.funcC(...p)) : (c: number, cc: number, ccc: boolean) => void +>funcC : (...p: [c: number, cc: number, ccc: boolean]) => void +>(...p) => d(f.funcC(...p)) : (...p: [c: number, cc: number, ccc: boolean]) => void >p : [c: number, cc: number, ccc: boolean] >d(f.funcC(...p)) : void >d : Dispatch diff --git a/testdata/baselines/reference/submodule/compiler/bindingPatternCannotBeOnlyInferenceSource.types.diff b/testdata/baselines/reference/submodule/compiler/bindingPatternCannotBeOnlyInferenceSource.types.diff index 627beafad6..f0610da4cd 100644 --- a/testdata/baselines/reference/submodule/compiler/bindingPatternCannotBeOnlyInferenceSource.types.diff +++ b/testdata/baselines/reference/submodule/compiler/bindingPatternCannotBeOnlyInferenceSource.types.diff @@ -9,9 +9,48 @@ >destructuring : Destructuring<{ funcA: (a: boolean) => void; funcB: (b: string, bb: string) => void; funcC: (c: number, cc: number, ccc: boolean) => void; }, T> const {} = useReduxDispatch1( - >useReduxDispatch1( (d, f) => ({ funcA: (...p) => d(f.funcA(...p)), // p should be inferrable funcB: (...p) => d(f.funcB(...p)), funcC: (...p) => d(f.funcC(...p)), })) : { funcA: (a: boolean) => void; funcB: (b: string, bb: string) => void; funcC: (c: number, cc: number, ccc: boolean) => void; } +->useReduxDispatch1( (d, f) => ({ funcA: (...p) => d(f.funcA(...p)), // p should be inferrable funcB: (...p) => d(f.funcB(...p)), funcC: (...p) => d(f.funcC(...p)), })) : { funcA: (a: boolean) => void; funcB: (b: string, bb: string) => void; funcC: (c: number, cc: number, ccc: boolean) => void; } ->useReduxDispatch1 : >(destructuring: Destructuring) => T ++>useReduxDispatch1( (d, f) => ({ funcA: (...p) => d(f.funcA(...p)), // p should be inferrable funcB: (...p) => d(f.funcB(...p)), funcC: (...p) => d(f.funcC(...p)), })) : { funcA: (...p: [a: boolean]) => void; funcB: (...p: [b: string, bb: string]) => void; funcC: (...p: [c: number, cc: number, ccc: boolean]) => void; } +>useReduxDispatch1 : void; funcB: (b: string, bb: string) => void; funcC: (c: number, cc: number, ccc: boolean) => void; }>>(destructuring: Destructuring<{ funcA: (a: boolean) => void; funcB: (b: string, bb: string) => void; funcC: (c: number, cc: number, ccc: boolean) => void; }, T>) => T (d, f) => ({ - >(d, f) => ({ funcA: (...p) => d(f.funcA(...p)), // p should be inferrable funcB: (...p) => d(f.funcB(...p)), funcC: (...p) => d(f.funcC(...p)), }) : (d: Dispatch, f: { funcA: (a: boolean) => void; funcB: (b: string, bb: string) => void; funcC: (c: number, cc: number, ccc: boolean) => void; }) => { funcA: (a: boolean) => void; funcB: (b: string, bb: string) => void; funcC: (c: number, cc: number, ccc: boolean) => void; } \ No newline at end of file +->(d, f) => ({ funcA: (...p) => d(f.funcA(...p)), // p should be inferrable funcB: (...p) => d(f.funcB(...p)), funcC: (...p) => d(f.funcC(...p)), }) : (d: Dispatch, f: { funcA: (a: boolean) => void; funcB: (b: string, bb: string) => void; funcC: (c: number, cc: number, ccc: boolean) => void; }) => { funcA: (a: boolean) => void; funcB: (b: string, bb: string) => void; funcC: (c: number, cc: number, ccc: boolean) => void; } ++>(d, f) => ({ funcA: (...p) => d(f.funcA(...p)), // p should be inferrable funcB: (...p) => d(f.funcB(...p)), funcC: (...p) => d(f.funcC(...p)), }) : (d: Dispatch, f: { funcA: (a: boolean) => void; funcB: (b: string, bb: string) => void; funcC: (c: number, cc: number, ccc: boolean) => void; }) => { funcA: (...p: [a: boolean]) => void; funcB: (...p: [b: string, bb: string]) => void; funcC: (...p: [c: number, cc: number, ccc: boolean]) => void; } + >d : Dispatch + >f : { funcA: (a: boolean) => void; funcB: (b: string, bb: string) => void; funcC: (c: number, cc: number, ccc: boolean) => void; } +->({ funcA: (...p) => d(f.funcA(...p)), // p should be inferrable funcB: (...p) => d(f.funcB(...p)), funcC: (...p) => d(f.funcC(...p)), }) : { funcA: (a: boolean) => void; funcB: (b: string, bb: string) => void; funcC: (c: number, cc: number, ccc: boolean) => void; } +->{ funcA: (...p) => d(f.funcA(...p)), // p should be inferrable funcB: (...p) => d(f.funcB(...p)), funcC: (...p) => d(f.funcC(...p)), } : { funcA: (a: boolean) => void; funcB: (b: string, bb: string) => void; funcC: (c: number, cc: number, ccc: boolean) => void; } ++>({ funcA: (...p) => d(f.funcA(...p)), // p should be inferrable funcB: (...p) => d(f.funcB(...p)), funcC: (...p) => d(f.funcC(...p)), }) : { funcA: (...p: [a: boolean]) => void; funcB: (...p: [b: string, bb: string]) => void; funcC: (...p: [c: number, cc: number, ccc: boolean]) => void; } ++>{ funcA: (...p) => d(f.funcA(...p)), // p should be inferrable funcB: (...p) => d(f.funcB(...p)), funcC: (...p) => d(f.funcC(...p)), } : { funcA: (...p: [a: boolean]) => void; funcB: (...p: [b: string, bb: string]) => void; funcC: (...p: [c: number, cc: number, ccc: boolean]) => void; } + + funcA: (...p) => d(f.funcA(...p)), // p should be inferrable +->funcA : (a: boolean) => void +->(...p) => d(f.funcA(...p)) : (a: boolean) => void ++>funcA : (...p: [a: boolean]) => void ++>(...p) => d(f.funcA(...p)) : (...p: [a: boolean]) => void + >p : [a: boolean] + >d(f.funcA(...p)) : void + >d : Dispatch +@@= skipped -28, +28 lines =@@ + >p : [a: boolean] + + funcB: (...p) => d(f.funcB(...p)), +->funcB : (b: string, bb: string) => void +->(...p) => d(f.funcB(...p)) : (b: string, bb: string) => void ++>funcB : (...p: [b: string, bb: string]) => void ++>(...p) => d(f.funcB(...p)) : (...p: [b: string, bb: string]) => void + >p : [b: string, bb: string] + >d(f.funcB(...p)) : void + >d : Dispatch +@@= skipped -13, +13 lines =@@ + >p : [b: string, bb: string] + + funcC: (...p) => d(f.funcC(...p)), +->funcC : (c: number, cc: number, ccc: boolean) => void +->(...p) => d(f.funcC(...p)) : (c: number, cc: number, ccc: boolean) => void ++>funcC : (...p: [c: number, cc: number, ccc: boolean]) => void ++>(...p) => d(f.funcC(...p)) : (...p: [c: number, cc: number, ccc: boolean]) => void + >p : [c: number, cc: number, ccc: boolean] + >d(f.funcC(...p)) : void + >d : Dispatch \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/contextuallyTypedParametersWithInitializers1.types b/testdata/baselines/reference/submodule/compiler/contextuallyTypedParametersWithInitializers1.types index 3de48cad91..4bb9343c5a 100644 --- a/testdata/baselines/reference/submodule/compiler/contextuallyTypedParametersWithInitializers1.types +++ b/testdata/baselines/reference/submodule/compiler/contextuallyTypedParametersWithInitializers1.types @@ -155,7 +155,7 @@ const f7: () => any = (x?) => 0; // Implicit any error const f8: () => any = (...x) => 0; // [] >f8 : () => any ->(...x) => 0 : () => number +>(...x) => 0 : (...x: []) => number >x : [] >0 : 0 @@ -240,9 +240,9 @@ g6((x?) => 0); // Implicit any error >0 : 0 g6((...x) => 0); // [] ->g6((...x) => 0) : () => number +>g6((...x) => 0) : (...x: []) => number >g6 : any>(x: T) => T ->(...x) => 0 : () => number +>(...x) => 0 : (...x: []) => number >x : [] >0 : 0 diff --git a/testdata/baselines/reference/submodule/compiler/contextuallyTypedParametersWithInitializers1.types.diff b/testdata/baselines/reference/submodule/compiler/contextuallyTypedParametersWithInitializers1.types.diff index 0fe68a52d0..c539eaaa5a 100644 --- a/testdata/baselines/reference/submodule/compiler/contextuallyTypedParametersWithInitializers1.types.diff +++ b/testdata/baselines/reference/submodule/compiler/contextuallyTypedParametersWithInitializers1.types.diff @@ -40,4 +40,24 @@ +>id5 : any>(input: T) => T >function (foo = 42) { return foo } : (foo?: number | undefined) => number >foo : number | undefined - >42 : 42 \ No newline at end of file + >42 : 42 +@@= skipped -57, +57 lines =@@ + + const f8: () => any = (...x) => 0; // [] + >f8 : () => any +->(...x) => 0 : () => number ++>(...x) => 0 : (...x: []) => number + >x : [] + >0 : 0 + +@@= skipped -85, +85 lines =@@ + >0 : 0 + + g6((...x) => 0); // [] +->g6((...x) => 0) : () => number ++>g6((...x) => 0) : (...x: []) => number + >g6 : any>(x: T) => T +->(...x) => 0 : () => number ++>(...x) => 0 : (...x: []) => number + >x : [] + >0 : 0 diff --git a/testdata/baselines/reference/submodule/compiler/correlatedUnions.types b/testdata/baselines/reference/submodule/compiler/correlatedUnions.types index edbf4f7b93..a3a894ae18 100644 --- a/testdata/baselines/reference/submodule/compiler/correlatedUnions.types +++ b/testdata/baselines/reference/submodule/compiler/correlatedUnions.types @@ -491,7 +491,7 @@ function ff1() { >Keys : keyof { sum: [a: number, b: number]; concat: [a: string, b: string, c: string]; } const funs: { [P in Keys]: (...args: ArgMap[P]) => void } = { ->funs : { concat: (a: string, b: string, c: string) => void; sum: (a: number, b: number) => void; } +>funs : { concat: (...args: [a: string, b: string, c: string]) => void; sum: (...args: [a: number, b: number]) => void; } >args : { sum: [a: number, b: number]; concat: [a: string, b: string, c: string]; }[P] >{ sum: (a, b) => a + b, concat: (a, b, c) => a + b + c } : { sum: (a: number, b: number) => number; concat: (a: string, b: string, c: string) => string; } @@ -522,14 +522,14 @@ function ff1() { >args : { sum: [a: number, b: number]; concat: [a: string, b: string, c: string]; }[K] const fn = funs[funKey]; ->fn : { concat: (a: string, b: string, c: string) => void; sum: (a: number, b: number) => void; }[K] ->funs[funKey] : { concat: (a: string, b: string, c: string) => void; sum: (a: number, b: number) => void; }[K] ->funs : { concat: (a: string, b: string, c: string) => void; sum: (a: number, b: number) => void; } +>fn : { concat: (...args: [a: string, b: string, c: string]) => void; sum: (...args: [a: number, b: number]) => void; }[K] +>funs[funKey] : { concat: (...args: [a: string, b: string, c: string]) => void; sum: (...args: [a: number, b: number]) => void; }[K] +>funs : { concat: (...args: [a: string, b: string, c: string]) => void; sum: (...args: [a: number, b: number]) => void; } >funKey : K fn(...args); >fn(...args) : void ->fn : { concat: (a: string, b: string, c: string) => void; sum: (a: number, b: number) => void; }[K] +>fn : { concat: (...args: [a: string, b: string, c: string]) => void; sum: (...args: [a: number, b: number]) => void; }[K] >...args : string | number >args : { sum: [a: number, b: number]; concat: [a: string, b: string, c: string]; }[K] } diff --git a/testdata/baselines/reference/submodule/compiler/correlatedUnions.types.diff b/testdata/baselines/reference/submodule/compiler/correlatedUnions.types.diff index a66455f4f2..be378df359 100644 --- a/testdata/baselines/reference/submodule/compiler/correlatedUnions.types.diff +++ b/testdata/baselines/reference/submodule/compiler/correlatedUnions.types.diff @@ -95,7 +95,35 @@ processEvents([ >processEvents([ { name: "click", callback: ev => console.log(ev) }, { name: "scroll", callback: ev => console.log(ev) },]) : void -@@= skipped -180, +180 lines =@@ +@@= skipped -55, +55 lines =@@ + >Keys : keyof { sum: [a: number, b: number]; concat: [a: string, b: string, c: string]; } + + const funs: { [P in Keys]: (...args: ArgMap[P]) => void } = { +->funs : { concat: (a: string, b: string, c: string) => void; sum: (a: number, b: number) => void; } ++>funs : { concat: (...args: [a: string, b: string, c: string]) => void; sum: (...args: [a: number, b: number]) => void; } + >args : { sum: [a: number, b: number]; concat: [a: string, b: string, c: string]; }[P] + >{ sum: (a, b) => a + b, concat: (a, b, c) => a + b + c } : { sum: (a: number, b: number) => number; concat: (a: string, b: string, c: string) => string; } + +@@= skipped -31, +31 lines =@@ + >args : { sum: [a: number, b: number]; concat: [a: string, b: string, c: string]; }[K] + + const fn = funs[funKey]; +->fn : { concat: (a: string, b: string, c: string) => void; sum: (a: number, b: number) => void; }[K] +->funs[funKey] : { concat: (a: string, b: string, c: string) => void; sum: (a: number, b: number) => void; }[K] +->funs : { concat: (a: string, b: string, c: string) => void; sum: (a: number, b: number) => void; } ++>fn : { concat: (...args: [a: string, b: string, c: string]) => void; sum: (...args: [a: number, b: number]) => void; }[K] ++>funs[funKey] : { concat: (...args: [a: string, b: string, c: string]) => void; sum: (...args: [a: number, b: number]) => void; }[K] ++>funs : { concat: (...args: [a: string, b: string, c: string]) => void; sum: (...args: [a: number, b: number]) => void; } + >funKey : K + + fn(...args); + >fn(...args) : void +->fn : { concat: (a: string, b: string, c: string) => void; sum: (a: number, b: number) => void; }[K] ++>fn : { concat: (...args: [a: string, b: string, c: string]) => void; sum: (...args: [a: number, b: number]) => void; }[K] + >...args : string | number + >args : { sum: [a: number, b: number]; concat: [a: string, b: string, c: string]; }[K] + } +@@= skipped -94, +94 lines =@@ } function f4(x: Funcs[keyof ArgMap], y: Funcs[K]) { diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitTypeofRest.errors.txt b/testdata/baselines/reference/submodule/compiler/declarationEmitTypeofRest.errors.txt deleted file mode 100644 index 671d90c009..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitTypeofRest.errors.txt +++ /dev/null @@ -1,23 +0,0 @@ -v2.ts(2,14): error TS2527: The inferred type of 'v2' references an inaccessible 'unique symbol' type. A type annotation is necessary. - - -==== v1.ts (0 errors) ==== - export const v1 = (...a: [n: "n", a: "a"]): { - /** r rest param */ - a: typeof a, - } => { - return null! - } - -==== v2.ts (1 errors) ==== - const n = Symbol(); - export const v2 = (...a: [n: "n", a: "a"]): { - ~~ -!!! error TS2527: The inferred type of 'v2' references an inaccessible 'unique symbol' type. A type annotation is necessary. - /** r rest param */ - a: typeof a, - /** module var */ - n: typeof n, - } => { - return null! - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitTypeofRest.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitTypeofRest.errors.txt.diff deleted file mode 100644 index a610e7416e..0000000000 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitTypeofRest.errors.txt.diff +++ /dev/null @@ -1,27 +0,0 @@ ---- old.declarationEmitTypeofRest.errors.txt -+++ new.declarationEmitTypeofRest.errors.txt -@@= skipped -0, +0 lines =@@ -- -+v2.ts(2,14): error TS2527: The inferred type of 'v2' references an inaccessible 'unique symbol' type. A type annotation is necessary. -+ -+ -+==== v1.ts (0 errors) ==== -+ export const v1 = (...a: [n: "n", a: "a"]): { -+ /** r rest param */ -+ a: typeof a, -+ } => { -+ return null! -+ } -+ -+==== v2.ts (1 errors) ==== -+ const n = Symbol(); -+ export const v2 = (...a: [n: "n", a: "a"]): { -+ ~~ -+!!! error TS2527: The inferred type of 'v2' references an inaccessible 'unique symbol' type. A type annotation is necessary. -+ /** r rest param */ -+ a: typeof a, -+ /** module var */ -+ n: typeof n, -+ } => { -+ return null! -+ } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitTypeofRest.js b/testdata/baselines/reference/submodule/compiler/declarationEmitTypeofRest.js index 5390d2ae71..28b6d73324 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitTypeofRest.js +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitTypeofRest.js @@ -31,14 +31,16 @@ export const v2 = (...a) => { //// [v1.d.ts] -export declare const v1: (n: "n", a: "a") => { +export declare const v1: (...a: [n: "n", a: "a"]) => { /** r rest param */ a: [n: "n", a: "a"]; }; //// [v2.d.ts] -export declare const v2: (n: "n", a: "a") => { +declare const n: unique symbol; +export declare const v2: (...a: [n: "n", a: "a"]) => { /** r rest param */ a: [n: "n", a: "a"]; /** module var */ - n: unique symbol; + n: typeof n; }; +export {}; diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitTypeofRest.js.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitTypeofRest.js.diff index 2398a7bebc..ce33f748b0 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitTypeofRest.js.diff +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitTypeofRest.js.diff @@ -1,24 +1,18 @@ --- old.declarationEmitTypeofRest.js +++ new.declarationEmitTypeofRest.js -@@= skipped -30, +30 lines =@@ - - +@@= skipped -32, +32 lines =@@ //// [v1.d.ts] --export declare const v1: (...a: [n: "n", a: "a"]) => { -+export declare const v1: (n: "n", a: "a") => { + export declare const v1: (...a: [n: "n", a: "a"]) => { /** r rest param */ - a: typeof a; + a: [n: "n", a: "a"]; }; //// [v2.d.ts] --declare const n: unique symbol; --export declare const v2: (...a: [n: "n", a: "a"]) => { -+export declare const v2: (n: "n", a: "a") => { + declare const n: unique symbol; + export declare const v2: (...a: [n: "n", a: "a"]) => { /** r rest param */ - a: typeof a; + a: [n: "n", a: "a"]; /** module var */ -- n: typeof n; -+ n: unique symbol; - }; --export {}; \ No newline at end of file + n: typeof n; + }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitTypeofRest.types b/testdata/baselines/reference/submodule/compiler/declarationEmitTypeofRest.types index 6392527568..c0f0690b52 100644 --- a/testdata/baselines/reference/submodule/compiler/declarationEmitTypeofRest.types +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitTypeofRest.types @@ -2,8 +2,8 @@ === v1.ts === export const v1 = (...a: [n: "n", a: "a"]): { ->v1 : (n: "n", a: "a") => { a: [n: "n", a: "a"]; } ->(...a: [n: "n", a: "a"]): { /** r rest param */ a: typeof a,} => { return null!} : (n: "n", a: "a") => { a: [n: "n", a: "a"]; } +>v1 : (...a: [n: "n", a: "a"]) => { a: [n: "n", a: "a"]; } +>(...a: [n: "n", a: "a"]): { /** r rest param */ a: typeof a,} => { return null!} : (...a: [n: "n", a: "a"]) => { a: [n: "n", a: "a"]; } >a : [n: "n", a: "a"] /** r rest param */ @@ -23,8 +23,8 @@ const n = Symbol(); >Symbol : SymbolConstructor export const v2 = (...a: [n: "n", a: "a"]): { ->v2 : (n: "n", a: "a") => { a: [n: "n", a: "a"]; n: unique symbol; } ->(...a: [n: "n", a: "a"]): { /** r rest param */ a: typeof a, /** module var */ n: typeof n,} => { return null!} : (n: "n", a: "a") => { a: [n: "n", a: "a"]; n: unique symbol; } +>v2 : (...a: [n: "n", a: "a"]) => { a: [n: "n", a: "a"]; n: unique symbol; } +>(...a: [n: "n", a: "a"]): { /** r rest param */ a: typeof a, /** module var */ n: typeof n,} => { return null!} : (...a: [n: "n", a: "a"]) => { a: [n: "n", a: "a"]; n: unique symbol; } >a : [n: "n", a: "a"] /** r rest param */ diff --git a/testdata/baselines/reference/submodule/compiler/declarationEmitTypeofRest.types.diff b/testdata/baselines/reference/submodule/compiler/declarationEmitTypeofRest.types.diff new file mode 100644 index 0000000000..6c0f3b4e3d --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/declarationEmitTypeofRest.types.diff @@ -0,0 +1,24 @@ +--- old.declarationEmitTypeofRest.types ++++ new.declarationEmitTypeofRest.types +@@= skipped -1, +1 lines =@@ + + === v1.ts === + export const v1 = (...a: [n: "n", a: "a"]): { +->v1 : (n: "n", a: "a") => { a: [n: "n", a: "a"]; } +->(...a: [n: "n", a: "a"]): { /** r rest param */ a: typeof a,} => { return null!} : (n: "n", a: "a") => { a: [n: "n", a: "a"]; } ++>v1 : (...a: [n: "n", a: "a"]) => { a: [n: "n", a: "a"]; } ++>(...a: [n: "n", a: "a"]): { /** r rest param */ a: typeof a,} => { return null!} : (...a: [n: "n", a: "a"]) => { a: [n: "n", a: "a"]; } + >a : [n: "n", a: "a"] + + /** r rest param */ +@@= skipped -21, +21 lines =@@ + >Symbol : SymbolConstructor + + export const v2 = (...a: [n: "n", a: "a"]): { +->v2 : (n: "n", a: "a") => { a: [n: "n", a: "a"]; n: unique symbol; } +->(...a: [n: "n", a: "a"]): { /** r rest param */ a: typeof a, /** module var */ n: typeof n,} => { return null!} : (n: "n", a: "a") => { a: [n: "n", a: "a"]; n: unique symbol; } ++>v2 : (...a: [n: "n", a: "a"]) => { a: [n: "n", a: "a"]; n: unique symbol; } ++>(...a: [n: "n", a: "a"]): { /** r rest param */ a: typeof a, /** module var */ n: typeof n,} => { return null!} : (...a: [n: "n", a: "a"]) => { a: [n: "n", a: "a"]; n: unique symbol; } + >a : [n: "n", a: "a"] + + /** r rest param */ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/genericCallAtYieldExpressionInGenericCall2.types b/testdata/baselines/reference/submodule/compiler/genericCallAtYieldExpressionInGenericCall2.types index 447899d560..8409ae150f 100644 --- a/testdata/baselines/reference/submodule/compiler/genericCallAtYieldExpressionInGenericCall2.types +++ b/testdata/baselines/reference/submodule/compiler/genericCallAtYieldExpressionInGenericCall2.types @@ -45,7 +45,7 @@ declare function fn>( >args : Args fn(function* (queue: Enqueue, value: T) { ->fn(function* (queue: Enqueue, value: T) { yield* offer(queue, value);}) : (queue: Enqueue, value: T) => any +>fn(function* (queue: Enqueue, value: T) { yield* offer(queue, value);}) : (...args: [queue: Enqueue, value: T]) => any >fn : (body: (...args: Args) => Generator) => (...args: Args) => any >function* (queue: Enqueue, value: T) { yield* offer(queue, value);} : (queue: Enqueue, value: T) => Generator >queue : Enqueue @@ -61,7 +61,7 @@ fn(function* (queue: Enqueue, value: T) { }); fn(function* (queue: Enqueue, value: T) { ->fn(function* (queue: Enqueue, value: T) { const x = offer(queue, value); yield* x;}) : (queue: Enqueue, value: T) => any +>fn(function* (queue: Enqueue, value: T) { const x = offer(queue, value); yield* x;}) : (...args: [queue: Enqueue, value: T]) => any >fn : (body: (...args: Args) => Generator) => (...args: Args) => any >function* (queue: Enqueue, value: T) { const x = offer(queue, value); yield* x;} : (queue: Enqueue, value: T) => Generator >queue : Enqueue diff --git a/testdata/baselines/reference/submodule/compiler/genericCallAtYieldExpressionInGenericCall2.types.diff b/testdata/baselines/reference/submodule/compiler/genericCallAtYieldExpressionInGenericCall2.types.diff index d1f8f6745d..f78e7b635a 100644 --- a/testdata/baselines/reference/submodule/compiler/genericCallAtYieldExpressionInGenericCall2.types.diff +++ b/testdata/baselines/reference/submodule/compiler/genericCallAtYieldExpressionInGenericCall2.types.diff @@ -25,22 +25,26 @@ body: (...args: Args) => Generator, >body : (...args: Args) => Generator -@@= skipped -11, +11 lines =@@ +@@= skipped -10, +10 lines =@@ + >args : Args fn(function* (queue: Enqueue, value: T) { - >fn(function* (queue: Enqueue, value: T) { yield* offer(queue, value);}) : (queue: Enqueue, value: T) => any +->fn(function* (queue: Enqueue, value: T) { yield* offer(queue, value);}) : (queue: Enqueue, value: T) => any ->fn : >(body: (...args: Args) => Generator) => (...args: Args) => any ->function* (queue: Enqueue, value: T) { yield* offer(queue, value);} : (queue: Enqueue, value: T) => Generator ++>fn(function* (queue: Enqueue, value: T) { yield* offer(queue, value);}) : (...args: [queue: Enqueue, value: T]) => any +>fn : (body: (...args: Args) => Generator) => (...args: Args) => any +>function* (queue: Enqueue, value: T) { yield* offer(queue, value);} : (queue: Enqueue, value: T) => Generator >queue : Enqueue >value : T @@= skipped -16, +16 lines =@@ + }); fn(function* (queue: Enqueue, value: T) { - >fn(function* (queue: Enqueue, value: T) { const x = offer(queue, value); yield* x;}) : (queue: Enqueue, value: T) => any +->fn(function* (queue: Enqueue, value: T) { const x = offer(queue, value); yield* x;}) : (queue: Enqueue, value: T) => any ->fn : >(body: (...args: Args) => Generator) => (...args: Args) => any ++>fn(function* (queue: Enqueue, value: T) { const x = offer(queue, value); yield* x;}) : (...args: [queue: Enqueue, value: T]) => any +>fn : (body: (...args: Args) => Generator) => (...args: Args) => any >function* (queue: Enqueue, value: T) { const x = offer(queue, value); yield* x;} : (queue: Enqueue, value: T) => Generator >queue : Enqueue diff --git a/testdata/baselines/reference/submodule/compiler/genericCallInferenceUsingThisTypeNoInvalidCacheReuseAfterMappedTypeApplication1.types b/testdata/baselines/reference/submodule/compiler/genericCallInferenceUsingThisTypeNoInvalidCacheReuseAfterMappedTypeApplication1.types index 48c7125d57..dcf643ede8 100644 --- a/testdata/baselines/reference/submodule/compiler/genericCallInferenceUsingThisTypeNoInvalidCacheReuseAfterMappedTypeApplication1.types +++ b/testdata/baselines/reference/submodule/compiler/genericCallInferenceUsingThisTypeNoInvalidCacheReuseAfterMappedTypeApplication1.types @@ -66,8 +66,8 @@ class XXX { >XXX : XXX log = implement()((n: N) => succeed(n)); ->log : (n: N) => F, this> ->implement()((n: N) => succeed(n)) : (n: N) => F, this> +>log : (...i: [n: N]) => F, this> +>implement()((n: N) => succeed(n)) : (...i: [n: N]) => F, this> >implement() : (x: (...i: I) => X) => (...i: I) => F >implement : () => (x: (...i: I) => X) => (...i: I) => F >(n: N) => succeed(n) : (n: N) => Effect @@ -86,16 +86,16 @@ export declare const outer: ProxyMap; export const a = inner.log(100); // Effect<100, never, never> >a : Effect<100, never, never> >inner.log(100) : Effect<100, never, never> ->inner.log : (n: N) => Effect +>inner.log : (...i: [n: N]) => Effect >inner : XXX ->log : (n: N) => Effect +>log : (...i: [n: N]) => Effect >100 : 100 export const b = outer.log(100); // Effect<100, never, XXX> >b : Effect<100, never, never> >outer.log(100) : Effect<100, never, never> ->outer.log : (n: N) => Effect +>outer.log : (...i: [n: N]) => Effect >outer : ProxyMap ->log : (n: N) => Effect +>log : (...i: [n: N]) => Effect >100 : 100 diff --git a/testdata/baselines/reference/submodule/compiler/genericCallInferenceUsingThisTypeNoInvalidCacheReuseAfterMappedTypeApplication1.types.diff b/testdata/baselines/reference/submodule/compiler/genericCallInferenceUsingThisTypeNoInvalidCacheReuseAfterMappedTypeApplication1.types.diff index 42b5a5f83b..9b2d706c79 100644 --- a/testdata/baselines/reference/submodule/compiler/genericCallInferenceUsingThisTypeNoInvalidCacheReuseAfterMappedTypeApplication1.types.diff +++ b/testdata/baselines/reference/submodule/compiler/genericCallInferenceUsingThisTypeNoInvalidCacheReuseAfterMappedTypeApplication1.types.diff @@ -18,12 +18,16 @@ x: (...i: I) => X, >x : (...i: I) => X -@@= skipped -15, +15 lines =@@ +@@= skipped -13, +13 lines =@@ + >XXX : XXX + log = implement()((n: N) => succeed(n)); - >log : (n: N) => F, this> - >implement()((n: N) => succeed(n)) : (n: N) => F, this> +->log : (n: N) => F, this> +->implement()((n: N) => succeed(n)) : (n: N) => F, this> ->implement() : , X>(x: (...i: I) => X) => (...i: I) => F ->implement : () => , X>(x: (...i: I) => X) => (...i: I) => F ++>log : (...i: [n: N]) => F, this> ++>implement()((n: N) => succeed(n)) : (...i: [n: N]) => F, this> +>implement() : (x: (...i: I) => X) => (...i: I) => F +>implement : () => (x: (...i: I) => X) => (...i: I) => F >(n: N) => succeed(n) : (n: N) => Effect @@ -34,7 +38,7 @@ >n : N } -@@= skipped -16, +16 lines =@@ +@@= skipped -18, +18 lines =@@ >outer : ProxyMap export const a = inner.log(100); // Effect<100, never, never> @@ -43,10 +47,10 @@ ->inner.log : (n: N) => F, this> +>a : Effect<100, never, never> +>inner.log(100) : Effect<100, never, never> -+>inner.log : (n: N) => Effect ++>inner.log : (...i: [n: N]) => Effect >inner : XXX ->log : (n: N) => F, this> -+>log : (n: N) => Effect ++>log : (...i: [n: N]) => Effect >100 : 100 export const b = outer.log(100); // Effect<100, never, XXX> @@ -55,8 +59,8 @@ ->outer.log : (n: N) => F, this> +>b : Effect<100, never, never> +>outer.log(100) : Effect<100, never, never> -+>outer.log : (n: N) => Effect ++>outer.log : (...i: [n: N]) => Effect >outer : ProxyMap ->log : (n: N) => F, this> -+>log : (n: N) => Effect ++>log : (...i: [n: N]) => Effect >100 : 100 diff --git a/testdata/baselines/reference/submodule/compiler/genericFunctionInference1.types b/testdata/baselines/reference/submodule/compiler/genericFunctionInference1.types index 105acc7a62..b4f5c51977 100644 --- a/testdata/baselines/reference/submodule/compiler/genericFunctionInference1.types +++ b/testdata/baselines/reference/submodule/compiler/genericFunctionInference1.types @@ -40,28 +40,28 @@ declare function foo(x: T): T; >x : T const f00 = pipe(list); ->f00 : (a: T) => T[] ->pipe(list) : (a: T) => T[] +>f00 : (...args: [a: T]) => T[] +>pipe(list) : (...args: [a: T]) => T[] >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } >list : (a: T) => T[] const f01 = pipe(list, box); ->f01 : (a: T) => { value: T[]; } ->pipe(list, box) : (a: T) => { value: T[]; } +>f01 : (...args: [a: T]) => { value: T[]; } +>pipe(list, box) : (...args: [a: T]) => { value: T[]; } >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } >list : (a: T) => T[] >box : (x: V) => { value: V; } const f02 = pipe(box, list); ->f02 : (x: V) => { value: V; }[] ->pipe(box, list) : (x: V) => { value: V; }[] +>f02 : (...args: [x: V]) => { value: V; }[] +>pipe(box, list) : (...args: [x: V]) => { value: V; }[] >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } >box : (x: V) => { value: V; } >list : (a: T) => T[] const f03 = pipe(x => list(x), box); ->f03 : (x: any) => { value: any[]; } ->pipe(x => list(x), box) : (x: any) => { value: any[]; } +>f03 : (...args: [x: any]) => { value: any[]; } +>pipe(x => list(x), box) : (...args: [x: any]) => { value: any[]; } >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } >x => list(x) : (x: any) => any[] >x : any @@ -71,8 +71,8 @@ const f03 = pipe(x => list(x), box); >box : (x: V) => { value: V; } const f04 = pipe(list, x => box(x)); ->f04 : (a: T) => { value: T[]; } ->pipe(list, x => box(x)) : (a: T) => { value: T[]; } +>f04 : (...args: [a: T]) => { value: T[]; } +>pipe(list, x => box(x)) : (...args: [a: T]) => { value: T[]; } >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } >list : (a: T) => T[] >x => box(x) : (x: T[]) => { value: T[]; } @@ -82,8 +82,8 @@ const f04 = pipe(list, x => box(x)); >x : T[] const f05 = pipe(x => list(x), x => box(x)) ->f05 : (x: any) => { value: any[]; } ->pipe(x => list(x), x => box(x)) : (x: any) => { value: any[]; } +>f05 : (...args: [x: any]) => { value: any[]; } +>pipe(x => list(x), x => box(x)) : (...args: [x: any]) => { value: any[]; } >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } >x => list(x) : (x: any) => any[] >x : any @@ -97,37 +97,37 @@ const f05 = pipe(x => list(x), x => box(x)) >x : any[] const f06 = pipe(list, pipe(box)); ->f06 : (a: T) => { value: T[]; } ->pipe(list, pipe(box)) : (a: T) => { value: T[]; } +>f06 : (...args: [a: T]) => { value: T[]; } +>pipe(list, pipe(box)) : (...args: [a: T]) => { value: T[]; } >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } >list : (a: T) => T[] ->pipe(box) : (x: T[]) => { value: T[]; } +>pipe(box) : (...args: [x: T[]]) => { value: T[]; } >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } >box : (x: V) => { value: V; } const f07 = pipe(x => list(x), pipe(box)); ->f07 : (x: any) => { value: any[]; } ->pipe(x => list(x), pipe(box)) : (x: any) => { value: any[]; } +>f07 : (...args: [x: any]) => { value: any[]; } +>pipe(x => list(x), pipe(box)) : (...args: [x: any]) => { value: any[]; } >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } >x => list(x) : (x: any) => any[] >x : any >list(x) : any[] >list : (a: T) => T[] >x : any ->pipe(box) : (x: any[]) => { value: any[]; } +>pipe(box) : (...args: [x: any[]]) => { value: any[]; } >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } >box : (x: V) => { value: V; } const f08 = pipe(x => list(x), pipe(x => box(x))); ->f08 : (x: any) => { value: any[]; } ->pipe(x => list(x), pipe(x => box(x))) : (x: any) => { value: any[]; } +>f08 : (...args: [x: any]) => { value: any[]; } +>pipe(x => list(x), pipe(x => box(x))) : (...args: [x: any]) => { value: any[]; } >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } >x => list(x) : (x: any) => any[] >x : any >list(x) : any[] >list : (a: T) => T[] >x : any ->pipe(x => box(x)) : (x: any[]) => { value: any[]; } +>pipe(x => box(x)) : (...args: [x: any[]]) => { value: any[]; } >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } >x => box(x) : (x: any[]) => { value: any[]; } >x : any[] @@ -136,8 +136,8 @@ const f08 = pipe(x => list(x), pipe(x => box(x))); >x : any[] const f09 = pipe(list, x => x.length); ->f09 : (a: T) => number ->pipe(list, x => x.length) : (a: T) => number +>f09 : (...args: [a: T]) => number +>pipe(list, x => x.length) : (...args: [a: T]) => number >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } >list : (a: T) => T[] >x => x.length : (x: T[]) => number @@ -147,14 +147,14 @@ const f09 = pipe(list, x => x.length); >length : number const f10 = pipe(foo); ->f10 : (x: T) => T ->pipe(foo) : (x: T) => T +>f10 : (...args: [x: T]) => T +>pipe(foo) : (...args: [x: T]) => T >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } >foo : (x: T) => T const f11 = pipe(foo, foo); ->f11 : (x: T) => T ->pipe(foo, foo) : (x: T) => T +>f11 : (...args: [x: T]) => T +>pipe(foo, foo) : (...args: [x: T]) => T >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } >foo : (x: T) => T >foo : (x: T) => T @@ -162,7 +162,7 @@ const f11 = pipe(foo, foo); const g00: (x: T) => T[] = pipe(list); >g00 : (x: T) => T[] >x : T ->pipe(list) : (a: T) => T[] +>pipe(list) : (...args: [a: T]) => T[] >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } >list : (a: T) => T[] @@ -170,7 +170,7 @@ const g01: (x: T) => { value: T[] } = pipe(list, box); >g01 : (x: T) => { value: T[]; } >x : T >value : T[] ->pipe(list, box) : (a: T) => { value: T[]; } +>pipe(list, box) : (...args: [a: T]) => { value: T[]; } >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } >list : (a: T) => T[] >box : (x: V) => { value: V; } @@ -179,7 +179,7 @@ const g02: (x: T) => { value: T }[] = pipe(box, list); >g02 : (x: T) => { value: T; }[] >x : T >value : T ->pipe(box, list) : (x: T) => { value: T; }[] +>pipe(box, list) : (...args: [x: T]) => { value: T; }[] >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } >box : (x: V) => { value: V; } >list : (a: T) => T[] @@ -188,7 +188,7 @@ const g03: (x: T) => { value: T[] } = pipe(x => list(x), box); >g03 : (x: T) => { value: T[]; } >x : T >value : T[] ->pipe(x => list(x), box) : (x: T) => { value: T[]; } +>pipe(x => list(x), box) : (...args: [x: T]) => { value: T[]; } >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } >x => list(x) : (x: T) => T[] >x : T @@ -201,7 +201,7 @@ const g04: (x: T) => { value: T[] } = pipe(list, x => box(x)); >g04 : (x: T) => { value: T[]; } >x : T >value : T[] ->pipe(list, x => box(x)) : (a: T) => { value: T[]; } +>pipe(list, x => box(x)) : (...args: [a: T]) => { value: T[]; } >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } >list : (a: T) => T[] >x => box(x) : (x: T[]) => { value: T[]; } @@ -214,7 +214,7 @@ const g05: (x: T) => { value: T[] } = pipe(x => list(x), x => box(x)) >g05 : (x: T) => { value: T[]; } >x : T >value : T[] ->pipe(x => list(x), x => box(x)) : (x: T) => { value: T[]; } +>pipe(x => list(x), x => box(x)) : (...args: [x: T]) => { value: T[]; } >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } >x => list(x) : (x: T) => T[] >x : T @@ -231,10 +231,10 @@ const g06: (x: T) => { value: T[] } = pipe(list, pipe(box)); >g06 : (x: T) => { value: T[]; } >x : T >value : T[] ->pipe(list, pipe(box)) : (a: T) => { value: T[]; } +>pipe(list, pipe(box)) : (...args: [a: T]) => { value: T[]; } >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } >list : (a: T) => T[] ->pipe(box) : (x: T[]) => { value: T[]; } +>pipe(box) : (...args: [x: T[]]) => { value: T[]; } >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } >box : (x: V) => { value: V; } @@ -242,14 +242,14 @@ const g07: (x: T) => { value: T[] } = pipe(x => list(x), pipe(box)); >g07 : (x: T) => { value: T[]; } >x : T >value : T[] ->pipe(x => list(x), pipe(box)) : (x: T) => { value: T[]; } +>pipe(x => list(x), pipe(box)) : (...args: [x: T]) => { value: T[]; } >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } >x => list(x) : (x: T) => T[] >x : T >list(x) : T[] >list : (a: T) => T[] >x : T ->pipe(box) : (x: T[]) => { value: T[]; } +>pipe(box) : (...args: [x: T[]]) => { value: T[]; } >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } >box : (x: V) => { value: V; } @@ -257,14 +257,14 @@ const g08: (x: T) => { value: T[] } = pipe(x => list(x), pipe(x => box(x))); >g08 : (x: T) => { value: T[]; } >x : T >value : T[] ->pipe(x => list(x), pipe(x => box(x))) : (x: T) => { value: T[]; } +>pipe(x => list(x), pipe(x => box(x))) : (...args: [x: T]) => { value: T[]; } >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } >x => list(x) : (x: T) => T[] >x : T >list(x) : T[] >list : (a: T) => T[] >x : T ->pipe(x => box(x)) : (x: T[]) => { value: T[]; } +>pipe(x => box(x)) : (...args: [x: T[]]) => { value: T[]; } >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } >x => box(x) : (x: T[]) => { value: T[]; } >x : T[] @@ -275,7 +275,7 @@ const g08: (x: T) => { value: T[] } = pipe(x => list(x), pipe(x => box(x))); const g09: (x: T) => number = pipe(list, x => x.length); >g09 : (x: T) => number >x : T ->pipe(list, x => x.length) : (a: T) => number +>pipe(list, x => x.length) : (...args: [a: T]) => number >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } >list : (a: T) => T[] >x => x.length : (x: T[]) => number @@ -288,7 +288,7 @@ const g10: (x: T) => T = pipe(foo); >g10 : (x: T) => T >value : T >x : T ->pipe(foo) : (x: T) => T +>pipe(foo) : (...args: [x: T]) => T >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } >foo : (x: T) => T @@ -296,7 +296,7 @@ const g12: (x: T) => T = pipe(foo, foo); >g12 : (x: T) => T >value : T >x : T ->pipe(foo, foo) : (x: T) => T +>pipe(foo, foo) : (...args: [x: T]) => T >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } >foo : (x: T) => T >foo : (x: T) => T @@ -459,15 +459,15 @@ declare const list2: { } let f70 = pipe(list2, box); ->f70 : (a: T) => { value: T[]; } ->pipe(list2, box) : (a: T) => { value: T[]; } +>f70 : (...args: [a: T]) => { value: T[]; } +>pipe(list2, box) : (...args: [a: T]) => { value: T[]; } >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } >list2 : { (a: T): T[]; foo: string; bar(): number; } >box : (x: V) => { value: V; } let f71 = pipe(box, list2); ->f71 : (x: V) => { value: V; }[] ->pipe(box, list2) : (x: V) => { value: V; }[] +>f71 : (...args: [x: V]) => { value: V; }[] +>pipe(box, list2) : (...args: [x: V]) => { value: V; }[] >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } >box : (x: V) => { value: V; } >list2 : { (a: T): T[]; foo: string; bar(): number; } @@ -515,8 +515,8 @@ function asFunction(cf: new (...args: A) => B) { } const newPoint = asFunction(Point); ->newPoint : (x: number, y: number) => Point ->asFunction(Point) : (x: number, y: number) => Point +>newPoint : (...args: [x: number, y: number]) => Point +>asFunction(Point) : (...args: [x: number, y: number]) => Point >asFunction : (cf: new (...args: A) => B) => (...args: A) => B >Point : typeof Point @@ -536,7 +536,7 @@ const p1 = new Point(10, 20); const p2 = newPoint(10, 20); >p2 : Point >newPoint(10, 20) : Point ->newPoint : (x: number, y: number) => Point +>newPoint : (...args: [x: number, y: number]) => Point >10 : 10 >20 : 20 @@ -779,8 +779,8 @@ declare const MyComponent1: Component<{ foo: 1 }>; >foo : 1 const enhance = pipe( ->enhance :

(C: Component

) => Component

->pipe( myHoc1, myHoc2,) :

(C: Component

) => Component

+>enhance :

(...args: [C: Component

]) => Component

+>pipe( myHoc1, myHoc2,) :

(...args: [C: Component

]) => Component

>pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } myHoc1, @@ -794,14 +794,14 @@ const enhance = pipe( const MyComponent2 = enhance(MyComponent1); >MyComponent2 : Component<{ foo: 1; }> >enhance(MyComponent1) : Component<{ foo: 1; }> ->enhance :

(C: Component

) => Component

+>enhance :

(...args: [C: Component

]) => Component

>MyComponent1 : Component<{ foo: 1; }> // #29904.2 const fn20 = pipe((_a?: {}) => 1); ->fn20 : (_a?: {} | undefined) => number ->pipe((_a?: {}) => 1) : (_a?: {} | undefined) => number +>fn20 : (...args: [_a?: {} | undefined]) => number +>pipe((_a?: {}) => 1) : (...args: [_a?: {} | undefined]) => number >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } >(_a?: {}) => 1 : (_a?: {} | undefined) => number >_a : {} | undefined @@ -815,7 +815,7 @@ type Fn = (n: number) => number; const fn30: Fn = pipe( >fn30 : Fn ->pipe( x => x + 1, x => x * 2,) : (x: number) => number +>pipe( x => x + 1, x => x * 2,) : (...args: [x: number]) => number >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } x => x + 1, @@ -849,7 +849,7 @@ promise.then( >then : (onfulfilled?: ((value: number) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise pipe( ->pipe( x => x + 1, x => x * 2, ) : (x: number) => number +>pipe( x => x + 1, x => x * 2, ) : (...args: [x: number]) => number >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } x => x + 1, @@ -883,8 +883,8 @@ declare const identity: (value: T) => T; >value : T const fn40 = pipe( ->fn40 : () => string | undefined ->pipe( getString, string => orUndefined(string), identity,) : () => string | undefined +>fn40 : (...args: []) => string | undefined +>pipe( getString, string => orUndefined(string), identity,) : (...args: []) => string | undefined >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } getString, @@ -912,8 +912,8 @@ declare const first: (ts: T[]) => T; >ts : T[] const fn60 = pipe( ->fn60 : () => string ->pipe( getArray, x => x, first,) : () => string +>fn60 : (...args: []) => string +>pipe( getArray, x => x, first,) : (...args: []) => string >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } getArray, @@ -930,8 +930,8 @@ const fn60 = pipe( ); const fn61 = pipe( ->fn61 : () => string ->pipe( getArray, identity, first,) : () => string +>fn61 : (...args: []) => string +>pipe( getArray, identity, first,) : (...args: []) => string >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } getArray, @@ -946,8 +946,8 @@ const fn61 = pipe( ); const fn62 = pipe( ->fn62 : () => string ->pipe( getArray, x => x, x => first(x),) : () => string +>fn62 : (...args: []) => string +>pipe( getArray, x => x, x => first(x),) : (...args: []) => string >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } getArray, diff --git a/testdata/baselines/reference/submodule/compiler/genericFunctionInference1.types.diff b/testdata/baselines/reference/submodule/compiler/genericFunctionInference1.types.diff index b43437099d..6c0388956b 100644 --- a/testdata/baselines/reference/submodule/compiler/genericFunctionInference1.types.diff +++ b/testdata/baselines/reference/submodule/compiler/genericFunctionInference1.types.diff @@ -25,16 +25,405 @@ >ab : (...args: A) => B >args : A >bc : (b: B) => C -@@= skipped -787, +787 lines =@@ - >fn20 : (_a?: {} | undefined) => number - >pipe((_a?: {}) => 1) : (_a?: {} | undefined) => number +@@= skipped -24, +24 lines =@@ + >x : T + + const f00 = pipe(list); +->f00 : (a: T) => T[] +->pipe(list) : (a: T) => T[] ++>f00 : (...args: [a: T]) => T[] ++>pipe(list) : (...args: [a: T]) => T[] + >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } + >list : (a: T) => T[] + + const f01 = pipe(list, box); +->f01 : (a: T) => { value: T[]; } +->pipe(list, box) : (a: T) => { value: T[]; } ++>f01 : (...args: [a: T]) => { value: T[]; } ++>pipe(list, box) : (...args: [a: T]) => { value: T[]; } + >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } + >list : (a: T) => T[] + >box : (x: V) => { value: V; } + + const f02 = pipe(box, list); +->f02 : (x: V) => { value: V; }[] +->pipe(box, list) : (x: V) => { value: V; }[] ++>f02 : (...args: [x: V]) => { value: V; }[] ++>pipe(box, list) : (...args: [x: V]) => { value: V; }[] + >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } + >box : (x: V) => { value: V; } + >list : (a: T) => T[] + + const f03 = pipe(x => list(x), box); +->f03 : (x: any) => { value: any[]; } +->pipe(x => list(x), box) : (x: any) => { value: any[]; } ++>f03 : (...args: [x: any]) => { value: any[]; } ++>pipe(x => list(x), box) : (...args: [x: any]) => { value: any[]; } + >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } + >x => list(x) : (x: any) => any[] + >x : any +@@= skipped -31, +31 lines =@@ + >box : (x: V) => { value: V; } + + const f04 = pipe(list, x => box(x)); +->f04 : (a: T) => { value: T[]; } +->pipe(list, x => box(x)) : (a: T) => { value: T[]; } ++>f04 : (...args: [a: T]) => { value: T[]; } ++>pipe(list, x => box(x)) : (...args: [a: T]) => { value: T[]; } + >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } + >list : (a: T) => T[] + >x => box(x) : (x: T[]) => { value: T[]; } +@@= skipped -11, +11 lines =@@ + >x : T[] + + const f05 = pipe(x => list(x), x => box(x)) +->f05 : (x: any) => { value: any[]; } +->pipe(x => list(x), x => box(x)) : (x: any) => { value: any[]; } ++>f05 : (...args: [x: any]) => { value: any[]; } ++>pipe(x => list(x), x => box(x)) : (...args: [x: any]) => { value: any[]; } + >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } + >x => list(x) : (x: any) => any[] + >x : any +@@= skipped -15, +15 lines =@@ + >x : any[] + + const f06 = pipe(list, pipe(box)); +->f06 : (a: T) => { value: T[]; } +->pipe(list, pipe(box)) : (a: T) => { value: T[]; } ++>f06 : (...args: [a: T]) => { value: T[]; } ++>pipe(list, pipe(box)) : (...args: [a: T]) => { value: T[]; } + >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } + >list : (a: T) => T[] +->pipe(box) : (x: T[]) => { value: T[]; } ++>pipe(box) : (...args: [x: T[]]) => { value: T[]; } + >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } + >box : (x: V) => { value: V; } + + const f07 = pipe(x => list(x), pipe(box)); +->f07 : (x: any) => { value: any[]; } +->pipe(x => list(x), pipe(box)) : (x: any) => { value: any[]; } ++>f07 : (...args: [x: any]) => { value: any[]; } ++>pipe(x => list(x), pipe(box)) : (...args: [x: any]) => { value: any[]; } + >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } + >x => list(x) : (x: any) => any[] + >x : any + >list(x) : any[] + >list : (a: T) => T[] + >x : any +->pipe(box) : (x: any[]) => { value: any[]; } ++>pipe(box) : (...args: [x: any[]]) => { value: any[]; } + >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } + >box : (x: V) => { value: V; } + + const f08 = pipe(x => list(x), pipe(x => box(x))); +->f08 : (x: any) => { value: any[]; } +->pipe(x => list(x), pipe(x => box(x))) : (x: any) => { value: any[]; } ++>f08 : (...args: [x: any]) => { value: any[]; } ++>pipe(x => list(x), pipe(x => box(x))) : (...args: [x: any]) => { value: any[]; } + >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } + >x => list(x) : (x: any) => any[] + >x : any + >list(x) : any[] + >list : (a: T) => T[] + >x : any +->pipe(x => box(x)) : (x: any[]) => { value: any[]; } ++>pipe(x => box(x)) : (...args: [x: any[]]) => { value: any[]; } + >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } + >x => box(x) : (x: any[]) => { value: any[]; } + >x : any[] +@@= skipped -39, +39 lines =@@ + >x : any[] + + const f09 = pipe(list, x => x.length); +->f09 : (a: T) => number +->pipe(list, x => x.length) : (a: T) => number ++>f09 : (...args: [a: T]) => number ++>pipe(list, x => x.length) : (...args: [a: T]) => number + >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } + >list : (a: T) => T[] + >x => x.length : (x: T[]) => number +@@= skipped -11, +11 lines =@@ + >length : number + + const f10 = pipe(foo); +->f10 : (x: T) => T +->pipe(foo) : (x: T) => T ++>f10 : (...args: [x: T]) => T ++>pipe(foo) : (...args: [x: T]) => T + >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } + >foo : (x: T) => T + + const f11 = pipe(foo, foo); +->f11 : (x: T) => T +->pipe(foo, foo) : (x: T) => T ++>f11 : (...args: [x: T]) => T ++>pipe(foo, foo) : (...args: [x: T]) => T + >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } + >foo : (x: T) => T + >foo : (x: T) => T +@@= skipped -15, +15 lines =@@ + const g00: (x: T) => T[] = pipe(list); + >g00 : (x: T) => T[] + >x : T +->pipe(list) : (a: T) => T[] ++>pipe(list) : (...args: [a: T]) => T[] + >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } + >list : (a: T) => T[] + +@@= skipped -8, +8 lines =@@ + >g01 : (x: T) => { value: T[]; } + >x : T + >value : T[] +->pipe(list, box) : (a: T) => { value: T[]; } ++>pipe(list, box) : (...args: [a: T]) => { value: T[]; } + >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } + >list : (a: T) => T[] + >box : (x: V) => { value: V; } +@@= skipped -9, +9 lines =@@ + >g02 : (x: T) => { value: T; }[] + >x : T + >value : T +->pipe(box, list) : (x: T) => { value: T; }[] ++>pipe(box, list) : (...args: [x: T]) => { value: T; }[] + >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } + >box : (x: V) => { value: V; } + >list : (a: T) => T[] +@@= skipped -9, +9 lines =@@ + >g03 : (x: T) => { value: T[]; } + >x : T + >value : T[] +->pipe(x => list(x), box) : (x: T) => { value: T[]; } ++>pipe(x => list(x), box) : (...args: [x: T]) => { value: T[]; } + >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } + >x => list(x) : (x: T) => T[] + >x : T +@@= skipped -13, +13 lines =@@ + >g04 : (x: T) => { value: T[]; } + >x : T + >value : T[] +->pipe(list, x => box(x)) : (a: T) => { value: T[]; } ++>pipe(list, x => box(x)) : (...args: [a: T]) => { value: T[]; } + >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } + >list : (a: T) => T[] + >x => box(x) : (x: T[]) => { value: T[]; } +@@= skipped -13, +13 lines =@@ + >g05 : (x: T) => { value: T[]; } + >x : T + >value : T[] +->pipe(x => list(x), x => box(x)) : (x: T) => { value: T[]; } ++>pipe(x => list(x), x => box(x)) : (...args: [x: T]) => { value: T[]; } + >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } + >x => list(x) : (x: T) => T[] + >x : T +@@= skipped -17, +17 lines =@@ + >g06 : (x: T) => { value: T[]; } + >x : T + >value : T[] +->pipe(list, pipe(box)) : (a: T) => { value: T[]; } ++>pipe(list, pipe(box)) : (...args: [a: T]) => { value: T[]; } + >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } + >list : (a: T) => T[] +->pipe(box) : (x: T[]) => { value: T[]; } ++>pipe(box) : (...args: [x: T[]]) => { value: T[]; } + >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } + >box : (x: V) => { value: V; } + +@@= skipped -11, +11 lines =@@ + >g07 : (x: T) => { value: T[]; } + >x : T + >value : T[] +->pipe(x => list(x), pipe(box)) : (x: T) => { value: T[]; } ++>pipe(x => list(x), pipe(box)) : (...args: [x: T]) => { value: T[]; } + >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } + >x => list(x) : (x: T) => T[] + >x : T + >list(x) : T[] + >list : (a: T) => T[] + >x : T +->pipe(box) : (x: T[]) => { value: T[]; } ++>pipe(box) : (...args: [x: T[]]) => { value: T[]; } + >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } + >box : (x: V) => { value: V; } + +@@= skipped -15, +15 lines =@@ + >g08 : (x: T) => { value: T[]; } + >x : T + >value : T[] +->pipe(x => list(x), pipe(x => box(x))) : (x: T) => { value: T[]; } ++>pipe(x => list(x), pipe(x => box(x))) : (...args: [x: T]) => { value: T[]; } + >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } + >x => list(x) : (x: T) => T[] + >x : T + >list(x) : T[] + >list : (a: T) => T[] + >x : T +->pipe(x => box(x)) : (x: T[]) => { value: T[]; } ++>pipe(x => box(x)) : (...args: [x: T[]]) => { value: T[]; } + >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } + >x => box(x) : (x: T[]) => { value: T[]; } + >x : T[] +@@= skipped -18, +18 lines =@@ + const g09: (x: T) => number = pipe(list, x => x.length); + >g09 : (x: T) => number + >x : T +->pipe(list, x => x.length) : (a: T) => number ++>pipe(list, x => x.length) : (...args: [a: T]) => number + >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } + >list : (a: T) => T[] + >x => x.length : (x: T[]) => number +@@= skipped -13, +13 lines =@@ + >g10 : (x: T) => T + >value : T + >x : T +->pipe(foo) : (x: T) => T ++>pipe(foo) : (...args: [x: T]) => T + >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } + >foo : (x: T) => T + +@@= skipped -8, +8 lines =@@ + >g12 : (x: T) => T + >value : T + >x : T +->pipe(foo, foo) : (x: T) => T ++>pipe(foo, foo) : (...args: [x: T]) => T + >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } + >foo : (x: T) => T + >foo : (x: T) => T +@@= skipped -163, +163 lines =@@ + } + + let f70 = pipe(list2, box); +->f70 : (a: T) => { value: T[]; } +->pipe(list2, box) : (a: T) => { value: T[]; } ++>f70 : (...args: [a: T]) => { value: T[]; } ++>pipe(list2, box) : (...args: [a: T]) => { value: T[]; } + >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } + >list2 : { (a: T): T[]; foo: string; bar(): number; } + >box : (x: V) => { value: V; } + + let f71 = pipe(box, list2); +->f71 : (x: V) => { value: V; }[] +->pipe(box, list2) : (x: V) => { value: V; }[] ++>f71 : (...args: [x: V]) => { value: V; }[] ++>pipe(box, list2) : (...args: [x: V]) => { value: V; }[] + >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } + >box : (x: V) => { value: V; } + >list2 : { (a: T): T[]; foo: string; bar(): number; } +@@= skipped -56, +56 lines =@@ + } + + const newPoint = asFunction(Point); +->newPoint : (x: number, y: number) => Point +->asFunction(Point) : (x: number, y: number) => Point ++>newPoint : (...args: [x: number, y: number]) => Point ++>asFunction(Point) : (...args: [x: number, y: number]) => Point + >asFunction : (cf: new (...args: A) => B) => (...args: A) => B + >Point : typeof Point + +@@= skipped -21, +21 lines =@@ + const p2 = newPoint(10, 20); + >p2 : Point + >newPoint(10, 20) : Point +->newPoint : (x: number, y: number) => Point ++>newPoint : (...args: [x: number, y: number]) => Point + >10 : 10 + >20 : 20 + +@@= skipped -243, +243 lines =@@ + >foo : 1 + + const enhance = pipe( +->enhance :

(C: Component

) => Component

+->pipe( myHoc1, myHoc2,) :

(C: Component

) => Component

++>enhance :

(...args: [C: Component

]) => Component

++>pipe( myHoc1, myHoc2,) :

(...args: [C: Component

]) => Component

+ >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } + + myHoc1, +@@= skipped -15, +15 lines =@@ + const MyComponent2 = enhance(MyComponent1); + >MyComponent2 : Component<{ foo: 1; }> + >enhance(MyComponent1) : Component<{ foo: 1; }> +->enhance :

(C: Component

) => Component

++>enhance :

(...args: [C: Component

]) => Component

+ >MyComponent1 : Component<{ foo: 1; }> + + // #29904.2 + + const fn20 = pipe((_a?: {}) => 1); +->fn20 : (_a?: {} | undefined) => number +->pipe((_a?: {}) => 1) : (_a?: {} | undefined) => number ++>fn20 : (...args: [_a?: {} | undefined]) => number ++>pipe((_a?: {}) => 1) : (...args: [_a?: {} | undefined]) => number >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } ->(_a?: {}) => 1 : (_a?: {}) => number +>(_a?: {}) => 1 : (_a?: {} | undefined) => number >_a : {} | undefined >1 : 1 -@@= skipped -167, +167 lines =@@ +@@= skipped -21, +21 lines =@@ + + const fn30: Fn = pipe( + >fn30 : Fn +->pipe( x => x + 1, x => x * 2,) : (x: number) => number ++>pipe( x => x + 1, x => x * 2,) : (...args: [x: number]) => number + >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } + + x => x + 1, +@@= skipped -34, +34 lines =@@ + >then : (onfulfilled?: ((value: number) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined) => Promise + + pipe( +->pipe( x => x + 1, x => x * 2, ) : (x: number) => number ++>pipe( x => x + 1, x => x * 2, ) : (...args: [x: number]) => number + >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } + + x => x + 1, +@@= skipped -34, +34 lines =@@ + >value : T + + const fn40 = pipe( +->fn40 : () => string | undefined +->pipe( getString, string => orUndefined(string), identity,) : () => string | undefined ++>fn40 : (...args: []) => string | undefined ++>pipe( getString, string => orUndefined(string), identity,) : (...args: []) => string | undefined + >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } + + getString, +@@= skipped -29, +29 lines =@@ + >ts : T[] + + const fn60 = pipe( +->fn60 : () => string +->pipe( getArray, x => x, first,) : () => string ++>fn60 : (...args: []) => string ++>pipe( getArray, x => x, first,) : (...args: []) => string + >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } + + getArray, +@@= skipped -18, +18 lines =@@ + ); + + const fn61 = pipe( +->fn61 : () => string +->pipe( getArray, identity, first,) : () => string ++>fn61 : (...args: []) => string ++>pipe( getArray, identity, first,) : (...args: []) => string + >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } + + getArray, +@@= skipped -16, +16 lines =@@ + ); + + const fn62 = pipe( +->fn62 : () => string +->pipe( getArray, x => x, x => first(x),) : () => string ++>fn62 : (...args: []) => string ++>pipe( getArray, x => x, x => first(x),) : (...args: []) => string + >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } + + getArray, +@@= skipped -24, +24 lines =@@ // Repro from #30297 declare function foo2(fn: T, a?: U, b?: U): [T, U]; diff --git a/testdata/baselines/reference/submodule/compiler/inferTypePredicates.js b/testdata/baselines/reference/submodule/compiler/inferTypePredicates.js index b2935a4b55..43233b3461 100644 --- a/testdata/baselines/reference/submodule/compiler/inferTypePredicates.js +++ b/testdata/baselines/reference/submodule/compiler/inferTypePredicates.js @@ -617,8 +617,8 @@ declare function assertAndPredicate(x: string | number | Date): x is string; declare let snd: string | number | Date; declare function isNumberWithThis(this: Date, x: number | string): x is number; declare function narrowFromAny(x: any): x is number; -declare const noInferenceFromRest: (f_0: "a" | "b") => boolean; -declare const noInferenceFromImpossibleRest: () => boolean; +declare const noInferenceFromRest: (...f: ["a" | "b"]) => boolean; +declare const noInferenceFromImpossibleRest: (...f: []) => boolean; declare function inferWithRest(x: string | null, ...f: ["a", "b"]): x is string; declare const foobar: { type: "foo"; diff --git a/testdata/baselines/reference/submodule/compiler/inferTypePredicates.js.diff b/testdata/baselines/reference/submodule/compiler/inferTypePredicates.js.diff index e93a7ca535..213d8c749d 100644 --- a/testdata/baselines/reference/submodule/compiler/inferTypePredicates.js.diff +++ b/testdata/baselines/reference/submodule/compiler/inferTypePredicates.js.diff @@ -33,18 +33,7 @@ } if (c.isC2()) { let c2 = c; // should error -@@= skipped -155, +152 lines =@@ - declare let snd: string | number | Date; - declare function isNumberWithThis(this: Date, x: number | string): x is number; - declare function narrowFromAny(x: any): x is number; --declare const noInferenceFromRest: (...f: ["a" | "b"]) => boolean; --declare const noInferenceFromImpossibleRest: (...f: []) => boolean; -+declare const noInferenceFromRest: (f_0: "a" | "b") => boolean; -+declare const noInferenceFromImpossibleRest: () => boolean; - declare function inferWithRest(x: string | null, ...f: ["a", "b"]): x is string; - declare const foobar: { - type: "foo"; -@@= skipped -10, +10 lines =@@ +@@= skipped -165, +162 lines =@@ type: "bar"; bar: string; }; diff --git a/testdata/baselines/reference/submodule/compiler/inferTypePredicates.types b/testdata/baselines/reference/submodule/compiler/inferTypePredicates.types index f047f50381..c476f1d8b7 100644 --- a/testdata/baselines/reference/submodule/compiler/inferTypePredicates.types +++ b/testdata/baselines/reference/submodule/compiler/inferTypePredicates.types @@ -949,8 +949,8 @@ function narrowFromAny(x: any) { } const noInferenceFromRest = (...f: ["a" | "b"]) => f[0] === "a"; ->noInferenceFromRest : (f_0: "a" | "b") => boolean ->(...f: ["a" | "b"]) => f[0] === "a" : (f_0: "a" | "b") => boolean +>noInferenceFromRest : (...f: ["a" | "b"]) => boolean +>(...f: ["a" | "b"]) => f[0] === "a" : (...f: ["a" | "b"]) => boolean >f : ["a" | "b"] >f[0] === "a" : boolean >f[0] : "a" | "b" @@ -959,8 +959,8 @@ const noInferenceFromRest = (...f: ["a" | "b"]) => f[0] === "a"; >"a" : "a" const noInferenceFromImpossibleRest = (...f: []) => typeof f === "undefined"; ->noInferenceFromImpossibleRest : () => boolean ->(...f: []) => typeof f === "undefined" : () => boolean +>noInferenceFromImpossibleRest : (...f: []) => boolean +>(...f: []) => typeof f === "undefined" : (...f: []) => boolean >f : [] >typeof f === "undefined" : boolean >typeof f : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" @@ -968,7 +968,7 @@ const noInferenceFromImpossibleRest = (...f: []) => typeof f === "undefined"; >"undefined" : "undefined" function inferWithRest(x: string | null, ...f: ["a", "b"]) { ->inferWithRest : (x: string | null, f_0: "a", f_1: "b") => x is string +>inferWithRest : (x: string | null, ...f: ["a", "b"]) => x is string >x : string | null >f : ["a", "b"] diff --git a/testdata/baselines/reference/submodule/compiler/inferTypePredicates.types.diff b/testdata/baselines/reference/submodule/compiler/inferTypePredicates.types.diff index 27e41e4855..48f6eac5fa 100644 --- a/testdata/baselines/reference/submodule/compiler/inferTypePredicates.types.diff +++ b/testdata/baselines/reference/submodule/compiler/inferTypePredicates.types.diff @@ -122,7 +122,38 @@ >this : Date >x : string | number -@@= skipped -66, +66 lines =@@ +@@= skipped -23, +23 lines =@@ + } + + const noInferenceFromRest = (...f: ["a" | "b"]) => f[0] === "a"; +->noInferenceFromRest : (f_0: "a" | "b") => boolean +->(...f: ["a" | "b"]) => f[0] === "a" : (f_0: "a" | "b") => boolean ++>noInferenceFromRest : (...f: ["a" | "b"]) => boolean ++>(...f: ["a" | "b"]) => f[0] === "a" : (...f: ["a" | "b"]) => boolean + >f : ["a" | "b"] + >f[0] === "a" : boolean + >f[0] : "a" | "b" +@@= skipped -10, +10 lines =@@ + >"a" : "a" + + const noInferenceFromImpossibleRest = (...f: []) => typeof f === "undefined"; +->noInferenceFromImpossibleRest : () => boolean +->(...f: []) => typeof f === "undefined" : () => boolean ++>noInferenceFromImpossibleRest : (...f: []) => boolean ++>(...f: []) => typeof f === "undefined" : (...f: []) => boolean + >f : [] + >typeof f === "undefined" : boolean + >typeof f : "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined" +@@= skipped -9, +9 lines =@@ + >"undefined" : "undefined" + + function inferWithRest(x: string | null, ...f: ["a", "b"]) { +->inferWithRest : (x: string | null, f_0: "a", f_1: "b") => x is string ++>inferWithRest : (x: string | null, ...f: ["a", "b"]) => x is string + >x : string | null + >f : ["a", "b"] + +@@= skipped -24, +24 lines =@@ >bar : string const foobarPred = (fb: typeof foobar) => fb.type === "foo"; diff --git a/testdata/baselines/reference/submodule/compiler/instantiateContextualTypes.types b/testdata/baselines/reference/submodule/compiler/instantiateContextualTypes.types index df149c3f88..1a6d4fc7f8 100644 --- a/testdata/baselines/reference/submodule/compiler/instantiateContextualTypes.types +++ b/testdata/baselines/reference/submodule/compiler/instantiateContextualTypes.types @@ -444,7 +444,7 @@ assignPartial(obj, { foo(...args) {} }); // args has type [string] >assignPartial(obj, { foo(...args) {} }) : { foo(bar: string): void; } >assignPartial : (target: T, partial: Partial) => T >obj : { foo(bar: string): void; } ->{ foo(...args) {} } : { foo(bar: string): void; } ->foo : (bar: string) => void +>{ foo(...args) {} } : { foo(...args: [bar: string]): void; } +>foo : (...args: [bar: string]) => void >args : [bar: string] diff --git a/testdata/baselines/reference/submodule/compiler/instantiateContextualTypes.types.diff b/testdata/baselines/reference/submodule/compiler/instantiateContextualTypes.types.diff index 91f4e59054..f159922f00 100644 --- a/testdata/baselines/reference/submodule/compiler/instantiateContextualTypes.types.diff +++ b/testdata/baselines/reference/submodule/compiler/instantiateContextualTypes.types.diff @@ -73,4 +73,13 @@ +>createElement2 :

(type: ComponentClass

, child: P extends { children?: infer C | undefined; } ? C extends any[] ? C : C[] : unknown) => any >InferFunctionTypes : typeof InferFunctionTypes >[(foo) => "" + foo] : ((foo: number) => string)[] - >(foo) => "" + foo : (foo: number) => string \ No newline at end of file + >(foo) => "" + foo : (foo: number) => string +@@= skipped -171, +171 lines =@@ + >assignPartial(obj, { foo(...args) {} }) : { foo(bar: string): void; } + >assignPartial : (target: T, partial: Partial) => T + >obj : { foo(bar: string): void; } +->{ foo(...args) {} } : { foo(bar: string): void; } +->foo : (bar: string) => void ++>{ foo(...args) {} } : { foo(...args: [bar: string]): void; } ++>foo : (...args: [bar: string]) => void + >args : [bar: string] diff --git a/testdata/baselines/reference/submodule/compiler/multiSignatureTypeInference.types b/testdata/baselines/reference/submodule/compiler/multiSignatureTypeInference.types index 3b92c8da57..ba770a580c 100644 --- a/testdata/baselines/reference/submodule/compiler/multiSignatureTypeInference.types +++ b/testdata/baselines/reference/submodule/compiler/multiSignatureTypeInference.types @@ -79,15 +79,15 @@ type InferTwoOverloads = never; type Expected = InferTwoOverloads<((x: string) => number) & (() => string)>; // [(x: string) => number, () => string] ->Expected : [(x: string) => number, () => string] +>Expected : [(...a1: [x: string]) => number, (...a0: []) => string] >x : string type JustOneSignature = InferTwoOverloads<((x: string) => number)>; // [(x: string) => number, (x: string) => number] ->JustOneSignature : [(x: string) => number, (x: string) => number] +>JustOneSignature : [(...a1: [x: string]) => number, (...a0: [x: string]) => number] >x : string type JustTheOtherSignature = InferTwoOverloads<(() => string)>; // [() => string, () => string] ->JustTheOtherSignature : [() => string, () => string] +>JustTheOtherSignature : [(...a1: []) => string, (...a0: []) => string] // Repro from #28867 diff --git a/testdata/baselines/reference/submodule/compiler/multiSignatureTypeInference.types.diff b/testdata/baselines/reference/submodule/compiler/multiSignatureTypeInference.types.diff new file mode 100644 index 0000000000..c5763c287d --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/multiSignatureTypeInference.types.diff @@ -0,0 +1,20 @@ +--- old.multiSignatureTypeInference.types ++++ new.multiSignatureTypeInference.types +@@= skipped -78, +78 lines =@@ + never; + + type Expected = InferTwoOverloads<((x: string) => number) & (() => string)>; // [(x: string) => number, () => string] +->Expected : [(x: string) => number, () => string] ++>Expected : [(...a1: [x: string]) => number, (...a0: []) => string] + >x : string + + type JustOneSignature = InferTwoOverloads<((x: string) => number)>; // [(x: string) => number, (x: string) => number] +->JustOneSignature : [(x: string) => number, (x: string) => number] ++>JustOneSignature : [(...a1: [x: string]) => number, (...a0: [x: string]) => number] + >x : string + + type JustTheOtherSignature = InferTwoOverloads<(() => string)>; // [() => string, () => string] +->JustTheOtherSignature : [() => string, () => string] ++>JustTheOtherSignature : [(...a1: []) => string, (...a0: []) => string] + + // Repro from #28867 diff --git a/testdata/baselines/reference/submodule/compiler/nonInferrableTypePropagation3.types b/testdata/baselines/reference/submodule/compiler/nonInferrableTypePropagation3.types index caf79f6cb0..201ae332f2 100644 --- a/testdata/baselines/reference/submodule/compiler/nonInferrableTypePropagation3.types +++ b/testdata/baselines/reference/submodule/compiler/nonInferrableTypePropagation3.types @@ -21,8 +21,8 @@ const make = factory<{id: string, age: number}[]>(); >age : number const usersOverAge = make((age: number) => data => { ->usersOverAge : (age: number) => { id: string; age: number; }[] ->make((age: number) => data => { return data.filter(user => user.age >= age);}) : (age: number) => { id: string; age: number; }[] +>usersOverAge : (...args: [age: number]) => { id: string; age: number; }[] +>make((age: number) => data => { return data.filter(user => user.age >= age);}) : (...args: [age: number]) => { id: string; age: number; }[] >make : (callback: Callback) => (...args: Args) => R >(age: number) => data => { return data.filter(user => user.age >= age);} : (age: number) => (data: { id: string; age: number; }[]) => { id: string; age: number; }[] >age : number diff --git a/testdata/baselines/reference/submodule/compiler/nonInferrableTypePropagation3.types.diff b/testdata/baselines/reference/submodule/compiler/nonInferrableTypePropagation3.types.diff new file mode 100644 index 0000000000..1182880172 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/nonInferrableTypePropagation3.types.diff @@ -0,0 +1,13 @@ +--- old.nonInferrableTypePropagation3.types ++++ new.nonInferrableTypePropagation3.types +@@= skipped -20, +20 lines =@@ + >age : number + + const usersOverAge = make((age: number) => data => { +->usersOverAge : (age: number) => { id: string; age: number; }[] +->make((age: number) => data => { return data.filter(user => user.age >= age);}) : (age: number) => { id: string; age: number; }[] ++>usersOverAge : (...args: [age: number]) => { id: string; age: number; }[] ++>make((age: number) => data => { return data.filter(user => user.age >= age);}) : (...args: [age: number]) => { id: string; age: number; }[] + >make : (callback: Callback) => (...args: Args) => R + >(age: number) => data => { return data.filter(user => user.age >= age);} : (age: number) => (data: { id: string; age: number; }[]) => { id: string; age: number; }[] + >age : number \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/parameterListAsTupleType.types b/testdata/baselines/reference/submodule/compiler/parameterListAsTupleType.types index ceb5ccbc74..ffc5b32bdd 100644 --- a/testdata/baselines/reference/submodule/compiler/parameterListAsTupleType.types +++ b/testdata/baselines/reference/submodule/compiler/parameterListAsTupleType.types @@ -29,7 +29,7 @@ const a: Xps = ['should-not-work']; // works, but shouldn't >'should-not-work' : "should-not-work" function t(...args: Xps) {} // should work ->t : (a: number) => void +>t : (...args: [a: number]) => void >args : [a: number] class C { diff --git a/testdata/baselines/reference/submodule/compiler/parameterListAsTupleType.types.diff b/testdata/baselines/reference/submodule/compiler/parameterListAsTupleType.types.diff new file mode 100644 index 0000000000..2a40bc1708 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/parameterListAsTupleType.types.diff @@ -0,0 +1,11 @@ +--- old.parameterListAsTupleType.types ++++ new.parameterListAsTupleType.types +@@= skipped -28, +28 lines =@@ + >'should-not-work' : "should-not-work" + + function t(...args: Xps) {} // should work +->t : (a: number) => void ++>t : (...args: [a: number]) => void + >args : [a: number] + + class C { \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/reactReduxLikeDeferredInferenceAllowsAssignment.types b/testdata/baselines/reference/submodule/compiler/reactReduxLikeDeferredInferenceAllowsAssignment.types index 87f10750b0..517fc964de 100644 --- a/testdata/baselines/reference/submodule/compiler/reactReduxLikeDeferredInferenceAllowsAssignment.types +++ b/testdata/baselines/reference/submodule/compiler/reactReduxLikeDeferredInferenceAllowsAssignment.types @@ -266,7 +266,7 @@ type Q = HandleThunkActionCreator; const Test1 = connect( >Test1 : ConnectedComponentClass> >connect( null, mapDispatchToProps)(TestComponent) : ConnectedComponentClass> ->connect( null, mapDispatchToProps) : InferableComponentEnhancerWithProps<{ simpleAction: (payload: boolean) => { type: string; payload: boolean; }; thunkAction: (param1: number, param2: string) => Promise; }, {}> +>connect( null, mapDispatchToProps) : InferableComponentEnhancerWithProps<{ simpleAction: (payload: boolean) => { type: string; payload: boolean; }; thunkAction: (...args: [param1: number, param2: string]) => Promise; }, {}> >connect : (mapStateToProps: null | undefined, mapDispatchToProps: TDispatchProps) => InferableComponentEnhancerWithProps, TOwnProps> null, diff --git a/testdata/baselines/reference/submodule/compiler/reactReduxLikeDeferredInferenceAllowsAssignment.types.diff b/testdata/baselines/reference/submodule/compiler/reactReduxLikeDeferredInferenceAllowsAssignment.types.diff index 8ad2f70d65..afd9689558 100644 --- a/testdata/baselines/reference/submodule/compiler/reactReduxLikeDeferredInferenceAllowsAssignment.types.diff +++ b/testdata/baselines/reference/submodule/compiler/reactReduxLikeDeferredInferenceAllowsAssignment.types.diff @@ -47,7 +47,13 @@ type Q = HandleThunkActionCreator; >Q : (payload: boolean) => { type: string; payload: boolean; } -@@= skipped -17, +17 lines =@@ +@@= skipped -12, +12 lines =@@ + const Test1 = connect( + >Test1 : ConnectedComponentClass> + >connect( null, mapDispatchToProps)(TestComponent) : ConnectedComponentClass> +->connect( null, mapDispatchToProps) : InferableComponentEnhancerWithProps<{ simpleAction: (payload: boolean) => { type: string; payload: boolean; }; thunkAction: (param1: number, param2: string) => Promise; }, {}> ++>connect( null, mapDispatchToProps) : InferableComponentEnhancerWithProps<{ simpleAction: (payload: boolean) => { type: string; payload: boolean; }; thunkAction: (...args: [param1: number, param2: string]) => Promise; }, {}> + >connect : (mapStateToProps: null | undefined, mapDispatchToProps: TDispatchProps) => InferableComponentEnhancerWithProps, TOwnProps> null, mapDispatchToProps diff --git a/testdata/baselines/reference/submodule/compiler/restParameterWithBindingPattern2.types b/testdata/baselines/reference/submodule/compiler/restParameterWithBindingPattern2.types index cc1bf6b96d..c44cc6ec7d 100644 --- a/testdata/baselines/reference/submodule/compiler/restParameterWithBindingPattern2.types +++ b/testdata/baselines/reference/submodule/compiler/restParameterWithBindingPattern2.types @@ -2,7 +2,7 @@ === restParameterWithBindingPattern2.ts === function a(...[a, b]) { } ->a : (a: any, b: any) => void +>a : (...[a, b]: [any, any]) => void >a : any >b : any diff --git a/testdata/baselines/reference/submodule/compiler/restParameterWithBindingPattern2.types.diff b/testdata/baselines/reference/submodule/compiler/restParameterWithBindingPattern2.types.diff new file mode 100644 index 0000000000..2cea45bb0f --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/restParameterWithBindingPattern2.types.diff @@ -0,0 +1,10 @@ +--- old.restParameterWithBindingPattern2.types ++++ new.restParameterWithBindingPattern2.types +@@= skipped -1, +1 lines =@@ + + === restParameterWithBindingPattern2.ts === + function a(...[a, b]) { } +->a : (a: any, b: any) => void ++>a : (...[a, b]: [any, any]) => void + >a : any + >b : any diff --git a/testdata/baselines/reference/submodule/compiler/restParameterWithBindingPattern3.types b/testdata/baselines/reference/submodule/compiler/restParameterWithBindingPattern3.types index 23efbca1d9..67f06d7e68 100644 --- a/testdata/baselines/reference/submodule/compiler/restParameterWithBindingPattern3.types +++ b/testdata/baselines/reference/submodule/compiler/restParameterWithBindingPattern3.types @@ -14,18 +14,18 @@ function b(...[...foo = []]: string[]) { } >[] : undefined[] function c(...{0: a, length, 3: d}: [boolean, string, number]) { } ->c : (arg_0: boolean, arg_1: string, arg_2: number) => void +>c : (...{ 0: a, length, 3: d }: [boolean, string, number]) => void >a : boolean >length : 3 >d : undefined function d(...[a, , , d]: [boolean, string, number]) { } ->d : (a: boolean, arg_1: string, arg_2: number) => void +>d : (...[a, , , d]: [boolean, string, number]) => void >a : boolean >d : undefined function e(...{0: a = 1, 1: b = true, ...rest: rest}: [boolean, string, number]) { } ->e : (arg_0: boolean, arg_1: string, arg_2: number) => void +>e : (...{ 0: a, 1: b, ...rest: rest }: [boolean, string, number]) => void >a : boolean >1 : 1 >b : string diff --git a/testdata/baselines/reference/submodule/compiler/restParameterWithBindingPattern3.types.diff b/testdata/baselines/reference/submodule/compiler/restParameterWithBindingPattern3.types.diff new file mode 100644 index 0000000000..65f193e041 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/restParameterWithBindingPattern3.types.diff @@ -0,0 +1,24 @@ +--- old.restParameterWithBindingPattern3.types ++++ new.restParameterWithBindingPattern3.types +@@= skipped -13, +13 lines =@@ + >[] : undefined[] + + function c(...{0: a, length, 3: d}: [boolean, string, number]) { } +->c : (arg_0: boolean, arg_1: string, arg_2: number) => void ++>c : (...{ 0: a, length, 3: d }: [boolean, string, number]) => void + >a : boolean + >length : 3 + >d : undefined + + function d(...[a, , , d]: [boolean, string, number]) { } +->d : (a: boolean, arg_1: string, arg_2: number) => void ++>d : (...[a, , , d]: [boolean, string, number]) => void + >a : boolean + >d : undefined + + function e(...{0: a = 1, 1: b = true, ...rest: rest}: [boolean, string, number]) { } +->e : (arg_0: boolean, arg_1: string, arg_2: number) => void ++>e : (...{ 0: a, 1: b, ...rest: rest }: [boolean, string, number]) => void + >a : boolean + >1 : 1 + >b : string \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/signatureCombiningRestParameters1.types b/testdata/baselines/reference/submodule/compiler/signatureCombiningRestParameters1.types index 2671e9447f..c53457c137 100644 --- a/testdata/baselines/reference/submodule/compiler/signatureCombiningRestParameters1.types +++ b/testdata/baselines/reference/submodule/compiler/signatureCombiningRestParameters1.types @@ -18,7 +18,7 @@ type T2 = { }; declare const map: { ->map : { A: () => unknown; B: () => unknown; C: (args_0: string) => unknown; D: (args_0: number) => unknown; } +>map : { A: (...args: []) => unknown; B: (...args: []) => unknown; C: (...args: [string]) => unknown; D: (...args: [number]) => unknown; } [K in T1 | keyof T2]: (...args: K extends keyof T2 ? T2[K] : []) => unknown; >args : K extends keyof T2 ? T2[K] : [] @@ -30,22 +30,22 @@ declare const args: any; for (const [key, fn] of Object.entries(map)) { >key : string ->fn : (() => unknown) | (() => unknown) | ((args_0: string) => unknown) | ((args_0: number) => unknown) ->Object.entries(map) : [string, (() => unknown) | (() => unknown) | ((args_0: string) => unknown) | ((args_0: number) => unknown)][] +>fn : ((...args: []) => unknown) | ((...args: []) => unknown) | ((...args: [string]) => unknown) | ((...args: [number]) => unknown) +>Object.entries(map) : [string, ((...args: []) => unknown) | ((...args: []) => unknown) | ((...args: [string]) => unknown) | ((...args: [number]) => unknown)][] >Object.entries : { (o: ArrayLike | { [s: string]: T; }): [string, T][]; (o: {}): [string, any][]; } >Object : ObjectConstructor >entries : { (o: ArrayLike | { [s: string]: T; }): [string, T][]; (o: {}): [string, any][]; } ->map : { A: () => unknown; B: () => unknown; C: (args_0: string) => unknown; D: (args_0: number) => unknown; } +>map : { A: (...args: []) => unknown; B: (...args: []) => unknown; C: (...args: [string]) => unknown; D: (...args: [number]) => unknown; } fn(...args); >fn(...args) : unknown ->fn : (() => unknown) | (() => unknown) | ((args_0: string) => unknown) | ((args_0: number) => unknown) +>fn : ((...args: []) => unknown) | ((...args: []) => unknown) | ((...args: [string]) => unknown) | ((...args: [number]) => unknown) >...args : any >args : any } const test2: ((a: number, ...args: []) => void) & ->test2 : ((a: number) => void) & ((b: string) => void) & ((c: boolean) => void) +>test2 : ((a: number, ...args: []) => void) & ((b: string) => void) & ((c: boolean) => void) >a : number >args : [] diff --git a/testdata/baselines/reference/submodule/compiler/signatureCombiningRestParameters1.types.diff b/testdata/baselines/reference/submodule/compiler/signatureCombiningRestParameters1.types.diff index 4aa84238dc..923c600d8b 100644 --- a/testdata/baselines/reference/submodule/compiler/signatureCombiningRestParameters1.types.diff +++ b/testdata/baselines/reference/submodule/compiler/signatureCombiningRestParameters1.types.diff @@ -1,14 +1,40 @@ --- old.signatureCombiningRestParameters1.types +++ new.signatureCombiningRestParameters1.types -@@= skipped -31, +31 lines =@@ +@@= skipped -17, +17 lines =@@ + }; + + declare const map: { +->map : { A: () => unknown; B: () => unknown; C: (args_0: string) => unknown; D: (args_0: number) => unknown; } ++>map : { A: (...args: []) => unknown; B: (...args: []) => unknown; C: (...args: [string]) => unknown; D: (...args: [number]) => unknown; } + + [K in T1 | keyof T2]: (...args: K extends keyof T2 ? T2[K] : []) => unknown; + >args : K extends keyof T2 ? T2[K] : [] +@@= skipped -12, +12 lines =@@ + + for (const [key, fn] of Object.entries(map)) { >key : string - >fn : (() => unknown) | (() => unknown) | ((args_0: string) => unknown) | ((args_0: number) => unknown) - >Object.entries(map) : [string, (() => unknown) | (() => unknown) | ((args_0: string) => unknown) | ((args_0: number) => unknown)][] +->fn : (() => unknown) | (() => unknown) | ((args_0: string) => unknown) | ((args_0: number) => unknown) +->Object.entries(map) : [string, (() => unknown) | (() => unknown) | ((args_0: string) => unknown) | ((args_0: number) => unknown)][] ->Object.entries : { (o: { [s: string]: T; } | ArrayLike): [string, T][]; (o: {}): [string, any][]; } ++>fn : ((...args: []) => unknown) | ((...args: []) => unknown) | ((...args: [string]) => unknown) | ((...args: [number]) => unknown) ++>Object.entries(map) : [string, ((...args: []) => unknown) | ((...args: []) => unknown) | ((...args: [string]) => unknown) | ((...args: [number]) => unknown)][] +>Object.entries : { (o: ArrayLike | { [s: string]: T; }): [string, T][]; (o: {}): [string, any][]; } >Object : ObjectConstructor ->entries : { (o: { [s: string]: T; } | ArrayLike): [string, T][]; (o: {}): [string, any][]; } +->map : { A: () => unknown; B: () => unknown; C: (args_0: string) => unknown; D: (args_0: number) => unknown; } +>entries : { (o: ArrayLike | { [s: string]: T; }): [string, T][]; (o: {}): [string, any][]; } - >map : { A: () => unknown; B: () => unknown; C: (args_0: string) => unknown; D: (args_0: number) => unknown; } ++>map : { A: (...args: []) => unknown; B: (...args: []) => unknown; C: (...args: [string]) => unknown; D: (...args: [number]) => unknown; } + + fn(...args); + >fn(...args) : unknown +->fn : (() => unknown) | (() => unknown) | ((args_0: string) => unknown) | ((args_0: number) => unknown) ++>fn : ((...args: []) => unknown) | ((...args: []) => unknown) | ((...args: [string]) => unknown) | ((...args: [number]) => unknown) + >...args : any + >args : any + } - fn(...args); \ No newline at end of file + const test2: ((a: number, ...args: []) => void) & +->test2 : ((a: number) => void) & ((b: string) => void) & ((c: boolean) => void) ++>test2 : ((a: number, ...args: []) => void) & ((b: string) => void) & ((c: boolean) => void) + >a : number + >args : [] diff --git a/testdata/baselines/reference/submodule/compiler/signatureCombiningRestParameters2.types b/testdata/baselines/reference/submodule/compiler/signatureCombiningRestParameters2.types index 77c4c594f4..a0e4bed547 100644 --- a/testdata/baselines/reference/submodule/compiler/signatureCombiningRestParameters2.types +++ b/testdata/baselines/reference/submodule/compiler/signatureCombiningRestParameters2.types @@ -19,11 +19,11 @@ let originalLog: typeof console.log; >log : { (...data: any[]): void; (message?: any, ...optionalParams: any[]): void; } console.log = (...args) => { ->console.log = (...args) => { logs.push(...args);} : (args_0?: any, ...args: any[]) => void +>console.log = (...args) => { logs.push(...args);} : (...args: [any?, ...any[]]) => void >console.log : { (...data: any[]): void; (message?: any, ...optionalParams: any[]): void; } >console : Console >log : { (...data: any[]): void; (message?: any, ...optionalParams: any[]): void; } ->(...args) => { logs.push(...args);} : (args_0?: any, ...args: any[]) => void +>(...args) => { logs.push(...args);} : (...args: [any?, ...any[]]) => void >args : [any?, ...any[]] logs.push(...args); diff --git a/testdata/baselines/reference/submodule/compiler/signatureCombiningRestParameters2.types.diff b/testdata/baselines/reference/submodule/compiler/signatureCombiningRestParameters2.types.diff new file mode 100644 index 0000000000..0b9f95409a --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/signatureCombiningRestParameters2.types.diff @@ -0,0 +1,16 @@ +--- old.signatureCombiningRestParameters2.types ++++ new.signatureCombiningRestParameters2.types +@@= skipped -18, +18 lines =@@ + >log : { (...data: any[]): void; (message?: any, ...optionalParams: any[]): void; } + + console.log = (...args) => { +->console.log = (...args) => { logs.push(...args);} : (args_0?: any, ...args: any[]) => void ++>console.log = (...args) => { logs.push(...args);} : (...args: [any?, ...any[]]) => void + >console.log : { (...data: any[]): void; (message?: any, ...optionalParams: any[]): void; } + >console : Console + >log : { (...data: any[]): void; (message?: any, ...optionalParams: any[]): void; } +->(...args) => { logs.push(...args);} : (args_0?: any, ...args: any[]) => void ++>(...args) => { logs.push(...args);} : (...args: [any?, ...any[]]) => void + >args : [any?, ...any[]] + + logs.push(...args); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/signatureCombiningRestParameters3.types b/testdata/baselines/reference/submodule/compiler/signatureCombiningRestParameters3.types index b03f07af97..b86c2a1d07 100644 --- a/testdata/baselines/reference/submodule/compiler/signatureCombiningRestParameters3.types +++ b/testdata/baselines/reference/submodule/compiler/signatureCombiningRestParameters3.types @@ -148,8 +148,8 @@ declare function getExtensionField( ): RemoveThis; const extendMarkSchema = getExtensionField( ->extendMarkSchema : ((extension: Mark) => Record) | ((extension: Node) => Record) | ((extension: Mark) => Record) | null | undefined ->getExtensionField( e, "extendMarkSchema",) : ((extension: Mark) => Record) | ((extension: Node) => Record) | ((extension: Mark) => Record) | null | undefined +>extendMarkSchema : ((...args: [extension: Mark]) => Record) | ((...args: [extension: Node]) => Record) | ((...args: [extension: Mark]) => Record) | null | undefined +>getExtensionField( e, "extendMarkSchema",) : ((...args: [extension: Mark]) => Record) | ((...args: [extension: Node]) => Record) | ((...args: [extension: Mark]) => Record) | null | undefined >getExtensionField : (extension: AnyExtension, field: string) => RemoveThis e, @@ -164,11 +164,11 @@ declare const extension: Mark; >extension : Mark if (extendMarkSchema) { ->extendMarkSchema : ((extension: Mark) => Record) | ((extension: Node) => Record) | ((extension: Mark) => Record) | null | undefined +>extendMarkSchema : ((...args: [extension: Mark]) => Record) | ((...args: [extension: Node]) => Record) | ((...args: [extension: Mark]) => Record) | null | undefined extendMarkSchema(extension); // error >extendMarkSchema(extension) : Record ->extendMarkSchema : ((extension: Mark) => Record) | ((extension: Node) => Record) | ((extension: Mark) => Record) +>extendMarkSchema : ((...args: [extension: Mark]) => Record) | ((...args: [extension: Node]) => Record) | ((...args: [extension: Mark]) => Record) >extension : Mark } diff --git a/testdata/baselines/reference/submodule/compiler/signatureCombiningRestParameters3.types.diff b/testdata/baselines/reference/submodule/compiler/signatureCombiningRestParameters3.types.diff index 7980e8ac82..43412a249b 100644 --- a/testdata/baselines/reference/submodule/compiler/signatureCombiningRestParameters3.types.diff +++ b/testdata/baselines/reference/submodule/compiler/signatureCombiningRestParameters3.types.diff @@ -26,4 +26,28 @@ +>extendMarkSchema : ((this: { name: string; options: Options; }, extension: Mark) => Record) | null | undefined | (( - this: { \ No newline at end of file + this: { +@@= skipped -50, +50 lines =@@ + ): RemoveThis; + + const extendMarkSchema = getExtensionField( +->extendMarkSchema : ((extension: Mark) => Record) | ((extension: Node) => Record) | ((extension: Mark) => Record) | null | undefined +->getExtensionField( e, "extendMarkSchema",) : ((extension: Mark) => Record) | ((extension: Node) => Record) | ((extension: Mark) => Record) | null | undefined ++>extendMarkSchema : ((...args: [extension: Mark]) => Record) | ((...args: [extension: Node]) => Record) | ((...args: [extension: Mark]) => Record) | null | undefined ++>getExtensionField( e, "extendMarkSchema",) : ((...args: [extension: Mark]) => Record) | ((...args: [extension: Node]) => Record) | ((...args: [extension: Mark]) => Record) | null | undefined + >getExtensionField : (extension: AnyExtension, field: string) => RemoveThis + + e, +@@= skipped -16, +16 lines =@@ + >extension : Mark + + if (extendMarkSchema) { +->extendMarkSchema : ((extension: Mark) => Record) | ((extension: Node) => Record) | ((extension: Mark) => Record) | null | undefined ++>extendMarkSchema : ((...args: [extension: Mark]) => Record) | ((...args: [extension: Node]) => Record) | ((...args: [extension: Mark]) => Record) | null | undefined + + extendMarkSchema(extension); // error + >extendMarkSchema(extension) : Record +->extendMarkSchema : ((extension: Mark) => Record) | ((extension: Node) => Record) | ((extension: Mark) => Record) ++>extendMarkSchema : ((...args: [extension: Mark]) => Record) | ((...args: [extension: Node]) => Record) | ((...args: [extension: Mark]) => Record) + >extension : Mark + } diff --git a/testdata/baselines/reference/submodule/compiler/signatureCombiningRestParameters4.types b/testdata/baselines/reference/submodule/compiler/signatureCombiningRestParameters4.types index 046d7ed9a4..41639e55b9 100644 --- a/testdata/baselines/reference/submodule/compiler/signatureCombiningRestParameters4.types +++ b/testdata/baselines/reference/submodule/compiler/signatureCombiningRestParameters4.types @@ -104,8 +104,8 @@ declare function getExtensionField( ): RemoveThis; const extendMarkSchema = getExtensionField( ->extendMarkSchema : ((extension: Node) => Record) | ((extension: Mark) => Record) | null | undefined ->getExtensionField( e, "extendMarkSchema",) : ((extension: Node) => Record) | ((extension: Mark) => Record) | null | undefined +>extendMarkSchema : ((...args: [extension: Node]) => Record) | ((...args: [extension: Mark]) => Record) | null | undefined +>getExtensionField( e, "extendMarkSchema",) : ((...args: [extension: Node]) => Record) | ((...args: [extension: Mark]) => Record) | null | undefined >getExtensionField : (extension: AnyExtension, field: string) => RemoveThis e, @@ -120,11 +120,11 @@ declare const extension: Mark; >extension : Mark if (extendMarkSchema) { ->extendMarkSchema : ((extension: Node) => Record) | ((extension: Mark) => Record) | null | undefined +>extendMarkSchema : ((...args: [extension: Node]) => Record) | ((...args: [extension: Mark]) => Record) | null | undefined extendMarkSchema(extension); // error >extendMarkSchema(extension) : Record ->extendMarkSchema : ((extension: Node) => Record) | ((extension: Mark) => Record) +>extendMarkSchema : ((...args: [extension: Node]) => Record) | ((...args: [extension: Mark]) => Record) >extension : Mark } diff --git a/testdata/baselines/reference/submodule/compiler/signatureCombiningRestParameters4.types.diff b/testdata/baselines/reference/submodule/compiler/signatureCombiningRestParameters4.types.diff index add33357cf..0671ef37f1 100644 --- a/testdata/baselines/reference/submodule/compiler/signatureCombiningRestParameters4.types.diff +++ b/testdata/baselines/reference/submodule/compiler/signatureCombiningRestParameters4.types.diff @@ -17,4 +17,28 @@ +>extendMarkSchema : ((this: { name: string; options: Options; }, extension: Mark) => Record) | null | undefined | (( - this: { \ No newline at end of file + this: { +@@= skipped -50, +50 lines =@@ + ): RemoveThis; + + const extendMarkSchema = getExtensionField( +->extendMarkSchema : ((extension: Node) => Record) | ((extension: Mark) => Record) | null | undefined +->getExtensionField( e, "extendMarkSchema",) : ((extension: Node) => Record) | ((extension: Mark) => Record) | null | undefined ++>extendMarkSchema : ((...args: [extension: Node]) => Record) | ((...args: [extension: Mark]) => Record) | null | undefined ++>getExtensionField( e, "extendMarkSchema",) : ((...args: [extension: Node]) => Record) | ((...args: [extension: Mark]) => Record) | null | undefined + >getExtensionField : (extension: AnyExtension, field: string) => RemoveThis + + e, +@@= skipped -16, +16 lines =@@ + >extension : Mark + + if (extendMarkSchema) { +->extendMarkSchema : ((extension: Node) => Record) | ((extension: Mark) => Record) | null | undefined ++>extendMarkSchema : ((...args: [extension: Node]) => Record) | ((...args: [extension: Mark]) => Record) | null | undefined + + extendMarkSchema(extension); // error + >extendMarkSchema(extension) : Record +->extendMarkSchema : ((extension: Node) => Record) | ((extension: Mark) => Record) ++>extendMarkSchema : ((...args: [extension: Node]) => Record) | ((...args: [extension: Mark]) => Record) + >extension : Mark + } diff --git a/testdata/baselines/reference/submodule/compiler/signatureCombiningRestParameters5.types b/testdata/baselines/reference/submodule/compiler/signatureCombiningRestParameters5.types index 94d606310d..104c3341ab 100644 --- a/testdata/baselines/reference/submodule/compiler/signatureCombiningRestParameters5.types +++ b/testdata/baselines/reference/submodule/compiler/signatureCombiningRestParameters5.types @@ -2,7 +2,7 @@ === signatureCombiningRestParameters5.ts === declare const test1: ->test1 : ((a: string | number, b: number | boolean) => void) | ((c: number | boolean, d: string | boolean) => void) +>test1 : ((...args: [a: string | number, b: number | boolean]) => void) | ((...args: [c: number | boolean, d: string | boolean]) => void) | ((...args: [a: string | number, b: number | boolean]) => void) >args : [a: string | number, b: number | boolean] @@ -12,13 +12,13 @@ declare const test1: test1(42, true); >test1(42, true) : void ->test1 : ((a: string | number, b: number | boolean) => void) | ((c: number | boolean, d: string | boolean) => void) +>test1 : ((...args: [a: string | number, b: number | boolean]) => void) | ((...args: [c: number | boolean, d: string | boolean]) => void) >42 : 42 >true : true test1(42, [true]); // error >test1(42, [true]) : void ->test1 : ((a: string | number, b: number | boolean) => void) | ((c: number | boolean, d: string | boolean) => void) +>test1 : ((...args: [a: string | number, b: number | boolean]) => void) | ((...args: [c: number | boolean, d: string | boolean]) => void) >42 : 42 >[true] : boolean[] >true : true @@ -60,18 +60,18 @@ test2( >d : number | boolean (cb) => { ->(cb) => { cb(true, 42); cb(true, [42]); // error } : (cb: ((a: number | boolean, b: string | number) => void) | ((c: string | boolean, d: number | boolean) => void)) => void ->cb : ((a: number | boolean, b: string | number) => void) | ((c: string | boolean, d: number | boolean) => void) +>(cb) => { cb(true, 42); cb(true, [42]); // error } : (cb: ((...args: [a: number | boolean, b: string | number]) => void) | ((...args: [c: string | boolean, d: number | boolean]) => void)) => void +>cb : ((...args: [a: number | boolean, b: string | number]) => void) | ((...args: [c: string | boolean, d: number | boolean]) => void) cb(true, 42); >cb(true, 42) : void ->cb : ((a: number | boolean, b: string | number) => void) | ((c: string | boolean, d: number | boolean) => void) +>cb : ((...args: [a: number | boolean, b: string | number]) => void) | ((...args: [c: string | boolean, d: number | boolean]) => void) >true : true >42 : 42 cb(true, [42]); // error >cb(true, [42]) : void ->cb : ((a: number | boolean, b: string | number) => void) | ((c: string | boolean, d: number | boolean) => void) +>cb : ((...args: [a: number | boolean, b: string | number]) => void) | ((...args: [c: string | boolean, d: number | boolean]) => void) >true : true >[42] : number[] >42 : 42 diff --git a/testdata/baselines/reference/submodule/compiler/signatureCombiningRestParameters5.types.diff b/testdata/baselines/reference/submodule/compiler/signatureCombiningRestParameters5.types.diff index f82756ce83..ced228f050 100644 --- a/testdata/baselines/reference/submodule/compiler/signatureCombiningRestParameters5.types.diff +++ b/testdata/baselines/reference/submodule/compiler/signatureCombiningRestParameters5.types.diff @@ -1,6 +1,29 @@ --- old.signatureCombiningRestParameters5.types +++ new.signatureCombiningRestParameters5.types -@@= skipped -23, +23 lines =@@ +@@= skipped -1, +1 lines =@@ + + === signatureCombiningRestParameters5.ts === + declare const test1: +->test1 : ((a: string | number, b: number | boolean) => void) | ((c: number | boolean, d: string | boolean) => void) ++>test1 : ((...args: [a: string | number, b: number | boolean]) => void) | ((...args: [c: number | boolean, d: string | boolean]) => void) + + | ((...args: [a: string | number, b: number | boolean]) => void) + >args : [a: string | number, b: number | boolean] +@@= skipped -10, +10 lines =@@ + + test1(42, true); + >test1(42, true) : void +->test1 : ((a: string | number, b: number | boolean) => void) | ((c: number | boolean, d: string | boolean) => void) ++>test1 : ((...args: [a: string | number, b: number | boolean]) => void) | ((...args: [c: number | boolean, d: string | boolean]) => void) + >42 : 42 + >true : true + + test1(42, [true]); // error + >test1(42, [true]) : void +->test1 : ((a: string | number, b: number | boolean) => void) | ((c: number | boolean, d: string | boolean) => void) ++>test1 : ((...args: [a: string | number, b: number | boolean]) => void) | ((...args: [c: number | boolean, d: string | boolean]) => void) + >42 : 42 + >[true] : boolean[] >true : true declare function test2< @@ -9,7 +32,7 @@ A extends readonly unknown[], B extends readonly unknown[], -@@= skipped -14, +14 lines =@@ +@@= skipped -26, +26 lines =@@ >args : B e: (arg: typeof c | typeof d) => void, @@ -26,4 +49,27 @@ +>test2 : (c: (...args: A) => void, d: (...args: B) => void, e: (arg: ((...args: A) => void) | ((...args: B) => void)) => void) => void (a: number | boolean, b: string | number) => {}, - >(a: number | boolean, b: string | number) => {} : (a: number | boolean, b: string | number) => void \ No newline at end of file + >(a: number | boolean, b: string | number) => {} : (a: number | boolean, b: string | number) => void +@@= skipped -13, +13 lines =@@ + >d : number | boolean + + (cb) => { +->(cb) => { cb(true, 42); cb(true, [42]); // error } : (cb: ((a: number | boolean, b: string | number) => void) | ((c: string | boolean, d: number | boolean) => void)) => void +->cb : ((a: number | boolean, b: string | number) => void) | ((c: string | boolean, d: number | boolean) => void) ++>(cb) => { cb(true, 42); cb(true, [42]); // error } : (cb: ((...args: [a: number | boolean, b: string | number]) => void) | ((...args: [c: string | boolean, d: number | boolean]) => void)) => void ++>cb : ((...args: [a: number | boolean, b: string | number]) => void) | ((...args: [c: string | boolean, d: number | boolean]) => void) + + cb(true, 42); + >cb(true, 42) : void +->cb : ((a: number | boolean, b: string | number) => void) | ((c: string | boolean, d: number | boolean) => void) ++>cb : ((...args: [a: number | boolean, b: string | number]) => void) | ((...args: [c: string | boolean, d: number | boolean]) => void) + >true : true + >42 : 42 + + cb(true, [42]); // error + >cb(true, [42]) : void +->cb : ((a: number | boolean, b: string | number) => void) | ((c: string | boolean, d: number | boolean) => void) ++>cb : ((...args: [a: number | boolean, b: string | number]) => void) | ((...args: [c: string | boolean, d: number | boolean]) => void) + >true : true + >[42] : number[] + >42 : 42 \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/spreadParameterTupleType.js b/testdata/baselines/reference/submodule/compiler/spreadParameterTupleType.js index 7a5a310dc4..b25504f696 100644 --- a/testdata/baselines/reference/submodule/compiler/spreadParameterTupleType.js +++ b/testdata/baselines/reference/submodule/compiler/spreadParameterTupleType.js @@ -28,5 +28,5 @@ function f2() { //// [spreadParameterTupleType.d.ts] -declare function f1(): (s: string, s_1: string) => void; -declare function f2(): (a: string, a_1: string, b: string, a_2: string, b_1: string, b_2: string, a_3: string, c: string) => void; +declare function f1(): (...args: [s: string, s: string]) => void; +declare function f2(): (...args: [a: string, a: string, b: string, a: string, b: string, b: string, a: string, c: string]) => void; diff --git a/testdata/baselines/reference/submodule/compiler/spreadParameterTupleType.js.diff b/testdata/baselines/reference/submodule/compiler/spreadParameterTupleType.js.diff new file mode 100644 index 0000000000..fb12aff5a7 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/spreadParameterTupleType.js.diff @@ -0,0 +1,10 @@ +--- old.spreadParameterTupleType.js ++++ new.spreadParameterTupleType.js +@@= skipped -27, +27 lines =@@ + + + //// [spreadParameterTupleType.d.ts] +-declare function f1(): (s: string, s_1: string) => void; +-declare function f2(): (a: string, a_1: string, b: string, a_2: string, b_1: string, b_2: string, a_3: string, c: string) => void; ++declare function f1(): (...args: [s: string, s: string]) => void; ++declare function f2(): (...args: [a: string, a: string, b: string, a: string, b: string, b: string, a: string, c: string]) => void; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/spreadParameterTupleType.types b/testdata/baselines/reference/submodule/compiler/spreadParameterTupleType.types index 7f325a9041..618bffed46 100644 --- a/testdata/baselines/reference/submodule/compiler/spreadParameterTupleType.types +++ b/testdata/baselines/reference/submodule/compiler/spreadParameterTupleType.types @@ -2,7 +2,7 @@ === spreadParameterTupleType.ts === function f1() { ->f1 : () => (s: string, s_1: string) => void +>f1 : () => (...args: [s: string, s: string]) => void type A = [s: string]; >A : [s: string] @@ -11,14 +11,14 @@ function f1() { >C : [s: string, s: string] return function fn(...args: C) { } satisfies any ->function fn(...args: C) { } satisfies any : (s: string, s_1: string) => void ->function fn(...args: C) { } : (s: string, s_1: string) => void ->fn : (s: string, s_1: string) => void +>function fn(...args: C) { } satisfies any : (...args: [s: string, s: string]) => void +>function fn(...args: C) { } : (...args: [s: string, s: string]) => void +>fn : (...args: [s: string, s: string]) => void >args : [s: string, s: string] } function f2() { ->f2 : () => (a: string, a_1: string, b: string, a_2: string, b_1: string, b_2: string, a_3: string, c: string) => void +>f2 : () => (...args: [a: string, a: string, b: string, a: string, b: string, b: string, a: string, c: string]) => void type A = [a: string]; >A : [a: string] @@ -33,9 +33,9 @@ function f2() { >D : [a: string, a: string, b: string, a: string, b: string, b: string, a: string, c: string] return function fn(...args: D) { } satisfies any; ->function fn(...args: D) { } satisfies any : (a: string, a_1: string, b: string, a_2: string, b_1: string, b_2: string, a_3: string, c: string) => void ->function fn(...args: D) { } : (a: string, a_1: string, b: string, a_2: string, b_1: string, b_2: string, a_3: string, c: string) => void ->fn : (a: string, a_1: string, b: string, a_2: string, b_1: string, b_2: string, a_3: string, c: string) => void +>function fn(...args: D) { } satisfies any : (...args: [a: string, a: string, b: string, a: string, b: string, b: string, a: string, c: string]) => void +>function fn(...args: D) { } : (...args: [a: string, a: string, b: string, a: string, b: string, b: string, a: string, c: string]) => void +>fn : (...args: [a: string, a: string, b: string, a: string, b: string, b: string, a: string, c: string]) => void >args : [a: string, a: string, b: string, a: string, b: string, b: string, a: string, c: string] } diff --git a/testdata/baselines/reference/submodule/compiler/spreadParameterTupleType.types.diff b/testdata/baselines/reference/submodule/compiler/spreadParameterTupleType.types.diff new file mode 100644 index 0000000000..153a3c1559 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/spreadParameterTupleType.types.diff @@ -0,0 +1,42 @@ +--- old.spreadParameterTupleType.types ++++ new.spreadParameterTupleType.types +@@= skipped -1, +1 lines =@@ + + === spreadParameterTupleType.ts === + function f1() { +->f1 : () => (s: string, s_1: string) => void ++>f1 : () => (...args: [s: string, s: string]) => void + + type A = [s: string]; + >A : [s: string] +@@= skipped -9, +9 lines =@@ + >C : [s: string, s: string] + + return function fn(...args: C) { } satisfies any +->function fn(...args: C) { } satisfies any : (s: string, s_1: string) => void +->function fn(...args: C) { } : (s: string, s_1: string) => void +->fn : (s: string, s_1: string) => void ++>function fn(...args: C) { } satisfies any : (...args: [s: string, s: string]) => void ++>function fn(...args: C) { } : (...args: [s: string, s: string]) => void ++>fn : (...args: [s: string, s: string]) => void + >args : [s: string, s: string] + } + + function f2() { +->f2 : () => (a: string, a_1: string, b: string, a_2: string, b_1: string, b_2: string, a_3: string, c: string) => void ++>f2 : () => (...args: [a: string, a: string, b: string, a: string, b: string, b: string, a: string, c: string]) => void + + type A = [a: string]; + >A : [a: string] +@@= skipped -22, +22 lines =@@ + >D : [a: string, a: string, b: string, a: string, b: string, b: string, a: string, c: string] + + return function fn(...args: D) { } satisfies any; +->function fn(...args: D) { } satisfies any : (a: string, a_1: string, b: string, a_2: string, b_1: string, b_2: string, a_3: string, c: string) => void +->function fn(...args: D) { } : (a: string, a_1: string, b: string, a_2: string, b_1: string, b_2: string, a_3: string, c: string) => void +->fn : (a: string, a_1: string, b: string, a_2: string, b_1: string, b_2: string, a_3: string, c: string) => void ++>function fn(...args: D) { } satisfies any : (...args: [a: string, a: string, b: string, a: string, b: string, b: string, a: string, c: string]) => void ++>function fn(...args: D) { } : (...args: [a: string, a: string, b: string, a: string, b: string, b: string, a: string, c: string]) => void ++>fn : (...args: [a: string, a: string, b: string, a: string, b: string, b: string, a: string, c: string]) => void + >args : [a: string, a: string, b: string, a: string, b: string, b: string, a: string, c: string] + } diff --git a/testdata/baselines/reference/submodule/compiler/unmatchedParameterPositions.types b/testdata/baselines/reference/submodule/compiler/unmatchedParameterPositions.types index d23230aae0..1fd0acb410 100644 --- a/testdata/baselines/reference/submodule/compiler/unmatchedParameterPositions.types +++ b/testdata/baselines/reference/submodule/compiler/unmatchedParameterPositions.types @@ -12,7 +12,7 @@ let t1: () => unknown[] = s; >s : (...items: never[]) => never[] let t2: (...args: []) => unknown[] = s; ->t2 : () => unknown[] +>t2 : (...args: []) => unknown[] >args : [] >s : (...items: never[]) => never[] diff --git a/testdata/baselines/reference/submodule/compiler/unmatchedParameterPositions.types.diff b/testdata/baselines/reference/submodule/compiler/unmatchedParameterPositions.types.diff new file mode 100644 index 0000000000..8a13121b62 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/unmatchedParameterPositions.types.diff @@ -0,0 +1,10 @@ +--- old.unmatchedParameterPositions.types ++++ new.unmatchedParameterPositions.types +@@= skipped -11, +11 lines =@@ + >s : (...items: never[]) => never[] + + let t2: (...args: []) => unknown[] = s; +->t2 : () => unknown[] ++>t2 : (...args: []) => unknown[] + >args : [] + >s : (...items: never[]) => never[] diff --git a/testdata/baselines/reference/submodule/conformance/contextuallyTypedIife.types b/testdata/baselines/reference/submodule/conformance/contextuallyTypedIife.types index 6f772fffcf..c858f5cec6 100644 --- a/testdata/baselines/reference/submodule/conformance/contextuallyTypedIife.types +++ b/testdata/baselines/reference/submodule/conformance/contextuallyTypedIife.types @@ -103,8 +103,8 @@ // rest parameters ((...numbers) => numbers.every(n => n > 0))(5,6,7); >((...numbers) => numbers.every(n => n > 0))(5,6,7) : boolean ->((...numbers) => numbers.every(n => n > 0)) : (numbers_0: number, numbers_1: number, numbers_2: number) => boolean ->(...numbers) => numbers.every(n => n > 0) : (numbers_0: number, numbers_1: number, numbers_2: number) => boolean +>((...numbers) => numbers.every(n => n > 0)) : (...numbers: [number, number, number]) => boolean +>(...numbers) => numbers.every(n => n > 0) : (...numbers: [number, number, number]) => boolean >numbers : [number, number, number] >numbers.every(n => n > 0) : boolean >numbers.every : { (predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): this is S[]; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): boolean; } @@ -121,8 +121,8 @@ ((...mixed) => mixed.every(n => !!n))(5,'oops','oh no'); >((...mixed) => mixed.every(n => !!n))(5,'oops','oh no') : boolean ->((...mixed) => mixed.every(n => !!n)) : (mixed_0: number, mixed_1: string, mixed_2: string) => boolean ->(...mixed) => mixed.every(n => !!n) : (mixed_0: number, mixed_1: string, mixed_2: string) => boolean +>((...mixed) => mixed.every(n => !!n)) : (...mixed: [number, string, string]) => boolean +>(...mixed) => mixed.every(n => !!n) : (...mixed: [number, string, string]) => boolean >mixed : [number, string, string] >mixed.every(n => !!n) : boolean >mixed.every : { (predicate: (value: string | number, index: number, array: (string | number)[]) => value is S, thisArg?: any): this is S[]; (predicate: (value: string | number, index: number, array: (string | number)[]) => unknown, thisArg?: any): boolean; } @@ -139,8 +139,8 @@ ((...noNumbers) => noNumbers.some(n => n > 0))(); >((...noNumbers) => noNumbers.some(n => n > 0))() : boolean ->((...noNumbers) => noNumbers.some(n => n > 0)) : () => boolean ->(...noNumbers) => noNumbers.some(n => n > 0) : () => boolean +>((...noNumbers) => noNumbers.some(n => n > 0)) : (...noNumbers: []) => boolean +>(...noNumbers) => noNumbers.some(n => n > 0) : (...noNumbers: []) => boolean >noNumbers : [] >noNumbers.some(n => n > 0) : boolean >noNumbers.some : (predicate: (value: never, index: number, array: never[]) => unknown, thisArg?: any) => boolean @@ -154,8 +154,8 @@ ((first, ...rest) => first ? [] : rest.map(n => n > 0))(8,9,10); >((first, ...rest) => first ? [] : rest.map(n => n > 0))(8,9,10) : boolean[] ->((first, ...rest) => first ? [] : rest.map(n => n > 0)) : (first: number, rest_0: number, rest_1: number) => boolean[] ->(first, ...rest) => first ? [] : rest.map(n => n > 0) : (first: number, rest_0: number, rest_1: number) => boolean[] +>((first, ...rest) => first ? [] : rest.map(n => n > 0)) : (first: number, ...rest: [number, number]) => boolean[] +>(first, ...rest) => first ? [] : rest.map(n => n > 0) : (first: number, ...rest: [number, number]) => boolean[] >first : number >rest : [number, number] >first ? [] : rest.map(n => n > 0) : boolean[] diff --git a/testdata/baselines/reference/submodule/conformance/contextuallyTypedIife.types.diff b/testdata/baselines/reference/submodule/conformance/contextuallyTypedIife.types.diff new file mode 100644 index 0000000000..5f77eff2c2 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/contextuallyTypedIife.types.diff @@ -0,0 +1,46 @@ +--- old.contextuallyTypedIife.types ++++ new.contextuallyTypedIife.types +@@= skipped -102, +102 lines =@@ + // rest parameters + ((...numbers) => numbers.every(n => n > 0))(5,6,7); + >((...numbers) => numbers.every(n => n > 0))(5,6,7) : boolean +->((...numbers) => numbers.every(n => n > 0)) : (numbers_0: number, numbers_1: number, numbers_2: number) => boolean +->(...numbers) => numbers.every(n => n > 0) : (numbers_0: number, numbers_1: number, numbers_2: number) => boolean ++>((...numbers) => numbers.every(n => n > 0)) : (...numbers: [number, number, number]) => boolean ++>(...numbers) => numbers.every(n => n > 0) : (...numbers: [number, number, number]) => boolean + >numbers : [number, number, number] + >numbers.every(n => n > 0) : boolean + >numbers.every : { (predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): this is S[]; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): boolean; } +@@= skipped -18, +18 lines =@@ + + ((...mixed) => mixed.every(n => !!n))(5,'oops','oh no'); + >((...mixed) => mixed.every(n => !!n))(5,'oops','oh no') : boolean +->((...mixed) => mixed.every(n => !!n)) : (mixed_0: number, mixed_1: string, mixed_2: string) => boolean +->(...mixed) => mixed.every(n => !!n) : (mixed_0: number, mixed_1: string, mixed_2: string) => boolean ++>((...mixed) => mixed.every(n => !!n)) : (...mixed: [number, string, string]) => boolean ++>(...mixed) => mixed.every(n => !!n) : (...mixed: [number, string, string]) => boolean + >mixed : [number, string, string] + >mixed.every(n => !!n) : boolean + >mixed.every : { (predicate: (value: string | number, index: number, array: (string | number)[]) => value is S, thisArg?: any): this is S[]; (predicate: (value: string | number, index: number, array: (string | number)[]) => unknown, thisArg?: any): boolean; } +@@= skipped -18, +18 lines =@@ + + ((...noNumbers) => noNumbers.some(n => n > 0))(); + >((...noNumbers) => noNumbers.some(n => n > 0))() : boolean +->((...noNumbers) => noNumbers.some(n => n > 0)) : () => boolean +->(...noNumbers) => noNumbers.some(n => n > 0) : () => boolean ++>((...noNumbers) => noNumbers.some(n => n > 0)) : (...noNumbers: []) => boolean ++>(...noNumbers) => noNumbers.some(n => n > 0) : (...noNumbers: []) => boolean + >noNumbers : [] + >noNumbers.some(n => n > 0) : boolean + >noNumbers.some : (predicate: (value: never, index: number, array: never[]) => unknown, thisArg?: any) => boolean +@@= skipped -15, +15 lines =@@ + + ((first, ...rest) => first ? [] : rest.map(n => n > 0))(8,9,10); + >((first, ...rest) => first ? [] : rest.map(n => n > 0))(8,9,10) : boolean[] +->((first, ...rest) => first ? [] : rest.map(n => n > 0)) : (first: number, rest_0: number, rest_1: number) => boolean[] +->(first, ...rest) => first ? [] : rest.map(n => n > 0) : (first: number, rest_0: number, rest_1: number) => boolean[] ++>((first, ...rest) => first ? [] : rest.map(n => n > 0)) : (first: number, ...rest: [number, number]) => boolean[] ++>(first, ...rest) => first ? [] : rest.map(n => n > 0) : (first: number, ...rest: [number, number]) => boolean[] + >first : number + >rest : [number, number] + >first ? [] : rest.map(n => n > 0) : boolean[] \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/contextuallyTypedIifeStrict.types b/testdata/baselines/reference/submodule/conformance/contextuallyTypedIifeStrict.types index b124927c31..11f55c5472 100644 --- a/testdata/baselines/reference/submodule/conformance/contextuallyTypedIifeStrict.types +++ b/testdata/baselines/reference/submodule/conformance/contextuallyTypedIifeStrict.types @@ -103,8 +103,8 @@ // rest parameters ((...numbers) => numbers.every(n => n > 0))(5,6,7); >((...numbers) => numbers.every(n => n > 0))(5,6,7) : boolean ->((...numbers) => numbers.every(n => n > 0)) : (numbers_0: number, numbers_1: number, numbers_2: number) => boolean ->(...numbers) => numbers.every(n => n > 0) : (numbers_0: number, numbers_1: number, numbers_2: number) => boolean +>((...numbers) => numbers.every(n => n > 0)) : (...numbers: [number, number, number]) => boolean +>(...numbers) => numbers.every(n => n > 0) : (...numbers: [number, number, number]) => boolean >numbers : [number, number, number] >numbers.every(n => n > 0) : boolean >numbers.every : { (predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): this is S[]; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): boolean; } @@ -121,8 +121,8 @@ ((...mixed) => mixed.every(n => !!n))(5,'oops','oh no'); >((...mixed) => mixed.every(n => !!n))(5,'oops','oh no') : boolean ->((...mixed) => mixed.every(n => !!n)) : (mixed_0: number, mixed_1: string, mixed_2: string) => boolean ->(...mixed) => mixed.every(n => !!n) : (mixed_0: number, mixed_1: string, mixed_2: string) => boolean +>((...mixed) => mixed.every(n => !!n)) : (...mixed: [number, string, string]) => boolean +>(...mixed) => mixed.every(n => !!n) : (...mixed: [number, string, string]) => boolean >mixed : [number, string, string] >mixed.every(n => !!n) : boolean >mixed.every : { (predicate: (value: string | number, index: number, array: (string | number)[]) => value is S, thisArg?: any): this is S[]; (predicate: (value: string | number, index: number, array: (string | number)[]) => unknown, thisArg?: any): boolean; } @@ -139,8 +139,8 @@ ((...noNumbers) => noNumbers.some(n => n > 0))(); >((...noNumbers) => noNumbers.some(n => n > 0))() : boolean ->((...noNumbers) => noNumbers.some(n => n > 0)) : () => boolean ->(...noNumbers) => noNumbers.some(n => n > 0) : () => boolean +>((...noNumbers) => noNumbers.some(n => n > 0)) : (...noNumbers: []) => boolean +>(...noNumbers) => noNumbers.some(n => n > 0) : (...noNumbers: []) => boolean >noNumbers : [] >noNumbers.some(n => n > 0) : boolean >noNumbers.some : (predicate: (value: never, index: number, array: never[]) => unknown, thisArg?: any) => boolean @@ -154,8 +154,8 @@ ((first, ...rest) => first ? [] : rest.map(n => n > 0))(8,9,10); >((first, ...rest) => first ? [] : rest.map(n => n > 0))(8,9,10) : boolean[] ->((first, ...rest) => first ? [] : rest.map(n => n > 0)) : (first: number, rest_0: number, rest_1: number) => boolean[] ->(first, ...rest) => first ? [] : rest.map(n => n > 0) : (first: number, rest_0: number, rest_1: number) => boolean[] +>((first, ...rest) => first ? [] : rest.map(n => n > 0)) : (first: number, ...rest: [number, number]) => boolean[] +>(first, ...rest) => first ? [] : rest.map(n => n > 0) : (first: number, ...rest: [number, number]) => boolean[] >first : number >rest : [number, number] >first ? [] : rest.map(n => n > 0) : boolean[] diff --git a/testdata/baselines/reference/submodule/conformance/contextuallyTypedIifeStrict.types.diff b/testdata/baselines/reference/submodule/conformance/contextuallyTypedIifeStrict.types.diff new file mode 100644 index 0000000000..c6b3e3204c --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/contextuallyTypedIifeStrict.types.diff @@ -0,0 +1,46 @@ +--- old.contextuallyTypedIifeStrict.types ++++ new.contextuallyTypedIifeStrict.types +@@= skipped -102, +102 lines =@@ + // rest parameters + ((...numbers) => numbers.every(n => n > 0))(5,6,7); + >((...numbers) => numbers.every(n => n > 0))(5,6,7) : boolean +->((...numbers) => numbers.every(n => n > 0)) : (numbers_0: number, numbers_1: number, numbers_2: number) => boolean +->(...numbers) => numbers.every(n => n > 0) : (numbers_0: number, numbers_1: number, numbers_2: number) => boolean ++>((...numbers) => numbers.every(n => n > 0)) : (...numbers: [number, number, number]) => boolean ++>(...numbers) => numbers.every(n => n > 0) : (...numbers: [number, number, number]) => boolean + >numbers : [number, number, number] + >numbers.every(n => n > 0) : boolean + >numbers.every : { (predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): this is S[]; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): boolean; } +@@= skipped -18, +18 lines =@@ + + ((...mixed) => mixed.every(n => !!n))(5,'oops','oh no'); + >((...mixed) => mixed.every(n => !!n))(5,'oops','oh no') : boolean +->((...mixed) => mixed.every(n => !!n)) : (mixed_0: number, mixed_1: string, mixed_2: string) => boolean +->(...mixed) => mixed.every(n => !!n) : (mixed_0: number, mixed_1: string, mixed_2: string) => boolean ++>((...mixed) => mixed.every(n => !!n)) : (...mixed: [number, string, string]) => boolean ++>(...mixed) => mixed.every(n => !!n) : (...mixed: [number, string, string]) => boolean + >mixed : [number, string, string] + >mixed.every(n => !!n) : boolean + >mixed.every : { (predicate: (value: string | number, index: number, array: (string | number)[]) => value is S, thisArg?: any): this is S[]; (predicate: (value: string | number, index: number, array: (string | number)[]) => unknown, thisArg?: any): boolean; } +@@= skipped -18, +18 lines =@@ + + ((...noNumbers) => noNumbers.some(n => n > 0))(); + >((...noNumbers) => noNumbers.some(n => n > 0))() : boolean +->((...noNumbers) => noNumbers.some(n => n > 0)) : () => boolean +->(...noNumbers) => noNumbers.some(n => n > 0) : () => boolean ++>((...noNumbers) => noNumbers.some(n => n > 0)) : (...noNumbers: []) => boolean ++>(...noNumbers) => noNumbers.some(n => n > 0) : (...noNumbers: []) => boolean + >noNumbers : [] + >noNumbers.some(n => n > 0) : boolean + >noNumbers.some : (predicate: (value: never, index: number, array: never[]) => unknown, thisArg?: any) => boolean +@@= skipped -15, +15 lines =@@ + + ((first, ...rest) => first ? [] : rest.map(n => n > 0))(8,9,10); + >((first, ...rest) => first ? [] : rest.map(n => n > 0))(8,9,10) : boolean[] +->((first, ...rest) => first ? [] : rest.map(n => n > 0)) : (first: number, rest_0: number, rest_1: number) => boolean[] +->(first, ...rest) => first ? [] : rest.map(n => n > 0) : (first: number, rest_0: number, rest_1: number) => boolean[] ++>((first, ...rest) => first ? [] : rest.map(n => n > 0)) : (first: number, ...rest: [number, number]) => boolean[] ++>(first, ...rest) => first ? [] : rest.map(n => n > 0) : (first: number, ...rest: [number, number]) => boolean[] + >first : number + >rest : [number, number] + >first ? [] : rest.map(n => n > 0) : boolean[] \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/destructuringParameterDeclaration4.types b/testdata/baselines/reference/submodule/conformance/destructuringParameterDeclaration4.types index a846667c5a..f7c7d110b7 100644 --- a/testdata/baselines/reference/submodule/conformance/destructuringParameterDeclaration4.types +++ b/testdata/baselines/reference/submodule/conformance/destructuringParameterDeclaration4.types @@ -17,7 +17,7 @@ type stringOrNumArray = Array; >stringOrNumArray : stringOrNumArray function a0(...x: [number, number, string]) { } // Error, rest parameter must be array type ->a0 : (x_0: number, x_1: number, x_2: string) => void +>a0 : (...x: [number, number, string]) => void >x : [number, number, string] function a1(...x: (number|string)[]) { } diff --git a/testdata/baselines/reference/submodule/conformance/destructuringParameterDeclaration4.types.diff b/testdata/baselines/reference/submodule/conformance/destructuringParameterDeclaration4.types.diff index b109301f04..668fa29ec0 100644 --- a/testdata/baselines/reference/submodule/conformance/destructuringParameterDeclaration4.types.diff +++ b/testdata/baselines/reference/submodule/conformance/destructuringParameterDeclaration4.types.diff @@ -1,6 +1,11 @@ --- old.destructuringParameterDeclaration4.types +++ new.destructuringParameterDeclaration4.types -@@= skipped -20, +20 lines =@@ +@@= skipped -16, +16 lines =@@ + >stringOrNumArray : stringOrNumArray + + function a0(...x: [number, number, string]) { } // Error, rest parameter must be array type +->a0 : (x_0: number, x_1: number, x_2: string) => void ++>a0 : (...x: [number, number, string]) => void >x : [number, number, string] function a1(...x: (number|string)[]) { } @@ -9,7 +14,7 @@ >x : (string | number)[] function a2(...a: someArray) { } // Error, rest parameter must be array type -@@= skipped -35, +35 lines =@@ +@@= skipped -39, +39 lines =@@ a1(1, 2, "hello", true); // Error, parameter type is (number|string)[] >a1(1, 2, "hello", true) : void diff --git a/testdata/baselines/reference/submodule/conformance/emitDefaultParametersFunctionExpression.types b/testdata/baselines/reference/submodule/conformance/emitDefaultParametersFunctionExpression.types index 0b608615de..85428bc199 100644 --- a/testdata/baselines/reference/submodule/conformance/emitDefaultParametersFunctionExpression.types +++ b/testdata/baselines/reference/submodule/conformance/emitDefaultParametersFunctionExpression.types @@ -39,8 +39,8 @@ var x = function (str = "hello", ...rest) { } var y = (function (num = 10, boo = false, ...rest) { })() >y : void >(function (num = 10, boo = false, ...rest) { })() : void ->(function (num = 10, boo = false, ...rest) { }) : (num?: number, boo?: boolean) => void ->function (num = 10, boo = false, ...rest) { } : (num?: number, boo?: boolean) => void +>(function (num = 10, boo = false, ...rest) { }) : (num?: number, boo?: boolean, ...rest: []) => void +>function (num = 10, boo = false, ...rest) { } : (num?: number, boo?: boolean, ...rest: []) => void >num : number >10 : 10 >boo : boolean @@ -50,8 +50,8 @@ var y = (function (num = 10, boo = false, ...rest) { })() var z = (function (num: number, boo = false, ...rest) { })(10) >z : void >(function (num: number, boo = false, ...rest) { })(10) : void ->(function (num: number, boo = false, ...rest) { }) : (num: number, boo?: boolean) => void ->function (num: number, boo = false, ...rest) { } : (num: number, boo?: boolean) => void +>(function (num: number, boo = false, ...rest) { }) : (num: number, boo?: boolean, ...rest: []) => void +>function (num: number, boo = false, ...rest) { } : (num: number, boo?: boolean, ...rest: []) => void >num : number >boo : boolean >false : false diff --git a/testdata/baselines/reference/submodule/conformance/emitDefaultParametersFunctionExpression.types.diff b/testdata/baselines/reference/submodule/conformance/emitDefaultParametersFunctionExpression.types.diff new file mode 100644 index 0000000000..3589ffb443 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/emitDefaultParametersFunctionExpression.types.diff @@ -0,0 +1,24 @@ +--- old.emitDefaultParametersFunctionExpression.types ++++ new.emitDefaultParametersFunctionExpression.types +@@= skipped -38, +38 lines =@@ + var y = (function (num = 10, boo = false, ...rest) { })() + >y : void + >(function (num = 10, boo = false, ...rest) { })() : void +->(function (num = 10, boo = false, ...rest) { }) : (num?: number, boo?: boolean) => void +->function (num = 10, boo = false, ...rest) { } : (num?: number, boo?: boolean) => void ++>(function (num = 10, boo = false, ...rest) { }) : (num?: number, boo?: boolean, ...rest: []) => void ++>function (num = 10, boo = false, ...rest) { } : (num?: number, boo?: boolean, ...rest: []) => void + >num : number + >10 : 10 + >boo : boolean +@@= skipped -11, +11 lines =@@ + var z = (function (num: number, boo = false, ...rest) { })(10) + >z : void + >(function (num: number, boo = false, ...rest) { })(10) : void +->(function (num: number, boo = false, ...rest) { }) : (num: number, boo?: boolean) => void +->function (num: number, boo = false, ...rest) { } : (num: number, boo?: boolean) => void ++>(function (num: number, boo = false, ...rest) { }) : (num: number, boo?: boolean, ...rest: []) => void ++>function (num: number, boo = false, ...rest) { } : (num: number, boo?: boolean, ...rest: []) => void + >num : number + >boo : boolean + >false : false \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/emitDefaultParametersFunctionExpressionES6.types b/testdata/baselines/reference/submodule/conformance/emitDefaultParametersFunctionExpressionES6.types index 41c249cda0..161f7e6783 100644 --- a/testdata/baselines/reference/submodule/conformance/emitDefaultParametersFunctionExpressionES6.types +++ b/testdata/baselines/reference/submodule/conformance/emitDefaultParametersFunctionExpressionES6.types @@ -39,8 +39,8 @@ var x = function (str = "hello", ...rest) { } var y = (function (num = 10, boo = false, ...rest) { })() >y : void >(function (num = 10, boo = false, ...rest) { })() : void ->(function (num = 10, boo = false, ...rest) { }) : (num?: number, boo?: boolean) => void ->function (num = 10, boo = false, ...rest) { } : (num?: number, boo?: boolean) => void +>(function (num = 10, boo = false, ...rest) { }) : (num?: number, boo?: boolean, ...rest: []) => void +>function (num = 10, boo = false, ...rest) { } : (num?: number, boo?: boolean, ...rest: []) => void >num : number >10 : 10 >boo : boolean @@ -50,8 +50,8 @@ var y = (function (num = 10, boo = false, ...rest) { })() var z = (function (num: number, boo = false, ...rest) { })(10) >z : void >(function (num: number, boo = false, ...rest) { })(10) : void ->(function (num: number, boo = false, ...rest) { }) : (num: number, boo?: boolean) => void ->function (num: number, boo = false, ...rest) { } : (num: number, boo?: boolean) => void +>(function (num: number, boo = false, ...rest) { }) : (num: number, boo?: boolean, ...rest: []) => void +>function (num: number, boo = false, ...rest) { } : (num: number, boo?: boolean, ...rest: []) => void >num : number >boo : boolean >false : false diff --git a/testdata/baselines/reference/submodule/conformance/emitDefaultParametersFunctionExpressionES6.types.diff b/testdata/baselines/reference/submodule/conformance/emitDefaultParametersFunctionExpressionES6.types.diff new file mode 100644 index 0000000000..32230669b0 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/emitDefaultParametersFunctionExpressionES6.types.diff @@ -0,0 +1,24 @@ +--- old.emitDefaultParametersFunctionExpressionES6.types ++++ new.emitDefaultParametersFunctionExpressionES6.types +@@= skipped -38, +38 lines =@@ + var y = (function (num = 10, boo = false, ...rest) { })() + >y : void + >(function (num = 10, boo = false, ...rest) { })() : void +->(function (num = 10, boo = false, ...rest) { }) : (num?: number, boo?: boolean) => void +->function (num = 10, boo = false, ...rest) { } : (num?: number, boo?: boolean) => void ++>(function (num = 10, boo = false, ...rest) { }) : (num?: number, boo?: boolean, ...rest: []) => void ++>function (num = 10, boo = false, ...rest) { } : (num?: number, boo?: boolean, ...rest: []) => void + >num : number + >10 : 10 + >boo : boolean +@@= skipped -11, +11 lines =@@ + var z = (function (num: number, boo = false, ...rest) { })(10) + >z : void + >(function (num: number, boo = false, ...rest) { })(10) : void +->(function (num: number, boo = false, ...rest) { }) : (num: number, boo?: boolean) => void +->function (num: number, boo = false, ...rest) { } : (num: number, boo?: boolean) => void ++>(function (num: number, boo = false, ...rest) { }) : (num: number, boo?: boolean, ...rest: []) => void ++>function (num: number, boo = false, ...rest) { } : (num: number, boo?: boolean, ...rest: []) => void + >num : number + >boo : boolean + >false : false \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/emitRestParametersFunctionExpression.types b/testdata/baselines/reference/submodule/conformance/emitRestParametersFunctionExpression.types index 94a0654453..619753ea9d 100644 --- a/testdata/baselines/reference/submodule/conformance/emitRestParametersFunctionExpression.types +++ b/testdata/baselines/reference/submodule/conformance/emitRestParametersFunctionExpression.types @@ -20,7 +20,7 @@ var funcExp2 = function (...rest) { } var funcExp3 = (function (...rest) { })() >funcExp3 : void >(function (...rest) { })() : void ->(function (...rest) { }) : () => void ->function (...rest) { } : () => void +>(function (...rest) { }) : (...rest: []) => void +>function (...rest) { } : (...rest: []) => void >rest : [] diff --git a/testdata/baselines/reference/submodule/conformance/emitRestParametersFunctionExpression.types.diff b/testdata/baselines/reference/submodule/conformance/emitRestParametersFunctionExpression.types.diff new file mode 100644 index 0000000000..9bfa49e664 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/emitRestParametersFunctionExpression.types.diff @@ -0,0 +1,11 @@ +--- old.emitRestParametersFunctionExpression.types ++++ new.emitRestParametersFunctionExpression.types +@@= skipped -19, +19 lines =@@ + var funcExp3 = (function (...rest) { })() + >funcExp3 : void + >(function (...rest) { })() : void +->(function (...rest) { }) : () => void +->function (...rest) { } : () => void ++>(function (...rest) { }) : (...rest: []) => void ++>function (...rest) { } : (...rest: []) => void + >rest : [] diff --git a/testdata/baselines/reference/submodule/conformance/emitRestParametersFunctionExpressionES6.types b/testdata/baselines/reference/submodule/conformance/emitRestParametersFunctionExpressionES6.types index 9541f65a52..d7fb6705f4 100644 --- a/testdata/baselines/reference/submodule/conformance/emitRestParametersFunctionExpressionES6.types +++ b/testdata/baselines/reference/submodule/conformance/emitRestParametersFunctionExpressionES6.types @@ -20,7 +20,7 @@ var funcExp2 = function (...rest) { } var funcExp3 = (function (...rest) { })() >funcExp3 : void >(function (...rest) { })() : void ->(function (...rest) { }) : () => void ->function (...rest) { } : () => void +>(function (...rest) { }) : (...rest: []) => void +>function (...rest) { } : (...rest: []) => void >rest : [] diff --git a/testdata/baselines/reference/submodule/conformance/emitRestParametersFunctionExpressionES6.types.diff b/testdata/baselines/reference/submodule/conformance/emitRestParametersFunctionExpressionES6.types.diff new file mode 100644 index 0000000000..673976a0e5 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/emitRestParametersFunctionExpressionES6.types.diff @@ -0,0 +1,11 @@ +--- old.emitRestParametersFunctionExpressionES6.types ++++ new.emitRestParametersFunctionExpressionES6.types +@@= skipped -19, +19 lines =@@ + var funcExp3 = (function (...rest) { })() + >funcExp3 : void + >(function (...rest) { })() : void +->(function (...rest) { }) : () => void +->function (...rest) { } : () => void ++>(function (...rest) { }) : (...rest: []) => void ++>function (...rest) { } : (...rest: []) => void + >rest : [] diff --git a/testdata/baselines/reference/submodule/conformance/esDecorators-contextualTypes.2.types b/testdata/baselines/reference/submodule/conformance/esDecorators-contextualTypes.2.types index e0e2caf638..549b58a59c 100644 --- a/testdata/baselines/reference/submodule/conformance/esDecorators-contextualTypes.2.types +++ b/testdata/baselines/reference/submodule/conformance/esDecorators-contextualTypes.2.types @@ -5,7 +5,7 @@ class C { >C : C @boundMethodLogger("Yadda", /*bound*/ true) ->boundMethodLogger("Yadda", /*bound*/ true) : (target: (this: C) => void, context: ClassMethodDecoratorContext void>) => (this: C) => void +>boundMethodLogger("Yadda", /*bound*/ true) : (target: (this: C, ...args: []) => void, context: ClassMethodDecoratorContext void>) => (this: C, ...args: []) => void >boundMethodLogger : (source: string, bound?: boolean) => (target: (this: This, ...args: Args) => Return, context: ClassMethodDecoratorContext Return>) => (this: This, ...args: Args) => Return >"Yadda" : "Yadda" >true : true diff --git a/testdata/baselines/reference/submodule/conformance/esDecorators-contextualTypes.2.types.diff b/testdata/baselines/reference/submodule/conformance/esDecorators-contextualTypes.2.types.diff index 50fdec5706..eab3f200a6 100644 --- a/testdata/baselines/reference/submodule/conformance/esDecorators-contextualTypes.2.types.diff +++ b/testdata/baselines/reference/submodule/conformance/esDecorators-contextualTypes.2.types.diff @@ -1,15 +1,17 @@ --- old.esDecorators-contextualTypes.2.types +++ new.esDecorators-contextualTypes.2.types -@@= skipped -5, +5 lines =@@ +@@= skipped -4, +4 lines =@@ + >C : C @boundMethodLogger("Yadda", /*bound*/ true) - >boundMethodLogger("Yadda", /*bound*/ true) : (target: (this: C) => void, context: ClassMethodDecoratorContext void>) => (this: C) => void +->boundMethodLogger("Yadda", /*bound*/ true) : (target: (this: C) => void, context: ClassMethodDecoratorContext void>) => (this: C) => void ->boundMethodLogger : (source: string, bound?: boolean) => (target: (this: This, ...args: Args) => Return, context: ClassMethodDecoratorContext Return>) => ((this: This, ...args: Args) => Return) ++>boundMethodLogger("Yadda", /*bound*/ true) : (target: (this: C, ...args: []) => void, context: ClassMethodDecoratorContext void>) => (this: C, ...args: []) => void +>boundMethodLogger : (source: string, bound?: boolean) => (target: (this: This, ...args: Args) => Return, context: ClassMethodDecoratorContext Return>) => (this: This, ...args: Args) => Return >"Yadda" : "Yadda" >true : true -@@= skipped -29, +29 lines =@@ +@@= skipped -30, +30 lines =@@ >C : typeof C function boundMethodLogger(source: string, bound = true) { diff --git a/testdata/baselines/reference/submodule/conformance/genericRestParameters1.js b/testdata/baselines/reference/submodule/conformance/genericRestParameters1.js index c526513ad6..a7406a2709 100644 --- a/testdata/baselines/reference/submodule/conformance/genericRestParameters1.js +++ b/testdata/baselines/reference/submodule/conformance/genericRestParameters1.js @@ -307,13 +307,13 @@ declare let x31: string | number; declare let x32: string | number; declare function bind(f: (x: T, ...rest: U) => V, x: T): (...rest: U) => V; declare const f20: (x: number, y: string, z: boolean) => string[]; -declare const f21: (y: string, z: boolean) => string[]; -declare const f22: (z: boolean) => string[]; -declare const f23: () => string[]; +declare const f21: (...rest: [y: string, z: boolean]) => string[]; +declare const f22: (...rest: [z: boolean]) => string[]; +declare const f23: (...rest: []) => string[]; declare const g20: (x: number, y?: string, z?: boolean) => string[]; -declare const g21: (y?: string | undefined, z?: boolean | undefined) => string[]; -declare const g22: (z?: boolean | undefined) => string[]; -declare const g23: () => string[]; +declare const g21: (...rest: [y?: string | undefined, z?: boolean | undefined]) => string[]; +declare const g22: (...rest: [z?: boolean | undefined]) => string[]; +declare const g23: (...rest: []) => string[]; declare function f30 any)[]>(x: T, ...args: U): U; declare const c30: [(x: number) => string, (x: number) => number]; type T01 = Parameters<(x: number, y: string, z: boolean) => void>; diff --git a/testdata/baselines/reference/submodule/conformance/genericRestParameters1.js.diff b/testdata/baselines/reference/submodule/conformance/genericRestParameters1.js.diff index 73a6887d86..acd4b11778 100644 --- a/testdata/baselines/reference/submodule/conformance/genericRestParameters1.js.diff +++ b/testdata/baselines/reference/submodule/conformance/genericRestParameters1.js.diff @@ -7,4 +7,24 @@ -"use strict"; f1 = f2; f2 = f1; - f1(42, "hello", true); \ No newline at end of file + f1(42, "hello", true); +@@= skipped -140, +139 lines =@@ + declare let x32: string | number; + declare function bind(f: (x: T, ...rest: U) => V, x: T): (...rest: U) => V; + declare const f20: (x: number, y: string, z: boolean) => string[]; +-declare const f21: (y: string, z: boolean) => string[]; +-declare const f22: (z: boolean) => string[]; +-declare const f23: () => string[]; ++declare const f21: (...rest: [y: string, z: boolean]) => string[]; ++declare const f22: (...rest: [z: boolean]) => string[]; ++declare const f23: (...rest: []) => string[]; + declare const g20: (x: number, y?: string, z?: boolean) => string[]; +-declare const g21: (y?: string | undefined, z?: boolean | undefined) => string[]; +-declare const g22: (z?: boolean | undefined) => string[]; +-declare const g23: () => string[]; ++declare const g21: (...rest: [y?: string | undefined, z?: boolean | undefined]) => string[]; ++declare const g22: (...rest: [z?: boolean | undefined]) => string[]; ++declare const g23: (...rest: []) => string[]; + declare function f30 any)[]>(x: T, ...args: U): U; + declare const c30: [(x: number) => string, (x: number) => number]; + type T01 = Parameters<(x: number, y: string, z: boolean) => void>; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/genericRestParameters1.types b/testdata/baselines/reference/submodule/conformance/genericRestParameters1.types index d90d60457c..2703e22f47 100644 --- a/testdata/baselines/reference/submodule/conformance/genericRestParameters1.types +++ b/testdata/baselines/reference/submodule/conformance/genericRestParameters1.types @@ -2,7 +2,7 @@ === genericRestParameters1.ts === declare let f1: (...x: [number, string, boolean]) => void; ->f1 : (x_0: number, x_1: string, x_2: boolean) => void +>f1 : (...x: [number, string, boolean]) => void >x : [number, string, boolean] declare let f2: (x0: number, x1: string, x2: boolean) => void; @@ -13,13 +13,13 @@ declare let f2: (x0: number, x1: string, x2: boolean) => void; f1 = f2; >f1 = f2 : (x0: number, x1: string, x2: boolean) => void ->f1 : (x_0: number, x_1: string, x_2: boolean) => void +>f1 : (...x: [number, string, boolean]) => void >f2 : (x0: number, x1: string, x2: boolean) => void f2 = f1; ->f2 = f1 : (x_0: number, x_1: string, x_2: boolean) => void +>f2 = f1 : (...x: [number, string, boolean]) => void >f2 : (x0: number, x1: string, x2: boolean) => void ->f1 : (x_0: number, x_1: string, x_2: boolean) => void +>f1 : (...x: [number, string, boolean]) => void declare const t3: [number, string, boolean]; >t3 : [number, string, boolean] @@ -41,14 +41,14 @@ declare const sn: [string, number]; f1(42, "hello", true); >f1(42, "hello", true) : void ->f1 : (x_0: number, x_1: string, x_2: boolean) => void +>f1 : (...x: [number, string, boolean]) => void >42 : 42 >"hello" : "hello" >true : true f1(t3[0], t3[1], t3[2]); >f1(t3[0], t3[1], t3[2]) : void ->f1 : (x_0: number, x_1: string, x_2: boolean) => void +>f1 : (...x: [number, string, boolean]) => void >t3[0] : number >t3 : [number, string, boolean] >0 : 0 @@ -61,20 +61,20 @@ f1(t3[0], t3[1], t3[2]); f1(...t3); >f1(...t3) : void ->f1 : (x_0: number, x_1: string, x_2: boolean) => void +>f1 : (...x: [number, string, boolean]) => void >...t3 : string | number | boolean >t3 : [number, string, boolean] f1(42, ...t2); >f1(42, ...t2) : void ->f1 : (x_0: number, x_1: string, x_2: boolean) => void +>f1 : (...x: [number, string, boolean]) => void >42 : 42 >...t2 : string | boolean >t2 : [string, boolean] f1(42, "hello", ...t1); >f1(42, "hello", ...t1) : void ->f1 : (x_0: number, x_1: string, x_2: boolean) => void +>f1 : (...x: [number, string, boolean]) => void >42 : 42 >"hello" : "hello" >...t1 : boolean @@ -82,7 +82,7 @@ f1(42, "hello", ...t1); f1(42, "hello", true, ...t0); >f1(42, "hello", true, ...t0) : void ->f1 : (x_0: number, x_1: string, x_2: boolean) => void +>f1 : (...x: [number, string, boolean]) => void >42 : 42 >"hello" : "hello" >true : true @@ -91,7 +91,7 @@ f1(42, "hello", true, ...t0); f1(ns[0], ns[1], true); >f1(ns[0], ns[1], true) : void ->f1 : (x_0: number, x_1: string, x_2: boolean) => void +>f1 : (...x: [number, string, boolean]) => void >ns[0] : number >ns : [number, string] >0 : 0 @@ -102,7 +102,7 @@ f1(ns[0], ns[1], true); f1(...ns, true); // FIXME: Error, since ...ns is considered as string|number here >f1(...ns, true) : void ->f1 : (x_0: number, x_1: string, x_2: boolean) => void +>f1 : (...x: [number, string, boolean]) => void >...ns : string | number >ns : [number, string] >true : true @@ -529,24 +529,24 @@ declare const f20: (x: number, y: string, z: boolean) => string[]; >z : boolean const f21 = bind(f20, 42); // (y: string, z: boolean) => string[] ->f21 : (y: string, z: boolean) => string[] ->bind(f20, 42) : (y: string, z: boolean) => string[] +>f21 : (...rest: [y: string, z: boolean]) => string[] +>bind(f20, 42) : (...rest: [y: string, z: boolean]) => string[] >bind : (f: (x: T, ...rest: U) => V, x: T) => (...rest: U) => V >f20 : (x: number, y: string, z: boolean) => string[] >42 : 42 const f22 = bind(f21, "hello"); // (z: boolean) => string[] ->f22 : (z: boolean) => string[] ->bind(f21, "hello") : (z: boolean) => string[] +>f22 : (...rest: [z: boolean]) => string[] +>bind(f21, "hello") : (...rest: [z: boolean]) => string[] >bind : (f: (x: T, ...rest: U) => V, x: T) => (...rest: U) => V ->f21 : (y: string, z: boolean) => string[] +>f21 : (...rest: [y: string, z: boolean]) => string[] >"hello" : "hello" const f23 = bind(f22, true); // () => string[] ->f23 : () => string[] ->bind(f22, true) : () => string[] +>f23 : (...rest: []) => string[] +>bind(f22, true) : (...rest: []) => string[] >bind : (f: (x: T, ...rest: U) => V, x: T) => (...rest: U) => V ->f22 : (z: boolean) => string[] +>f22 : (...rest: [z: boolean]) => string[] >true : true f20(42, "hello", true); @@ -558,18 +558,18 @@ f20(42, "hello", true); f21("hello", true); >f21("hello", true) : string[] ->f21 : (y: string, z: boolean) => string[] +>f21 : (...rest: [y: string, z: boolean]) => string[] >"hello" : "hello" >true : true f22(true); >f22(true) : string[] ->f22 : (z: boolean) => string[] +>f22 : (...rest: [z: boolean]) => string[] >true : true f23(); >f23() : string[] ->f23 : () => string[] +>f23 : (...rest: []) => string[] declare const g20: (x: number, y?: string, z?: boolean) => string[]; >g20 : (x: number, y?: string | undefined, z?: boolean | undefined) => string[] @@ -578,24 +578,24 @@ declare const g20: (x: number, y?: string, z?: boolean) => string[]; >z : boolean | undefined const g21 = bind(g20, 42); // (y: string, z: boolean) => string[] ->g21 : (y?: string | undefined, z?: boolean | undefined) => string[] ->bind(g20, 42) : (y?: string | undefined, z?: boolean | undefined) => string[] +>g21 : (...rest: [y?: string | undefined, z?: boolean | undefined]) => string[] +>bind(g20, 42) : (...rest: [y?: string | undefined, z?: boolean | undefined]) => string[] >bind : (f: (x: T, ...rest: U) => V, x: T) => (...rest: U) => V >g20 : (x: number, y?: string | undefined, z?: boolean | undefined) => string[] >42 : 42 const g22 = bind(g21, "hello"); // (z: boolean) => string[] ->g22 : (z?: boolean | undefined) => string[] ->bind(g21, "hello") : (z?: boolean | undefined) => string[] +>g22 : (...rest: [z?: boolean | undefined]) => string[] +>bind(g21, "hello") : (...rest: [z?: boolean | undefined]) => string[] >bind : (f: (x: T, ...rest: U) => V, x: T) => (...rest: U) => V ->g21 : (y?: string | undefined, z?: boolean | undefined) => string[] +>g21 : (...rest: [y?: string | undefined, z?: boolean | undefined]) => string[] >"hello" : "hello" const g23 = bind(g22, true); // () => string[] ->g23 : () => string[] ->bind(g22, true) : () => string[] +>g23 : (...rest: []) => string[] +>bind(g22, true) : (...rest: []) => string[] >bind : (f: (x: T, ...rest: U) => V, x: T) => (...rest: U) => V ->g22 : (z?: boolean | undefined) => string[] +>g22 : (...rest: [z?: boolean | undefined]) => string[] >true : true g20(42, "hello", true); @@ -618,31 +618,31 @@ g20(42); g21("hello", true); >g21("hello", true) : string[] ->g21 : (y?: string | undefined, z?: boolean | undefined) => string[] +>g21 : (...rest: [y?: string | undefined, z?: boolean | undefined]) => string[] >"hello" : "hello" >true : true g21("hello"); >g21("hello") : string[] ->g21 : (y?: string | undefined, z?: boolean | undefined) => string[] +>g21 : (...rest: [y?: string | undefined, z?: boolean | undefined]) => string[] >"hello" : "hello" g21(); >g21() : string[] ->g21 : (y?: string | undefined, z?: boolean | undefined) => string[] +>g21 : (...rest: [y?: string | undefined, z?: boolean | undefined]) => string[] g22(true); >g22(true) : string[] ->g22 : (z?: boolean | undefined) => string[] +>g22 : (...rest: [z?: boolean | undefined]) => string[] >true : true g22(); >g22() : string[] ->g22 : (z?: boolean | undefined) => string[] +>g22 : (...rest: [z?: boolean | undefined]) => string[] g23(); >g23() : string[] ->g23 : () => string[] +>g23 : (...rest: []) => string[] declare function f30 any)[]>(x: T, ...args: U): U; >f30 : any)[]>(x: T, ...args: U) => U @@ -776,7 +776,7 @@ declare var ff2: () => void; >ff2 : () => void declare var ff3: (...args: []) => void; ->ff3 : () => void +>ff3 : (...args: []) => void >args : [] declare var ff4: (a: never) => void; @@ -789,9 +789,9 @@ ff1 = ff2; >ff2 : () => void ff1 = ff3; ->ff1 = ff3 : () => void +>ff1 = ff3 : (...args: []) => void >ff1 : (...args: any[]) => void ->ff3 : () => void +>ff3 : (...args: []) => void ff1 = ff4; // Error >ff1 = ff4 : (a: never) => void diff --git a/testdata/baselines/reference/submodule/conformance/genericRestParameters1.types.diff b/testdata/baselines/reference/submodule/conformance/genericRestParameters1.types.diff index bbbf4913ed..9df18a9aa6 100644 --- a/testdata/baselines/reference/submodule/conformance/genericRestParameters1.types.diff +++ b/testdata/baselines/reference/submodule/conformance/genericRestParameters1.types.diff @@ -1,7 +1,151 @@ --- old.genericRestParameters1.types +++ new.genericRestParameters1.types -@@= skipped -571, +571 lines =@@ - >f23 : () => string[] +@@= skipped -1, +1 lines =@@ + + === genericRestParameters1.ts === + declare let f1: (...x: [number, string, boolean]) => void; +->f1 : (x_0: number, x_1: string, x_2: boolean) => void ++>f1 : (...x: [number, string, boolean]) => void + >x : [number, string, boolean] + + declare let f2: (x0: number, x1: string, x2: boolean) => void; +@@= skipped -11, +11 lines =@@ + + f1 = f2; + >f1 = f2 : (x0: number, x1: string, x2: boolean) => void +->f1 : (x_0: number, x_1: string, x_2: boolean) => void ++>f1 : (...x: [number, string, boolean]) => void + >f2 : (x0: number, x1: string, x2: boolean) => void + + f2 = f1; +->f2 = f1 : (x_0: number, x_1: string, x_2: boolean) => void ++>f2 = f1 : (...x: [number, string, boolean]) => void + >f2 : (x0: number, x1: string, x2: boolean) => void +->f1 : (x_0: number, x_1: string, x_2: boolean) => void ++>f1 : (...x: [number, string, boolean]) => void + + declare const t3: [number, string, boolean]; + >t3 : [number, string, boolean] +@@= skipped -28, +28 lines =@@ + + f1(42, "hello", true); + >f1(42, "hello", true) : void +->f1 : (x_0: number, x_1: string, x_2: boolean) => void ++>f1 : (...x: [number, string, boolean]) => void + >42 : 42 + >"hello" : "hello" + >true : true + + f1(t3[0], t3[1], t3[2]); + >f1(t3[0], t3[1], t3[2]) : void +->f1 : (x_0: number, x_1: string, x_2: boolean) => void ++>f1 : (...x: [number, string, boolean]) => void + >t3[0] : number + >t3 : [number, string, boolean] + >0 : 0 +@@= skipped -20, +20 lines =@@ + + f1(...t3); + >f1(...t3) : void +->f1 : (x_0: number, x_1: string, x_2: boolean) => void ++>f1 : (...x: [number, string, boolean]) => void + >...t3 : string | number | boolean + >t3 : [number, string, boolean] + + f1(42, ...t2); + >f1(42, ...t2) : void +->f1 : (x_0: number, x_1: string, x_2: boolean) => void ++>f1 : (...x: [number, string, boolean]) => void + >42 : 42 + >...t2 : string | boolean + >t2 : [string, boolean] + + f1(42, "hello", ...t1); + >f1(42, "hello", ...t1) : void +->f1 : (x_0: number, x_1: string, x_2: boolean) => void ++>f1 : (...x: [number, string, boolean]) => void + >42 : 42 + >"hello" : "hello" + >...t1 : boolean +@@= skipped -21, +21 lines =@@ + + f1(42, "hello", true, ...t0); + >f1(42, "hello", true, ...t0) : void +->f1 : (x_0: number, x_1: string, x_2: boolean) => void ++>f1 : (...x: [number, string, boolean]) => void + >42 : 42 + >"hello" : "hello" + >true : true +@@= skipped -9, +9 lines =@@ + + f1(ns[0], ns[1], true); + >f1(ns[0], ns[1], true) : void +->f1 : (x_0: number, x_1: string, x_2: boolean) => void ++>f1 : (...x: [number, string, boolean]) => void + >ns[0] : number + >ns : [number, string] + >0 : 0 +@@= skipped -11, +11 lines =@@ + + f1(...ns, true); // FIXME: Error, since ...ns is considered as string|number here + >f1(...ns, true) : void +->f1 : (x_0: number, x_1: string, x_2: boolean) => void ++>f1 : (...x: [number, string, boolean]) => void + >...ns : string | number + >ns : [number, string] + >true : true +@@= skipped -427, +427 lines =@@ + >z : boolean + + const f21 = bind(f20, 42); // (y: string, z: boolean) => string[] +->f21 : (y: string, z: boolean) => string[] +->bind(f20, 42) : (y: string, z: boolean) => string[] ++>f21 : (...rest: [y: string, z: boolean]) => string[] ++>bind(f20, 42) : (...rest: [y: string, z: boolean]) => string[] + >bind : (f: (x: T, ...rest: U) => V, x: T) => (...rest: U) => V + >f20 : (x: number, y: string, z: boolean) => string[] + >42 : 42 + + const f22 = bind(f21, "hello"); // (z: boolean) => string[] +->f22 : (z: boolean) => string[] +->bind(f21, "hello") : (z: boolean) => string[] ++>f22 : (...rest: [z: boolean]) => string[] ++>bind(f21, "hello") : (...rest: [z: boolean]) => string[] + >bind : (f: (x: T, ...rest: U) => V, x: T) => (...rest: U) => V +->f21 : (y: string, z: boolean) => string[] ++>f21 : (...rest: [y: string, z: boolean]) => string[] + >"hello" : "hello" + + const f23 = bind(f22, true); // () => string[] +->f23 : () => string[] +->bind(f22, true) : () => string[] ++>f23 : (...rest: []) => string[] ++>bind(f22, true) : (...rest: []) => string[] + >bind : (f: (x: T, ...rest: U) => V, x: T) => (...rest: U) => V +->f22 : (z: boolean) => string[] ++>f22 : (...rest: [z: boolean]) => string[] + >true : true + + f20(42, "hello", true); +@@= skipped -29, +29 lines =@@ + + f21("hello", true); + >f21("hello", true) : string[] +->f21 : (y: string, z: boolean) => string[] ++>f21 : (...rest: [y: string, z: boolean]) => string[] + >"hello" : "hello" + >true : true + + f22(true); + >f22(true) : string[] +->f22 : (z: boolean) => string[] ++>f22 : (...rest: [z: boolean]) => string[] + >true : true + + f23(); + >f23() : string[] +->f23 : () => string[] ++>f23 : (...rest: []) => string[] declare const g20: (x: number, y?: string, z?: boolean) => string[]; ->g20 : (x: number, y?: string, z?: boolean) => string[] @@ -9,16 +153,36 @@ >x : number >y : string | undefined >z : boolean | undefined -@@= skipped -9, +9 lines =@@ - >g21 : (y?: string | undefined, z?: boolean | undefined) => string[] - >bind(g20, 42) : (y?: string | undefined, z?: boolean | undefined) => string[] + + const g21 = bind(g20, 42); // (y: string, z: boolean) => string[] +->g21 : (y?: string | undefined, z?: boolean | undefined) => string[] +->bind(g20, 42) : (y?: string | undefined, z?: boolean | undefined) => string[] ++>g21 : (...rest: [y?: string | undefined, z?: boolean | undefined]) => string[] ++>bind(g20, 42) : (...rest: [y?: string | undefined, z?: boolean | undefined]) => string[] >bind : (f: (x: T, ...rest: U) => V, x: T) => (...rest: U) => V ->g20 : (x: number, y?: string, z?: boolean) => string[] +>g20 : (x: number, y?: string | undefined, z?: boolean | undefined) => string[] >42 : 42 const g22 = bind(g21, "hello"); // (z: boolean) => string[] -@@= skipped -19, +19 lines =@@ +->g22 : (z?: boolean | undefined) => string[] +->bind(g21, "hello") : (z?: boolean | undefined) => string[] ++>g22 : (...rest: [z?: boolean | undefined]) => string[] ++>bind(g21, "hello") : (...rest: [z?: boolean | undefined]) => string[] + >bind : (f: (x: T, ...rest: U) => V, x: T) => (...rest: U) => V +->g21 : (y?: string | undefined, z?: boolean | undefined) => string[] ++>g21 : (...rest: [y?: string | undefined, z?: boolean | undefined]) => string[] + >"hello" : "hello" + + const g23 = bind(g22, true); // () => string[] +->g23 : () => string[] +->bind(g22, true) : () => string[] ++>g23 : (...rest: []) => string[] ++>bind(g22, true) : (...rest: []) => string[] + >bind : (f: (x: T, ...rest: U) => V, x: T) => (...rest: U) => V +->g22 : (z?: boolean | undefined) => string[] ++>g22 : (...rest: [z?: boolean | undefined]) => string[] + >true : true g20(42, "hello", true); >g20(42, "hello", true) : string[] @@ -41,4 +205,60 @@ +>g20 : (x: number, y?: string | undefined, z?: boolean | undefined) => string[] >42 : 42 - g21("hello", true); \ No newline at end of file + g21("hello", true); + >g21("hello", true) : string[] +->g21 : (y?: string | undefined, z?: boolean | undefined) => string[] ++>g21 : (...rest: [y?: string | undefined, z?: boolean | undefined]) => string[] + >"hello" : "hello" + >true : true + + g21("hello"); + >g21("hello") : string[] +->g21 : (y?: string | undefined, z?: boolean | undefined) => string[] ++>g21 : (...rest: [y?: string | undefined, z?: boolean | undefined]) => string[] + >"hello" : "hello" + + g21(); + >g21() : string[] +->g21 : (y?: string | undefined, z?: boolean | undefined) => string[] ++>g21 : (...rest: [y?: string | undefined, z?: boolean | undefined]) => string[] + + g22(true); + >g22(true) : string[] +->g22 : (z?: boolean | undefined) => string[] ++>g22 : (...rest: [z?: boolean | undefined]) => string[] + >true : true + + g22(); + >g22() : string[] +->g22 : (z?: boolean | undefined) => string[] ++>g22 : (...rest: [z?: boolean | undefined]) => string[] + + g23(); + >g23() : string[] +->g23 : () => string[] ++>g23 : (...rest: []) => string[] + + declare function f30 any)[]>(x: T, ...args: U): U; + >f30 : any)[]>(x: T, ...args: U) => U +@@= skipped -218, +218 lines =@@ + >ff2 : () => void + + declare var ff3: (...args: []) => void; +->ff3 : () => void ++>ff3 : (...args: []) => void + >args : [] + + declare var ff4: (a: never) => void; +@@= skipped -13, +13 lines =@@ + >ff2 : () => void + + ff1 = ff3; +->ff1 = ff3 : () => void ++>ff1 = ff3 : (...args: []) => void + >ff1 : (...args: any[]) => void +->ff3 : () => void ++>ff3 : (...args: []) => void + + ff1 = ff4; // Error + >ff1 = ff4 : (a: never) => void \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/genericRestParameters2.types b/testdata/baselines/reference/submodule/conformance/genericRestParameters2.types index 6fb9e14f28..391358f4f3 100644 --- a/testdata/baselines/reference/submodule/conformance/genericRestParameters2.types +++ b/testdata/baselines/reference/submodule/conformance/genericRestParameters2.types @@ -14,16 +14,16 @@ declare const t4: []; >t4 : [] declare let f00: (...x: [number, string, boolean]) => void; ->f00 : (x_0: number, x_1: string, x_2: boolean) => void +>f00 : (...x: [number, string, boolean]) => void >x : [number, string, boolean] declare let f01: (a: number, ...x: [string, boolean]) => void; ->f01 : (a: number, x_0: string, x_1: boolean) => void +>f01 : (a: number, ...x: [string, boolean]) => void >a : number >x : [string, boolean] declare let f02: (a: number, b: string, ...x: [boolean]) => void; ->f02 : (a: number, b: string, x_0: boolean) => void +>f02 : (a: number, b: string, ...x: [boolean]) => void >a : number >b : string >x : [boolean] @@ -35,18 +35,18 @@ declare let f03: (a: number, b: string, c: boolean) => void; >c : boolean declare let f04: (a: number, b: string, c: boolean, ...x: []) => void; ->f04 : (a: number, b: string, c: boolean) => void +>f04 : (a: number, b: string, c: boolean, ...x: []) => void >a : number >b : string >c : boolean >x : [] declare let f10: (...x: [number, string, ...boolean[]]) => void; ->f10 : (x_0: number, x_1: string, ...x: boolean[]) => void +>f10 : (...x: [number, string, ...boolean[]]) => void >x : [number, string, ...boolean[]] declare let f11: (a: number, ...x: [string, ...boolean[]]) => void; ->f11 : (a: number, x_0: string, ...x: boolean[]) => void +>f11 : (a: number, ...x: [string, ...boolean[]]) => void >a : number >x : [string, ...boolean[]] @@ -70,20 +70,20 @@ declare const sn: [string, number]; f10(42, "hello"); >f10(42, "hello") : void ->f10 : (x_0: number, x_1: string, ...x: boolean[]) => void +>f10 : (...x: [number, string, ...boolean[]]) => void >42 : 42 >"hello" : "hello" f10(42, "hello", true); >f10(42, "hello", true) : void ->f10 : (x_0: number, x_1: string, ...x: boolean[]) => void +>f10 : (...x: [number, string, ...boolean[]]) => void >42 : 42 >"hello" : "hello" >true : true f10(42, "hello", true, false); >f10(42, "hello", true, false) : void ->f10 : (x_0: number, x_1: string, ...x: boolean[]) => void +>f10 : (...x: [number, string, ...boolean[]]) => void >42 : 42 >"hello" : "hello" >true : true @@ -91,7 +91,7 @@ f10(42, "hello", true, false); f10(t1[0], t1[1], t1[2], t1[3]); >f10(t1[0], t1[1], t1[2], t1[3]) : void ->f10 : (x_0: number, x_1: string, ...x: boolean[]) => void +>f10 : (...x: [number, string, ...boolean[]]) => void >t1[0] : number >t1 : [number, string, ...boolean[]] >0 : 0 @@ -107,20 +107,20 @@ f10(t1[0], t1[1], t1[2], t1[3]); f10(...t1); >f10(...t1) : void ->f10 : (x_0: number, x_1: string, ...x: boolean[]) => void +>f10 : (...x: [number, string, ...boolean[]]) => void >...t1 : string | number | boolean >t1 : [number, string, ...boolean[]] f10(42, ...t2); >f10(42, ...t2) : void ->f10 : (x_0: number, x_1: string, ...x: boolean[]) => void +>f10 : (...x: [number, string, ...boolean[]]) => void >42 : 42 >...t2 : string | boolean >t2 : [string, ...boolean[]] f10(42, "hello", ...t3); >f10(42, "hello", ...t3) : void ->f10 : (x_0: number, x_1: string, ...x: boolean[]) => void +>f10 : (...x: [number, string, ...boolean[]]) => void >42 : 42 >"hello" : "hello" >...t3 : boolean @@ -128,7 +128,7 @@ f10(42, "hello", ...t3); f10(42, "hello", true, ...t4); >f10(42, "hello", true, ...t4) : void ->f10 : (x_0: number, x_1: string, ...x: boolean[]) => void +>f10 : (...x: [number, string, ...boolean[]]) => void >42 : 42 >"hello" : "hello" >true : true @@ -137,7 +137,7 @@ f10(42, "hello", true, ...t4); f10(42, "hello", true, ...t4, false, ...t3); >f10(42, "hello", true, ...t4, false, ...t3) : void ->f10 : (x_0: number, x_1: string, ...x: boolean[]) => void +>f10 : (...x: [number, string, ...boolean[]]) => void >42 : 42 >"hello" : "hello" >true : true @@ -149,20 +149,20 @@ f10(42, "hello", true, ...t4, false, ...t3); f11(42, "hello"); >f11(42, "hello") : void ->f11 : (a: number, x_0: string, ...x: boolean[]) => void +>f11 : (a: number, ...x: [string, ...boolean[]]) => void >42 : 42 >"hello" : "hello" f11(42, "hello", true); >f11(42, "hello", true) : void ->f11 : (a: number, x_0: string, ...x: boolean[]) => void +>f11 : (a: number, ...x: [string, ...boolean[]]) => void >42 : 42 >"hello" : "hello" >true : true f11(42, "hello", true, false); >f11(42, "hello", true, false) : void ->f11 : (a: number, x_0: string, ...x: boolean[]) => void +>f11 : (a: number, ...x: [string, ...boolean[]]) => void >42 : 42 >"hello" : "hello" >true : true @@ -170,7 +170,7 @@ f11(42, "hello", true, false); f11(t1[0], t1[1], t1[2], t1[3]); >f11(t1[0], t1[1], t1[2], t1[3]) : void ->f11 : (a: number, x_0: string, ...x: boolean[]) => void +>f11 : (a: number, ...x: [string, ...boolean[]]) => void >t1[0] : number >t1 : [number, string, ...boolean[]] >0 : 0 @@ -186,20 +186,20 @@ f11(t1[0], t1[1], t1[2], t1[3]); f11(...t1); >f11(...t1) : void ->f11 : (a: number, x_0: string, ...x: boolean[]) => void +>f11 : (a: number, ...x: [string, ...boolean[]]) => void >...t1 : string | number | boolean >t1 : [number, string, ...boolean[]] f11(42, ...t2); >f11(42, ...t2) : void ->f11 : (a: number, x_0: string, ...x: boolean[]) => void +>f11 : (a: number, ...x: [string, ...boolean[]]) => void >42 : 42 >...t2 : string | boolean >t2 : [string, ...boolean[]] f11(42, "hello", ...t3); >f11(42, "hello", ...t3) : void ->f11 : (a: number, x_0: string, ...x: boolean[]) => void +>f11 : (a: number, ...x: [string, ...boolean[]]) => void >42 : 42 >"hello" : "hello" >...t3 : boolean @@ -207,7 +207,7 @@ f11(42, "hello", ...t3); f11(42, "hello", true, ...t4); >f11(42, "hello", true, ...t4) : void ->f11 : (a: number, x_0: string, ...x: boolean[]) => void +>f11 : (a: number, ...x: [string, ...boolean[]]) => void >42 : 42 >"hello" : "hello" >true : true @@ -216,7 +216,7 @@ f11(42, "hello", true, ...t4); f11(42, "hello", true, ...t4, false, ...t3); >f11(42, "hello", true, ...t4, false, ...t3) : void ->f11 : (a: number, x_0: string, ...x: boolean[]) => void +>f11 : (a: number, ...x: [string, ...boolean[]]) => void >42 : 42 >"hello" : "hello" >true : true diff --git a/testdata/baselines/reference/submodule/conformance/genericRestParameters2.types.diff b/testdata/baselines/reference/submodule/conformance/genericRestParameters2.types.diff index a68ad763fa..89d24f3a1b 100644 --- a/testdata/baselines/reference/submodule/conformance/genericRestParameters2.types.diff +++ b/testdata/baselines/reference/submodule/conformance/genericRestParameters2.types.diff @@ -1,6 +1,45 @@ --- old.genericRestParameters2.types +++ new.genericRestParameters2.types -@@= skipped -50, +50 lines =@@ +@@= skipped -13, +13 lines =@@ + >t4 : [] + + declare let f00: (...x: [number, string, boolean]) => void; +->f00 : (x_0: number, x_1: string, x_2: boolean) => void ++>f00 : (...x: [number, string, boolean]) => void + >x : [number, string, boolean] + + declare let f01: (a: number, ...x: [string, boolean]) => void; +->f01 : (a: number, x_0: string, x_1: boolean) => void ++>f01 : (a: number, ...x: [string, boolean]) => void + >a : number + >x : [string, boolean] + + declare let f02: (a: number, b: string, ...x: [boolean]) => void; +->f02 : (a: number, b: string, x_0: boolean) => void ++>f02 : (a: number, b: string, ...x: [boolean]) => void + >a : number + >b : string + >x : [boolean] +@@= skipped -21, +21 lines =@@ + >c : boolean + + declare let f04: (a: number, b: string, c: boolean, ...x: []) => void; +->f04 : (a: number, b: string, c: boolean) => void ++>f04 : (a: number, b: string, c: boolean, ...x: []) => void + >a : number + >b : string + >c : boolean + >x : [] + + declare let f10: (...x: [number, string, ...boolean[]]) => void; +->f10 : (x_0: number, x_1: string, ...x: boolean[]) => void ++>f10 : (...x: [number, string, ...boolean[]]) => void + >x : [number, string, ...boolean[]] + + declare let f11: (a: number, ...x: [string, ...boolean[]]) => void; +->f11 : (a: number, x_0: string, ...x: boolean[]) => void ++>f11 : (a: number, ...x: [string, ...boolean[]]) => void + >a : number >x : [string, ...boolean[]] declare let f12: (a: number, b: string, ...x: [...boolean[]]) => void; @@ -9,7 +48,157 @@ >a : number >b : string >x : boolean[] -@@= skipped -177, +177 lines =@@ +@@= skipped -35, +35 lines =@@ + + f10(42, "hello"); + >f10(42, "hello") : void +->f10 : (x_0: number, x_1: string, ...x: boolean[]) => void ++>f10 : (...x: [number, string, ...boolean[]]) => void + >42 : 42 + >"hello" : "hello" + + f10(42, "hello", true); + >f10(42, "hello", true) : void +->f10 : (x_0: number, x_1: string, ...x: boolean[]) => void ++>f10 : (...x: [number, string, ...boolean[]]) => void + >42 : 42 + >"hello" : "hello" + >true : true + + f10(42, "hello", true, false); + >f10(42, "hello", true, false) : void +->f10 : (x_0: number, x_1: string, ...x: boolean[]) => void ++>f10 : (...x: [number, string, ...boolean[]]) => void + >42 : 42 + >"hello" : "hello" + >true : true +@@= skipped -21, +21 lines =@@ + + f10(t1[0], t1[1], t1[2], t1[3]); + >f10(t1[0], t1[1], t1[2], t1[3]) : void +->f10 : (x_0: number, x_1: string, ...x: boolean[]) => void ++>f10 : (...x: [number, string, ...boolean[]]) => void + >t1[0] : number + >t1 : [number, string, ...boolean[]] + >0 : 0 +@@= skipped -16, +16 lines =@@ + + f10(...t1); + >f10(...t1) : void +->f10 : (x_0: number, x_1: string, ...x: boolean[]) => void ++>f10 : (...x: [number, string, ...boolean[]]) => void + >...t1 : string | number | boolean + >t1 : [number, string, ...boolean[]] + + f10(42, ...t2); + >f10(42, ...t2) : void +->f10 : (x_0: number, x_1: string, ...x: boolean[]) => void ++>f10 : (...x: [number, string, ...boolean[]]) => void + >42 : 42 + >...t2 : string | boolean + >t2 : [string, ...boolean[]] + + f10(42, "hello", ...t3); + >f10(42, "hello", ...t3) : void +->f10 : (x_0: number, x_1: string, ...x: boolean[]) => void ++>f10 : (...x: [number, string, ...boolean[]]) => void + >42 : 42 + >"hello" : "hello" + >...t3 : boolean +@@= skipped -21, +21 lines =@@ + + f10(42, "hello", true, ...t4); + >f10(42, "hello", true, ...t4) : void +->f10 : (x_0: number, x_1: string, ...x: boolean[]) => void ++>f10 : (...x: [number, string, ...boolean[]]) => void + >42 : 42 + >"hello" : "hello" + >true : true +@@= skipped -9, +9 lines =@@ + + f10(42, "hello", true, ...t4, false, ...t3); + >f10(42, "hello", true, ...t4, false, ...t3) : void +->f10 : (x_0: number, x_1: string, ...x: boolean[]) => void ++>f10 : (...x: [number, string, ...boolean[]]) => void + >42 : 42 + >"hello" : "hello" + >true : true +@@= skipped -12, +12 lines =@@ + + f11(42, "hello"); + >f11(42, "hello") : void +->f11 : (a: number, x_0: string, ...x: boolean[]) => void ++>f11 : (a: number, ...x: [string, ...boolean[]]) => void + >42 : 42 + >"hello" : "hello" + + f11(42, "hello", true); + >f11(42, "hello", true) : void +->f11 : (a: number, x_0: string, ...x: boolean[]) => void ++>f11 : (a: number, ...x: [string, ...boolean[]]) => void + >42 : 42 + >"hello" : "hello" + >true : true + + f11(42, "hello", true, false); + >f11(42, "hello", true, false) : void +->f11 : (a: number, x_0: string, ...x: boolean[]) => void ++>f11 : (a: number, ...x: [string, ...boolean[]]) => void + >42 : 42 + >"hello" : "hello" + >true : true +@@= skipped -21, +21 lines =@@ + + f11(t1[0], t1[1], t1[2], t1[3]); + >f11(t1[0], t1[1], t1[2], t1[3]) : void +->f11 : (a: number, x_0: string, ...x: boolean[]) => void ++>f11 : (a: number, ...x: [string, ...boolean[]]) => void + >t1[0] : number + >t1 : [number, string, ...boolean[]] + >0 : 0 +@@= skipped -16, +16 lines =@@ + + f11(...t1); + >f11(...t1) : void +->f11 : (a: number, x_0: string, ...x: boolean[]) => void ++>f11 : (a: number, ...x: [string, ...boolean[]]) => void + >...t1 : string | number | boolean + >t1 : [number, string, ...boolean[]] + + f11(42, ...t2); + >f11(42, ...t2) : void +->f11 : (a: number, x_0: string, ...x: boolean[]) => void ++>f11 : (a: number, ...x: [string, ...boolean[]]) => void + >42 : 42 + >...t2 : string | boolean + >t2 : [string, ...boolean[]] + + f11(42, "hello", ...t3); + >f11(42, "hello", ...t3) : void +->f11 : (a: number, x_0: string, ...x: boolean[]) => void ++>f11 : (a: number, ...x: [string, ...boolean[]]) => void + >42 : 42 + >"hello" : "hello" + >...t3 : boolean +@@= skipped -21, +21 lines =@@ + + f11(42, "hello", true, ...t4); + >f11(42, "hello", true, ...t4) : void +->f11 : (a: number, x_0: string, ...x: boolean[]) => void ++>f11 : (a: number, ...x: [string, ...boolean[]]) => void + >42 : 42 + >"hello" : "hello" + >true : true +@@= skipped -9, +9 lines =@@ + + f11(42, "hello", true, ...t4, false, ...t3); + >f11(42, "hello", true, ...t4, false, ...t3) : void +->f11 : (a: number, x_0: string, ...x: boolean[]) => void ++>f11 : (a: number, ...x: [string, ...boolean[]]) => void + >42 : 42 + >"hello" : "hello" + >true : true +@@= skipped -12, +12 lines =@@ f12(42, "hello"); >f12(42, "hello") : void diff --git a/testdata/baselines/reference/submodule/conformance/inferTypes1.types b/testdata/baselines/reference/submodule/conformance/inferTypes1.types index c273bed535..f74d500f46 100644 --- a/testdata/baselines/reference/submodule/conformance/inferTypes1.types +++ b/testdata/baselines/reference/submodule/conformance/inferTypes1.types @@ -479,7 +479,7 @@ function invoker (key: K, const result = invoker('test', true)({ test: (a: boolean) => 123 }) >result : number >invoker('test', true)({ test: (a: boolean) => 123 }) : number ->invoker('test', true) : any>>(obj: T) => ReturnType +>invoker('test', true) : any>>(obj: T) => ReturnType >invoker : (key: K, ...args: A) => any>>(obj: T) => ReturnType >'test' : "test" >true : true diff --git a/testdata/baselines/reference/submodule/conformance/inferTypes1.types.diff b/testdata/baselines/reference/submodule/conformance/inferTypes1.types.diff index 6a4820eda4..7ed8594f76 100644 --- a/testdata/baselines/reference/submodule/conformance/inferTypes1.types.diff +++ b/testdata/baselines/reference/submodule/conformance/inferTypes1.types.diff @@ -20,4 +20,13 @@ +>toJSON : () => R : T extends object ? JsonifiedObject - : "what is this"; \ No newline at end of file + : "what is this"; +@@= skipped -150, +150 lines =@@ + const result = invoker('test', true)({ test: (a: boolean) => 123 }) + >result : number + >invoker('test', true)({ test: (a: boolean) => 123 }) : number +->invoker('test', true) : any>>(obj: T) => ReturnType ++>invoker('test', true) : any>>(obj: T) => ReturnType + >invoker : (key: K, ...args: A) => any>>(obj: T) => ReturnType + >'test' : "test" + >true : true \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/iterableArrayPattern14.types b/testdata/baselines/reference/submodule/conformance/iterableArrayPattern14.types index 4a22ffd8b4..a297229ca7 100644 --- a/testdata/baselines/reference/submodule/conformance/iterableArrayPattern14.types +++ b/testdata/baselines/reference/submodule/conformance/iterableArrayPattern14.types @@ -43,13 +43,13 @@ class FooIterator { } function fun(...[a, ...b]) { } ->fun : (a: any, ...b: any[]) => void +>fun : (...[a, ...b]: [any, ...any[]]) => void >a : any >b : any[] fun(new FooIterator); >fun(new FooIterator) : void ->fun : (a: any, ...b: any[]) => void +>fun : (...[a, ...b]: [any, ...any[]]) => void >new FooIterator : FooIterator >FooIterator : typeof FooIterator diff --git a/testdata/baselines/reference/submodule/conformance/iterableArrayPattern14.types.diff b/testdata/baselines/reference/submodule/conformance/iterableArrayPattern14.types.diff new file mode 100644 index 0000000000..8cafc01837 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/iterableArrayPattern14.types.diff @@ -0,0 +1,17 @@ +--- old.iterableArrayPattern14.types ++++ new.iterableArrayPattern14.types +@@= skipped -42, +42 lines =@@ + } + + function fun(...[a, ...b]) { } +->fun : (a: any, ...b: any[]) => void ++>fun : (...[a, ...b]: [any, ...any[]]) => void + >a : any + >b : any[] + + fun(new FooIterator); + >fun(new FooIterator) : void +->fun : (a: any, ...b: any[]) => void ++>fun : (...[a, ...b]: [any, ...any[]]) => void + >new FooIterator : FooIterator + >FooIterator : typeof FooIterator diff --git a/testdata/baselines/reference/submodule/conformance/iterableArrayPattern25.types b/testdata/baselines/reference/submodule/conformance/iterableArrayPattern25.types index 2d34e7273b..f1401fc910 100644 --- a/testdata/baselines/reference/submodule/conformance/iterableArrayPattern25.types +++ b/testdata/baselines/reference/submodule/conformance/iterableArrayPattern25.types @@ -2,7 +2,7 @@ === iterableArrayPattern25.ts === function takeFirstTwoEntries(...[[k1, v1], [k2, v2]]) { } ->takeFirstTwoEntries : (arg_0: [any, any], arg_1: [any, any]) => void +>takeFirstTwoEntries : (...[[k1, v1], [k2, v2]]: [[any, any], [any, any]]) => void >k1 : any >v1 : any >k2 : any @@ -10,7 +10,7 @@ function takeFirstTwoEntries(...[[k1, v1], [k2, v2]]) { } takeFirstTwoEntries(new Map([["", 0], ["hello", 1]])); >takeFirstTwoEntries(new Map([["", 0], ["hello", 1]])) : void ->takeFirstTwoEntries : (arg_0: [any, any], arg_1: [any, any]) => void +>takeFirstTwoEntries : (...[[k1, v1], [k2, v2]]: [[any, any], [any, any]]) => void >new Map([["", 0], ["hello", 1]]) : Map >Map : MapConstructor >[["", 0], ["hello", 1]] : [string, number][] diff --git a/testdata/baselines/reference/submodule/conformance/iterableArrayPattern25.types.diff b/testdata/baselines/reference/submodule/conformance/iterableArrayPattern25.types.diff new file mode 100644 index 0000000000..70c992c462 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/iterableArrayPattern25.types.diff @@ -0,0 +1,20 @@ +--- old.iterableArrayPattern25.types ++++ new.iterableArrayPattern25.types +@@= skipped -1, +1 lines =@@ + + === iterableArrayPattern25.ts === + function takeFirstTwoEntries(...[[k1, v1], [k2, v2]]) { } +->takeFirstTwoEntries : (arg_0: [any, any], arg_1: [any, any]) => void ++>takeFirstTwoEntries : (...[[k1, v1], [k2, v2]]: [[any, any], [any, any]]) => void + >k1 : any + >v1 : any + >k2 : any +@@= skipped -8, +8 lines =@@ + + takeFirstTwoEntries(new Map([["", 0], ["hello", 1]])); + >takeFirstTwoEntries(new Map([["", 0], ["hello", 1]])) : void +->takeFirstTwoEntries : (arg_0: [any, any], arg_1: [any, any]) => void ++>takeFirstTwoEntries : (...[[k1, v1], [k2, v2]]: [[any, any], [any, any]]) => void + >new Map([["", 0], ["hello", 1]]) : Map + >Map : MapConstructor + >[["", 0], ["hello", 1]] : [string, number][] \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/partiallyAnnotatedFunctionInferenceWithTypeParameter.types b/testdata/baselines/reference/submodule/conformance/partiallyAnnotatedFunctionInferenceWithTypeParameter.types index ee58e1e4e4..9b18a8dab9 100644 --- a/testdata/baselines/reference/submodule/conformance/partiallyAnnotatedFunctionInferenceWithTypeParameter.types +++ b/testdata/baselines/reference/submodule/conformance/partiallyAnnotatedFunctionInferenceWithTypeParameter.types @@ -105,7 +105,7 @@ testRest((t1, t2: D, t3) => {}) testRest((t2: D, ...t3) => {}) >testRest((t2: D, ...t3) => {}) : D >testRest : (a: (t: T, t1: T, ...ts: T[]) => void) => T ->(t2: D, ...t3) => {} : (t2: D, t1: D, ...ts: D[]) => void +>(t2: D, ...t3) => {} : (t2: D, ...t3: [t1: D, ...ts: D[]]) => void >t2 : D >t3 : [t1: D, ...ts: D[]] diff --git a/testdata/baselines/reference/submodule/conformance/partiallyAnnotatedFunctionInferenceWithTypeParameter.types.diff b/testdata/baselines/reference/submodule/conformance/partiallyAnnotatedFunctionInferenceWithTypeParameter.types.diff new file mode 100644 index 0000000000..24eb44e6fc --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/partiallyAnnotatedFunctionInferenceWithTypeParameter.types.diff @@ -0,0 +1,10 @@ +--- old.partiallyAnnotatedFunctionInferenceWithTypeParameter.types ++++ new.partiallyAnnotatedFunctionInferenceWithTypeParameter.types +@@= skipped -104, +104 lines =@@ + testRest((t2: D, ...t3) => {}) + >testRest((t2: D, ...t3) => {}) : D + >testRest : (a: (t: T, t1: T, ...ts: T[]) => void) => T +->(t2: D, ...t3) => {} : (t2: D, t1: D, ...ts: D[]) => void ++>(t2: D, ...t3) => {} : (t2: D, ...t3: [t1: D, ...ts: D[]]) => void + >t2 : D + >t3 : [t1: D, ...ts: D[]] diff --git a/testdata/baselines/reference/submodule/conformance/partiallyNamedTuples.types b/testdata/baselines/reference/submodule/conformance/partiallyNamedTuples.types index 226eda20cc..0170b4676c 100644 --- a/testdata/baselines/reference/submodule/conformance/partiallyNamedTuples.types +++ b/testdata/baselines/reference/submodule/conformance/partiallyNamedTuples.types @@ -5,11 +5,11 @@ type NamedAndAnonymous = [a: string, number]; >NamedAndAnonymous : NamedAndAnonymous function fa1(...args: NamedAndAnonymous) {} ->fa1 : (a: string, args_1: number) => void +>fa1 : (...args: NamedAndAnonymous) => void >args : NamedAndAnonymous function fa2(a: NamedAndAnonymous, ...args: NamedAndAnonymous) {} ->fa2 : (a: NamedAndAnonymous, a: string, args_1: number) => void +>fa2 : (a: NamedAndAnonymous, ...args: NamedAndAnonymous) => void >a : NamedAndAnonymous >args : NamedAndAnonymous @@ -17,16 +17,16 @@ type NamedAnonymousMixed = [a: string, number, c: number, NamedAndAnonymous]; >NamedAnonymousMixed : NamedAnonymousMixed function fb1(...args: NamedAnonymousMixed) {} ->fb1 : (a: string, args_1: number, c: number, args_3: NamedAndAnonymous) => void +>fb1 : (...args: NamedAnonymousMixed) => void >args : NamedAnonymousMixed function fb2(a: NamedAnonymousMixed, ...args: NamedAnonymousMixed) {} ->fb2 : (a: NamedAnonymousMixed, a: string, args_1: number, c: number, args_3: NamedAndAnonymous) => void +>fb2 : (a: NamedAnonymousMixed, ...args: NamedAnonymousMixed) => void >a : NamedAnonymousMixed >args : NamedAnonymousMixed function fb3(a: NamedAnonymousMixed, ...args: NamedAnonymousMixed[3]) {} ->fb3 : (a: NamedAnonymousMixed, a: string, args_1: number) => void +>fb3 : (a: NamedAnonymousMixed, ...args: NamedAndAnonymous) => void >a : NamedAnonymousMixed >args : NamedAndAnonymous diff --git a/testdata/baselines/reference/submodule/conformance/partiallyNamedTuples.types.diff b/testdata/baselines/reference/submodule/conformance/partiallyNamedTuples.types.diff new file mode 100644 index 0000000000..238087eb2e --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/partiallyNamedTuples.types.diff @@ -0,0 +1,35 @@ +--- old.partiallyNamedTuples.types ++++ new.partiallyNamedTuples.types +@@= skipped -4, +4 lines =@@ + >NamedAndAnonymous : NamedAndAnonymous + + function fa1(...args: NamedAndAnonymous) {} +->fa1 : (a: string, args_1: number) => void ++>fa1 : (...args: NamedAndAnonymous) => void + >args : NamedAndAnonymous + + function fa2(a: NamedAndAnonymous, ...args: NamedAndAnonymous) {} +->fa2 : (a: NamedAndAnonymous, a: string, args_1: number) => void ++>fa2 : (a: NamedAndAnonymous, ...args: NamedAndAnonymous) => void + >a : NamedAndAnonymous + >args : NamedAndAnonymous + +@@= skipped -12, +12 lines =@@ + >NamedAnonymousMixed : NamedAnonymousMixed + + function fb1(...args: NamedAnonymousMixed) {} +->fb1 : (a: string, args_1: number, c: number, args_3: NamedAndAnonymous) => void ++>fb1 : (...args: NamedAnonymousMixed) => void + >args : NamedAnonymousMixed + + function fb2(a: NamedAnonymousMixed, ...args: NamedAnonymousMixed) {} +->fb2 : (a: NamedAnonymousMixed, a: string, args_1: number, c: number, args_3: NamedAndAnonymous) => void ++>fb2 : (a: NamedAnonymousMixed, ...args: NamedAnonymousMixed) => void + >a : NamedAnonymousMixed + >args : NamedAnonymousMixed + + function fb3(a: NamedAnonymousMixed, ...args: NamedAnonymousMixed[3]) {} +->fb3 : (a: NamedAnonymousMixed, a: string, args_1: number) => void ++>fb3 : (a: NamedAnonymousMixed, ...args: NamedAndAnonymous) => void + >a : NamedAnonymousMixed + >args : NamedAndAnonymous diff --git a/testdata/baselines/reference/submodule/conformance/partiallyNamedTuples3.types b/testdata/baselines/reference/submodule/conformance/partiallyNamedTuples3.types index 91da7e460d..01903ce11d 100644 --- a/testdata/baselines/reference/submodule/conformance/partiallyNamedTuples3.types +++ b/testdata/baselines/reference/submodule/conformance/partiallyNamedTuples3.types @@ -7,8 +7,8 @@ declare const tuple: [number, name: string, boolean, value: number, string]; const output = ((...args) => args)(...tuple); >output : [number, name: string, boolean, value: number, string] >((...args) => args)(...tuple) : [number, name: string, boolean, value: number, string] ->((...args) => args) : (args_0: number, name: string, args_2: boolean, value: number, args_4: string) => [number, name: string, boolean, value: number, string] ->(...args) => args : (args_0: number, name: string, args_2: boolean, value: number, args_4: string) => [number, name: string, boolean, value: number, string] +>((...args) => args) : (...args: [number, name: string, boolean, value: number, string]) => [number, name: string, boolean, value: number, string] +>(...args) => args : (...args: [number, name: string, boolean, value: number, string]) => [number, name: string, boolean, value: number, string] >args : [number, name: string, boolean, value: number, string] >args : [number, name: string, boolean, value: number, string] >...tuple : string | number | boolean diff --git a/testdata/baselines/reference/submodule/conformance/partiallyNamedTuples3.types.diff b/testdata/baselines/reference/submodule/conformance/partiallyNamedTuples3.types.diff new file mode 100644 index 0000000000..b453087a77 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/partiallyNamedTuples3.types.diff @@ -0,0 +1,13 @@ +--- old.partiallyNamedTuples3.types ++++ new.partiallyNamedTuples3.types +@@= skipped -6, +6 lines =@@ + const output = ((...args) => args)(...tuple); + >output : [number, name: string, boolean, value: number, string] + >((...args) => args)(...tuple) : [number, name: string, boolean, value: number, string] +->((...args) => args) : (args_0: number, name: string, args_2: boolean, value: number, args_4: string) => [number, name: string, boolean, value: number, string] +->(...args) => args : (args_0: number, name: string, args_2: boolean, value: number, args_4: string) => [number, name: string, boolean, value: number, string] ++>((...args) => args) : (...args: [number, name: string, boolean, value: number, string]) => [number, name: string, boolean, value: number, string] ++>(...args) => args : (...args: [number, name: string, boolean, value: number, string]) => [number, name: string, boolean, value: number, string] + >args : [number, name: string, boolean, value: number, string] + >args : [number, name: string, boolean, value: number, string] + >...tuple : string | number | boolean \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/readonlyRestParameters.types b/testdata/baselines/reference/submodule/conformance/readonlyRestParameters.types index 4af030d441..c67274a265 100644 --- a/testdata/baselines/reference/submodule/conformance/readonlyRestParameters.types +++ b/testdata/baselines/reference/submodule/conformance/readonlyRestParameters.types @@ -20,7 +20,7 @@ function f0(a: string, b: string) { f2(a, b); >f2(a, b) : void ->f2 : (args_0: string, args_1: string) => void +>f2 : (...args: readonly [string, string]) => void >a : string >b : string } @@ -56,7 +56,7 @@ function f1(...args: readonly string[]) { } function f2(...args: readonly [string, string]) { ->f2 : (args_0: string, args_1: string) => void +>f2 : (...args: readonly [string, string]) => void >args : readonly [string, string] f0(...args); @@ -86,20 +86,20 @@ function f2(...args: readonly [string, string]) { f2('abc', 'def'); >f2('abc', 'def') : void ->f2 : (args_0: string, args_1: string) => void +>f2 : (...args: readonly [string, string]) => void >'abc' : "abc" >'def' : "def" f2('abc', ...args); // Error >f2('abc', ...args) : void ->f2 : (args_0: string, args_1: string) => void +>f2 : (...args: readonly [string, string]) => void >'abc' : "abc" >...args : string >args : readonly [string, string] f2(...args); >f2(...args) : void ->f2 : (args_0: string, args_1: string) => void +>f2 : (...args: readonly [string, string]) => void >...args : string >args : readonly [string, string] } diff --git a/testdata/baselines/reference/submodule/conformance/readonlyRestParameters.types.diff b/testdata/baselines/reference/submodule/conformance/readonlyRestParameters.types.diff new file mode 100644 index 0000000000..290167aa1a --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/readonlyRestParameters.types.diff @@ -0,0 +1,44 @@ +--- old.readonlyRestParameters.types ++++ new.readonlyRestParameters.types +@@= skipped -19, +19 lines =@@ + + f2(a, b); + >f2(a, b) : void +->f2 : (args_0: string, args_1: string) => void ++>f2 : (...args: readonly [string, string]) => void + >a : string + >b : string + } +@@= skipped -36, +36 lines =@@ + } + + function f2(...args: readonly [string, string]) { +->f2 : (args_0: string, args_1: string) => void ++>f2 : (...args: readonly [string, string]) => void + >args : readonly [string, string] + + f0(...args); +@@= skipped -30, +30 lines =@@ + + f2('abc', 'def'); + >f2('abc', 'def') : void +->f2 : (args_0: string, args_1: string) => void ++>f2 : (...args: readonly [string, string]) => void + >'abc' : "abc" + >'def' : "def" + + f2('abc', ...args); // Error + >f2('abc', ...args) : void +->f2 : (args_0: string, args_1: string) => void ++>f2 : (...args: readonly [string, string]) => void + >'abc' : "abc" + >...args : string + >args : readonly [string, string] + + f2(...args); + >f2(...args) : void +->f2 : (args_0: string, args_1: string) => void ++>f2 : (...args: readonly [string, string]) => void + >...args : string + >args : readonly [string, string] + } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/restTupleElements1.types b/testdata/baselines/reference/submodule/conformance/restTupleElements1.types index e5b81671ad..764decb1f3 100644 --- a/testdata/baselines/reference/submodule/conformance/restTupleElements1.types +++ b/testdata/baselines/reference/submodule/conformance/restTupleElements1.types @@ -203,7 +203,7 @@ declare function f1(a: [(x: number) => number, ...((x: string) => number)[]]): v >x : string declare function f2(...a: [(x: number) => number, ...((x: string) => number)[]]): void; ->f2 : (a_0: (x: number) => number, ...a: ((x: string) => number)[]) => void +>f2 : (...a: [(x: number) => number, ...((x: string) => number)[]]) => void >a : [(x: number) => number, ...((x: string) => number)[]] >x : number >x : string @@ -232,7 +232,7 @@ f1([x => x * 2, x => x.length, x => x.charCodeAt(0)]); f2(x => x * 2, x => x.length, x => x.charCodeAt(0)); >f2(x => x * 2, x => x.length, x => x.charCodeAt(0)) : void ->f2 : (a_0: (x: number) => number, ...a: ((x: string) => number)[]) => void +>f2 : (...a: [(x: number) => number, ...((x: string) => number)[]]) => void >x => x * 2 : (x: number) => number >x : number >x * 2 : number diff --git a/testdata/baselines/reference/submodule/conformance/restTupleElements1.types.diff b/testdata/baselines/reference/submodule/conformance/restTupleElements1.types.diff new file mode 100644 index 0000000000..932e8c0673 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/restTupleElements1.types.diff @@ -0,0 +1,20 @@ +--- old.restTupleElements1.types ++++ new.restTupleElements1.types +@@= skipped -202, +202 lines =@@ + >x : string + + declare function f2(...a: [(x: number) => number, ...((x: string) => number)[]]): void; +->f2 : (a_0: (x: number) => number, ...a: ((x: string) => number)[]) => void ++>f2 : (...a: [(x: number) => number, ...((x: string) => number)[]]) => void + >a : [(x: number) => number, ...((x: string) => number)[]] + >x : number + >x : string +@@= skipped -29, +29 lines =@@ + + f2(x => x * 2, x => x.length, x => x.charCodeAt(0)); + >f2(x => x * 2, x => x.length, x => x.charCodeAt(0)) : void +->f2 : (a_0: (x: number) => number, ...a: ((x: string) => number)[]) => void ++>f2 : (...a: [(x: number) => number, ...((x: string) => number)[]]) => void + >x => x * 2 : (x: number) => number + >x : number + >x * 2 : number \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/restTuplesFromContextualTypes.js b/testdata/baselines/reference/submodule/conformance/restTuplesFromContextualTypes.js index 718351bbcc..8fbccf9d5b 100644 --- a/testdata/baselines/reference/submodule/conformance/restTuplesFromContextualTypes.js +++ b/testdata/baselines/reference/submodule/conformance/restTuplesFromContextualTypes.js @@ -171,16 +171,16 @@ declare const t3: [boolean, ...string[]]; declare function f3(cb: (x: number, ...args: typeof t3) => void): void; declare function f4(t: T): void; declare function f5(f: (...args: T) => U): (...args: T) => U; -declare let g0: () => string; -declare let g1: (x: any, y: any) => number; -declare let g2: (x: number, y: any) => number; -declare let g3: (x: number, y: number) => number; +declare let g0: (...args: []) => string; +declare let g1: (...args: [x: any, y: any]) => number; +declare let g2: (...args: [x: number, y: any]) => number; +declare let g3: (...args: [x: number, y: number]) => number; declare let g4: (...args: any[]) => boolean; declare function pipe(f: (...args: A) => B, g: (x: B) => C): (...args: A) => C; -declare let g5: () => number; -declare let g6: (x: any) => number; -declare let g7: (x: any, y: any) => string; -declare let g8: (x: number, y: string) => string; +declare let g5: (...args: []) => number; +declare let g6: (...args: [x: any]) => number; +declare let g7: (...args: [x: any, y: any]) => string; +declare let g8: (...args: [x: number, y: string]) => string; declare var tuple: [number, string]; declare function take(cb: (a: number, b: string) => void): void; type ArgsUnion = [number, string] | [number, Error]; diff --git a/testdata/baselines/reference/submodule/conformance/restTuplesFromContextualTypes.js.diff b/testdata/baselines/reference/submodule/conformance/restTuplesFromContextualTypes.js.diff index 38d5a7fc74..863fede6a4 100644 --- a/testdata/baselines/reference/submodule/conformance/restTuplesFromContextualTypes.js.diff +++ b/testdata/baselines/reference/submodule/conformance/restTuplesFromContextualTypes.js.diff @@ -7,4 +7,29 @@ -"use strict"; (function (a, b, c) { })(...t1); (function (...x) { })(...t1); - (function (a, ...x) { })(...t1); \ No newline at end of file + (function (a, ...x) { })(...t1); +@@= skipped -70, +69 lines =@@ + declare function f3(cb: (x: number, ...args: typeof t3) => void): void; + declare function f4(t: T): void; + declare function f5(f: (...args: T) => U): (...args: T) => U; +-declare let g0: () => string; +-declare let g1: (x: any, y: any) => number; +-declare let g2: (x: number, y: any) => number; +-declare let g3: (x: number, y: number) => number; ++declare let g0: (...args: []) => string; ++declare let g1: (...args: [x: any, y: any]) => number; ++declare let g2: (...args: [x: number, y: any]) => number; ++declare let g3: (...args: [x: number, y: number]) => number; + declare let g4: (...args: any[]) => boolean; + declare function pipe(f: (...args: A) => B, g: (x: B) => C): (...args: A) => C; +-declare let g5: () => number; +-declare let g6: (x: any) => number; +-declare let g7: (x: any, y: any) => string; +-declare let g8: (x: number, y: string) => string; ++declare let g5: (...args: []) => number; ++declare let g6: (...args: [x: any]) => number; ++declare let g7: (...args: [x: any, y: any]) => string; ++declare let g8: (...args: [x: number, y: string]) => string; + declare var tuple: [number, string]; + declare function take(cb: (a: number, b: string) => void): void; + type ArgsUnion = [number, string] | [number, Error]; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/restTuplesFromContextualTypes.types b/testdata/baselines/reference/submodule/conformance/restTuplesFromContextualTypes.types index fef5174a56..925a436200 100644 --- a/testdata/baselines/reference/submodule/conformance/restTuplesFromContextualTypes.types +++ b/testdata/baselines/reference/submodule/conformance/restTuplesFromContextualTypes.types @@ -16,16 +16,16 @@ declare const t1: [number, boolean, string]; (function (...x){})(...t1); >(function (...x){})(...t1) : void ->(function (...x){}) : (x_0: number, x_1: boolean, x_2: string) => void ->function (...x){} : (x_0: number, x_1: boolean, x_2: string) => void +>(function (...x){}) : (...x: [number, boolean, string]) => void +>function (...x){} : (...x: [number, boolean, string]) => void >x : [number, boolean, string] >...t1 : string | number | boolean >t1 : [number, boolean, string] (function (a, ...x){})(...t1); >(function (a, ...x){})(...t1) : void ->(function (a, ...x){}) : (a: number, x_0: boolean, x_1: string) => void ->function (a, ...x){} : (a: number, x_0: boolean, x_1: string) => void +>(function (a, ...x){}) : (a: number, ...x: [boolean, string]) => void +>function (a, ...x){} : (a: number, ...x: [boolean, string]) => void >a : number >x : [boolean, string] >...t1 : string | number | boolean @@ -33,8 +33,8 @@ declare const t1: [number, boolean, string]; (function (a, b, ...x){})(...t1); >(function (a, b, ...x){})(...t1) : void ->(function (a, b, ...x){}) : (a: number, b: boolean, x_0: string) => void ->function (a, b, ...x){} : (a: number, b: boolean, x_0: string) => void +>(function (a, b, ...x){}) : (a: number, b: boolean, ...x: [string]) => void +>function (a, b, ...x){} : (a: number, b: boolean, ...x: [string]) => void >a : number >b : boolean >x : [string] @@ -43,8 +43,8 @@ declare const t1: [number, boolean, string]; (function (a, b, c, ...x){})(...t1); >(function (a, b, c, ...x){})(...t1) : void ->(function (a, b, c, ...x){}) : (a: number, b: boolean, c: string) => void ->function (a, b, c, ...x){} : (a: number, b: boolean, c: string) => void +>(function (a, b, c, ...x){}) : (a: number, b: boolean, c: string, ...x: []) => void +>function (a, b, c, ...x){} : (a: number, b: boolean, c: string, ...x: []) => void >a : number >b : boolean >c : string @@ -53,14 +53,14 @@ declare const t1: [number, boolean, string]; >t1 : [number, boolean, string] declare function f1(cb: (...args: typeof t1) => void): void; ->f1 : (cb: (args_0: number, args_1: boolean, args_2: string) => void) => void ->cb : (args_0: number, args_1: boolean, args_2: string) => void +>f1 : (cb: (...args: [number, boolean, string]) => void) => void +>cb : (...args: [number, boolean, string]) => void >args : [number, boolean, string] >t1 : [number, boolean, string] f1((a, b, c) => {}) >f1((a, b, c) => {}) : void ->f1 : (cb: (args_0: number, args_1: boolean, args_2: string) => void) => void +>f1 : (cb: (...args: [number, boolean, string]) => void) => void >(a, b, c) => {} : (a: number, b: boolean, c: string) => void >a : number >b : boolean @@ -68,29 +68,29 @@ f1((a, b, c) => {}) f1((...x) => {}) >f1((...x) => {}) : void ->f1 : (cb: (args_0: number, args_1: boolean, args_2: string) => void) => void ->(...x) => {} : (x_0: number, x_1: boolean, x_2: string) => void +>f1 : (cb: (...args: [number, boolean, string]) => void) => void +>(...x) => {} : (...x: [number, boolean, string]) => void >x : [number, boolean, string] f1((a, ...x) => {}) >f1((a, ...x) => {}) : void ->f1 : (cb: (args_0: number, args_1: boolean, args_2: string) => void) => void ->(a, ...x) => {} : (a: number, x_0: boolean, x_1: string) => void +>f1 : (cb: (...args: [number, boolean, string]) => void) => void +>(a, ...x) => {} : (a: number, ...x: [boolean, string]) => void >a : number >x : [boolean, string] f1((a, b, ...x) => {}) >f1((a, b, ...x) => {}) : void ->f1 : (cb: (args_0: number, args_1: boolean, args_2: string) => void) => void ->(a, b, ...x) => {} : (a: number, b: boolean, x_0: string) => void +>f1 : (cb: (...args: [number, boolean, string]) => void) => void +>(a, b, ...x) => {} : (a: number, b: boolean, ...x: [string]) => void >a : number >b : boolean >x : [string] f1((a, b, c, ...x) => {}) >f1((a, b, c, ...x) => {}) : void ->f1 : (cb: (args_0: number, args_1: boolean, args_2: string) => void) => void ->(a, b, c, ...x) => {} : (a: number, b: boolean, c: string) => void +>f1 : (cb: (...args: [number, boolean, string]) => void) => void +>(a, b, c, ...x) => {} : (a: number, b: boolean, c: string, ...x: []) => void >a : number >b : boolean >c : string @@ -111,16 +111,16 @@ declare const t2: [number, boolean, ...string[]]; (function (...x){})(...t2); >(function (...x){})(...t2) : void ->(function (...x){}) : (x_0: number, x_1: boolean, ...x: string[]) => void ->function (...x){} : (x_0: number, x_1: boolean, ...x: string[]) => void +>(function (...x){}) : (...x: [number, boolean, ...string[]]) => void +>function (...x){} : (...x: [number, boolean, ...string[]]) => void >x : [number, boolean, ...string[]] >...t2 : string | number | boolean >t2 : [number, boolean, ...string[]] (function (a, ...x){})(...t2); >(function (a, ...x){})(...t2) : void ->(function (a, ...x){}) : (a: number, x_0: boolean, ...x: string[]) => void ->function (a, ...x){} : (a: number, x_0: boolean, ...x: string[]) => void +>(function (a, ...x){}) : (a: number, ...x: [boolean, ...string[]]) => void +>function (a, ...x){} : (a: number, ...x: [boolean, ...string[]]) => void >a : number >x : [boolean, ...string[]] >...t2 : string | number | boolean @@ -148,14 +148,14 @@ declare const t2: [number, boolean, ...string[]]; >t2 : [number, boolean, ...string[]] declare function f2(cb: (...args: typeof t2) => void): void; ->f2 : (cb: (args_0: number, args_1: boolean, ...args: string[]) => void) => void ->cb : (args_0: number, args_1: boolean, ...args: string[]) => void +>f2 : (cb: (...args: [number, boolean, ...string[]]) => void) => void +>cb : (...args: [number, boolean, ...string[]]) => void >args : [number, boolean, ...string[]] >t2 : [number, boolean, ...string[]] f2((a, b, c) => {}) >f2((a, b, c) => {}) : void ->f2 : (cb: (args_0: number, args_1: boolean, ...args: string[]) => void) => void +>f2 : (cb: (...args: [number, boolean, ...string[]]) => void) => void >(a, b, c) => {} : (a: number, b: boolean, c: string) => void >a : number >b : boolean @@ -163,20 +163,20 @@ f2((a, b, c) => {}) f2((...x) => {}) >f2((...x) => {}) : void ->f2 : (cb: (args_0: number, args_1: boolean, ...args: string[]) => void) => void ->(...x) => {} : (x_0: number, x_1: boolean, ...x: string[]) => void +>f2 : (cb: (...args: [number, boolean, ...string[]]) => void) => void +>(...x) => {} : (...x: [number, boolean, ...string[]]) => void >x : [number, boolean, ...string[]] f2((a, ...x) => {}) >f2((a, ...x) => {}) : void ->f2 : (cb: (args_0: number, args_1: boolean, ...args: string[]) => void) => void ->(a, ...x) => {} : (a: number, x_0: boolean, ...x: string[]) => void +>f2 : (cb: (...args: [number, boolean, ...string[]]) => void) => void +>(a, ...x) => {} : (a: number, ...x: [boolean, ...string[]]) => void >a : number >x : [boolean, ...string[]] f2((a, b, ...x) => {}) >f2((a, b, ...x) => {}) : void ->f2 : (cb: (args_0: number, args_1: boolean, ...args: string[]) => void) => void +>f2 : (cb: (...args: [number, boolean, ...string[]]) => void) => void >(a, b, ...x) => {} : (a: number, b: boolean, ...x: string[]) => void >a : number >b : boolean @@ -184,7 +184,7 @@ f2((a, b, ...x) => {}) f2((a, b, c, ...x) => {}) >f2((a, b, c, ...x) => {}) : void ->f2 : (cb: (args_0: number, args_1: boolean, ...args: string[]) => void) => void +>f2 : (cb: (...args: [number, boolean, ...string[]]) => void) => void >(a, b, c, ...x) => {} : (a: number, b: boolean, c: string, ...x: string[]) => void >a : number >b : boolean @@ -207,8 +207,8 @@ declare const t3: [boolean, ...string[]]; (function (...x){})(1, ...t3); >(function (...x){})(1, ...t3) : void ->(function (...x){}) : (x_0: number, x_1: boolean, ...x: string[]) => void ->function (...x){} : (x_0: number, x_1: boolean, ...x: string[]) => void +>(function (...x){}) : (...x: [number, boolean, ...string[]]) => void +>function (...x){} : (...x: [number, boolean, ...string[]]) => void >x : [number, boolean, ...string[]] >1 : 1 >...t3 : string | boolean @@ -216,8 +216,8 @@ declare const t3: [boolean, ...string[]]; (function (a, ...x){})(1, ...t3); >(function (a, ...x){})(1, ...t3) : void ->(function (a, ...x){}) : (a: number, x_0: boolean, ...x: string[]) => void ->function (a, ...x){} : (a: number, x_0: boolean, ...x: string[]) => void +>(function (a, ...x){}) : (a: number, ...x: [boolean, ...string[]]) => void +>function (a, ...x){} : (a: number, ...x: [boolean, ...string[]]) => void >a : number >x : [boolean, ...string[]] >1 : 1 @@ -248,15 +248,15 @@ declare const t3: [boolean, ...string[]]; >t3 : [boolean, ...string[]] declare function f3(cb: (x: number, ...args: typeof t3) => void): void; ->f3 : (cb: (x: number, args_0: boolean, ...args: string[]) => void) => void ->cb : (x: number, args_0: boolean, ...args: string[]) => void +>f3 : (cb: (x: number, ...args: [boolean, ...string[]]) => void) => void +>cb : (x: number, ...args: [boolean, ...string[]]) => void >x : number >args : [boolean, ...string[]] >t3 : [boolean, ...string[]] f3((a, b, c) => {}) >f3((a, b, c) => {}) : void ->f3 : (cb: (x: number, args_0: boolean, ...args: string[]) => void) => void +>f3 : (cb: (x: number, ...args: [boolean, ...string[]]) => void) => void >(a, b, c) => {} : (a: number, b: boolean, c: string) => void >a : number >b : boolean @@ -264,20 +264,20 @@ f3((a, b, c) => {}) f3((...x) => {}) >f3((...x) => {}) : void ->f3 : (cb: (x: number, args_0: boolean, ...args: string[]) => void) => void ->(...x) => {} : (x: number, x_1: boolean, ...x_2: string[]) => void +>f3 : (cb: (x: number, ...args: [boolean, ...string[]]) => void) => void +>(...x) => {} : (...x: [x: number, boolean, ...string[]]) => void >x : [x: number, boolean, ...string[]] f3((a, ...x) => {}) >f3((a, ...x) => {}) : void ->f3 : (cb: (x: number, args_0: boolean, ...args: string[]) => void) => void ->(a, ...x) => {} : (a: number, x_0: boolean, ...x: string[]) => void +>f3 : (cb: (x: number, ...args: [boolean, ...string[]]) => void) => void +>(a, ...x) => {} : (a: number, ...x: [boolean, ...string[]]) => void >a : number >x : [boolean, ...string[]] f3((a, b, ...x) => {}) >f3((a, b, ...x) => {}) : void ->f3 : (cb: (x: number, args_0: boolean, ...args: string[]) => void) => void +>f3 : (cb: (x: number, ...args: [boolean, ...string[]]) => void) => void >(a, b, ...x) => {} : (a: number, b: boolean, ...x: string[]) => void >a : number >b : boolean @@ -285,7 +285,7 @@ f3((a, b, ...x) => {}) f3((a, b, c, ...x) => {}) >f3((a, b, c, ...x) => {}) : void ->f3 : (cb: (x: number, args_0: boolean, ...args: string[]) => void) => void +>f3 : (cb: (x: number, ...args: [boolean, ...string[]]) => void) => void >(a, b, c, ...x) => {} : (a: number, b: boolean, c: string, ...x: string[]) => void >a : number >b : boolean @@ -316,8 +316,8 @@ function f4(t: T) { (function(a, ...x){})(1, 2, ...t); >(function(a, ...x){})(1, 2, ...t) : void ->(function(a, ...x){}) : (a: number, x_0: number, ...x: T) => void ->function(a, ...x){} : (a: number, x_0: number, ...x: T) => void +>(function(a, ...x){}) : (a: number, ...x: [number, ...T]) => void +>function(a, ...x){} : (a: number, ...x: [number, ...T]) => void >a : number >x : [number, ...T] >1 : 1 @@ -334,7 +334,7 @@ function f4(t: T) { f((...x) => {}); >f((...x) => {}) : void >f : (cb: (x: number, ...args: T) => void) => void ->(...x) => {} : (x: number, ...args: T) => void +>(...x) => {} : (...x: [x: number, ...args: T]) => void >x : [x: number, ...args: T] f((a, ...x) => {}); @@ -360,15 +360,15 @@ declare function f5(f: (...args: T) => U): (...args: T) => U >args : T let g0 = f5(() => "hello"); ->g0 : () => string ->f5(() => "hello") : () => string +>g0 : (...args: []) => string +>f5(() => "hello") : (...args: []) => string >f5 : (f: (...args: T) => U) => (...args: T) => U >() => "hello" : () => string >"hello" : "hello" let g1 = f5((x, y) => 42); ->g1 : (x: any, y: any) => number ->f5((x, y) => 42) : (x: any, y: any) => number +>g1 : (...args: [x: any, y: any]) => number +>f5((x, y) => 42) : (...args: [x: any, y: any]) => number >f5 : (f: (...args: T) => U) => (...args: T) => U >(x, y) => 42 : (x: any, y: any) => number >x : any @@ -376,8 +376,8 @@ let g1 = f5((x, y) => 42); >42 : 42 let g2 = f5((x: number, y) => 42); ->g2 : (x: number, y: any) => number ->f5((x: number, y) => 42) : (x: number, y: any) => number +>g2 : (...args: [x: number, y: any]) => number +>f5((x: number, y) => 42) : (...args: [x: number, y: any]) => number >f5 : (f: (...args: T) => U) => (...args: T) => U >(x: number, y) => 42 : (x: number, y: any) => number >x : number @@ -385,8 +385,8 @@ let g2 = f5((x: number, y) => 42); >42 : 42 let g3 = f5((x: number, y: number) => x + y); ->g3 : (x: number, y: number) => number ->f5((x: number, y: number) => x + y) : (x: number, y: number) => number +>g3 : (...args: [x: number, y: number]) => number +>f5((x: number, y: number) => x + y) : (...args: [x: number, y: number]) => number >f5 : (f: (...args: T) => U) => (...args: T) => U >(x: number, y: number) => x + y : (x: number, y: number) => number >x : number @@ -412,8 +412,8 @@ declare function pipe(f: (...args: A) => B, g: (x: B) => >args : A let g5 = pipe(() => true, b => 42); ->g5 : () => number ->pipe(() => true, b => 42) : () => number +>g5 : (...args: []) => number +>pipe(() => true, b => 42) : (...args: []) => number >pipe : (f: (...args: A) => B, g: (x: B) => C) => (...args: A) => C >() => true : () => boolean >true : true @@ -422,8 +422,8 @@ let g5 = pipe(() => true, b => 42); >42 : 42 let g6 = pipe(x => "hello", s => s.length); ->g6 : (x: any) => number ->pipe(x => "hello", s => s.length) : (x: any) => number +>g6 : (...args: [x: any]) => number +>pipe(x => "hello", s => s.length) : (...args: [x: any]) => number >pipe : (f: (...args: A) => B, g: (x: B) => C) => (...args: A) => C >x => "hello" : (x: any) => string >x : any @@ -435,8 +435,8 @@ let g6 = pipe(x => "hello", s => s.length); >length : number let g7 = pipe((x, y) => 42, x => "" + x); ->g7 : (x: any, y: any) => string ->pipe((x, y) => 42, x => "" + x) : (x: any, y: any) => string +>g7 : (...args: [x: any, y: any]) => string +>pipe((x, y) => 42, x => "" + x) : (...args: [x: any, y: any]) => string >pipe : (f: (...args: A) => B, g: (x: B) => C) => (...args: A) => C >(x, y) => 42 : (x: any, y: any) => number >x : any @@ -449,8 +449,8 @@ let g7 = pipe((x, y) => 42, x => "" + x); >x : number let g8 = pipe((x: number, y: string) => 42, x => "" + x); ->g8 : (x: number, y: string) => string ->pipe((x: number, y: string) => 42, x => "" + x) : (x: number, y: string) => string +>g8 : (...args: [x: number, y: string]) => string +>pipe((x: number, y: string) => 42, x => "" + x) : (...args: [x: number, y: string]) => string >pipe : (f: (...args: A) => B, g: (x: B) => C) => (...args: A) => C >(x: number, y: string) => 42 : (x: number, y: string) => number >x : number @@ -488,8 +488,8 @@ declare function take(cb: (a: number, b: string) => void): void; (function foo(...rest){}(1, '')); >(function foo(...rest){}(1, '')) : void >function foo(...rest){}(1, '') : void ->function foo(...rest){} : (rest_0: number, rest_1: string) => void ->foo : (rest_0: number, rest_1: string) => void +>function foo(...rest){} : (...rest: [number, string]) => void +>foo : (...rest: [number, string]) => void >rest : [number, string] >1 : 1 >'' : "" @@ -497,7 +497,7 @@ declare function take(cb: (a: number, b: string) => void): void; take(function(...rest){}); >take(function(...rest){}) : void >take : (cb: (a: number, b: string) => void) => void ->function(...rest){} : (a: number, b: string) => void +>function(...rest){} : (...rest: [a: number, b: string]) => void >rest : [a: number, b: string] // Repro from #29833 diff --git a/testdata/baselines/reference/submodule/conformance/restTuplesFromContextualTypes.types.diff b/testdata/baselines/reference/submodule/conformance/restTuplesFromContextualTypes.types.diff index e06869c340..e29ee449cb 100644 --- a/testdata/baselines/reference/submodule/conformance/restTuplesFromContextualTypes.types.diff +++ b/testdata/baselines/reference/submodule/conformance/restTuplesFromContextualTypes.types.diff @@ -1,19 +1,63 @@ --- old.restTuplesFromContextualTypes.types +++ new.restTuplesFromContextualTypes.types -@@= skipped -52, +52 lines =@@ +@@= skipped -15, +15 lines =@@ + + (function (...x){})(...t1); + >(function (...x){})(...t1) : void +->(function (...x){}) : (x_0: number, x_1: boolean, x_2: string) => void +->function (...x){} : (x_0: number, x_1: boolean, x_2: string) => void ++>(function (...x){}) : (...x: [number, boolean, string]) => void ++>function (...x){} : (...x: [number, boolean, string]) => void + >x : [number, boolean, string] + >...t1 : string | number | boolean + >t1 : [number, boolean, string] + + (function (a, ...x){})(...t1); + >(function (a, ...x){})(...t1) : void +->(function (a, ...x){}) : (a: number, x_0: boolean, x_1: string) => void +->function (a, ...x){} : (a: number, x_0: boolean, x_1: string) => void ++>(function (a, ...x){}) : (a: number, ...x: [boolean, string]) => void ++>function (a, ...x){} : (a: number, ...x: [boolean, string]) => void + >a : number + >x : [boolean, string] + >...t1 : string | number | boolean +@@= skipped -17, +17 lines =@@ + + (function (a, b, ...x){})(...t1); + >(function (a, b, ...x){})(...t1) : void +->(function (a, b, ...x){}) : (a: number, b: boolean, x_0: string) => void +->function (a, b, ...x){} : (a: number, b: boolean, x_0: string) => void ++>(function (a, b, ...x){}) : (a: number, b: boolean, ...x: [string]) => void ++>function (a, b, ...x){} : (a: number, b: boolean, ...x: [string]) => void + >a : number + >b : boolean + >x : [string] +@@= skipped -10, +10 lines =@@ + + (function (a, b, c, ...x){})(...t1); + >(function (a, b, c, ...x){})(...t1) : void +->(function (a, b, c, ...x){}) : (a: number, b: boolean, c: string) => void +->function (a, b, c, ...x){} : (a: number, b: boolean, c: string) => void ++>(function (a, b, c, ...x){}) : (a: number, b: boolean, c: string, ...x: []) => void ++>function (a, b, c, ...x){} : (a: number, b: boolean, c: string, ...x: []) => void + >a : number + >b : boolean + >c : string +@@= skipped -10, +10 lines =@@ >t1 : [number, boolean, string] declare function f1(cb: (...args: typeof t1) => void): void; ->f1 : (cb: (...args: typeof t1) => void) => void -+>f1 : (cb: (args_0: number, args_1: boolean, args_2: string) => void) => void - >cb : (args_0: number, args_1: boolean, args_2: string) => void +->cb : (args_0: number, args_1: boolean, args_2: string) => void ++>f1 : (cb: (...args: [number, boolean, string]) => void) => void ++>cb : (...args: [number, boolean, string]) => void >args : [number, boolean, string] >t1 : [number, boolean, string] f1((a, b, c) => {}) >f1((a, b, c) => {}) : void ->f1 : (cb: (...args: typeof t1) => void) => void -+>f1 : (cb: (args_0: number, args_1: boolean, args_2: string) => void) => void ++>f1 : (cb: (...args: [number, boolean, string]) => void) => void >(a, b, c) => {} : (a: number, b: boolean, c: string) => void >a : number >b : boolean @@ -22,48 +66,75 @@ f1((...x) => {}) >f1((...x) => {}) : void ->f1 : (cb: (...args: typeof t1) => void) => void -+>f1 : (cb: (args_0: number, args_1: boolean, args_2: string) => void) => void - >(...x) => {} : (x_0: number, x_1: boolean, x_2: string) => void +->(...x) => {} : (x_0: number, x_1: boolean, x_2: string) => void ++>f1 : (cb: (...args: [number, boolean, string]) => void) => void ++>(...x) => {} : (...x: [number, boolean, string]) => void >x : [number, boolean, string] f1((a, ...x) => {}) >f1((a, ...x) => {}) : void ->f1 : (cb: (...args: typeof t1) => void) => void -+>f1 : (cb: (args_0: number, args_1: boolean, args_2: string) => void) => void - >(a, ...x) => {} : (a: number, x_0: boolean, x_1: string) => void +->(a, ...x) => {} : (a: number, x_0: boolean, x_1: string) => void ++>f1 : (cb: (...args: [number, boolean, string]) => void) => void ++>(a, ...x) => {} : (a: number, ...x: [boolean, string]) => void >a : number >x : [boolean, string] f1((a, b, ...x) => {}) >f1((a, b, ...x) => {}) : void ->f1 : (cb: (...args: typeof t1) => void) => void -+>f1 : (cb: (args_0: number, args_1: boolean, args_2: string) => void) => void - >(a, b, ...x) => {} : (a: number, b: boolean, x_0: string) => void +->(a, b, ...x) => {} : (a: number, b: boolean, x_0: string) => void ++>f1 : (cb: (...args: [number, boolean, string]) => void) => void ++>(a, b, ...x) => {} : (a: number, b: boolean, ...x: [string]) => void >a : number >b : boolean -@@= skipped -21, +21 lines =@@ + >x : [string] f1((a, b, c, ...x) => {}) >f1((a, b, c, ...x) => {}) : void ->f1 : (cb: (...args: typeof t1) => void) => void -+>f1 : (cb: (args_0: number, args_1: boolean, args_2: string) => void) => void - >(a, b, c, ...x) => {} : (a: number, b: boolean, c: string) => void +->(a, b, c, ...x) => {} : (a: number, b: boolean, c: string) => void ++>f1 : (cb: (...args: [number, boolean, string]) => void) => void ++>(a, b, c, ...x) => {} : (a: number, b: boolean, c: string, ...x: []) => void >a : number >b : boolean -@@= skipped -59, +59 lines =@@ + >c : string +@@= skipped -43, +43 lines =@@ + + (function (...x){})(...t2); + >(function (...x){})(...t2) : void +->(function (...x){}) : (x_0: number, x_1: boolean, ...x: string[]) => void +->function (...x){} : (x_0: number, x_1: boolean, ...x: string[]) => void ++>(function (...x){}) : (...x: [number, boolean, ...string[]]) => void ++>function (...x){} : (...x: [number, boolean, ...string[]]) => void + >x : [number, boolean, ...string[]] + >...t2 : string | number | boolean + >t2 : [number, boolean, ...string[]] + + (function (a, ...x){})(...t2); + >(function (a, ...x){})(...t2) : void +->(function (a, ...x){}) : (a: number, x_0: boolean, ...x: string[]) => void +->function (a, ...x){} : (a: number, x_0: boolean, ...x: string[]) => void ++>(function (a, ...x){}) : (a: number, ...x: [boolean, ...string[]]) => void ++>function (a, ...x){} : (a: number, ...x: [boolean, ...string[]]) => void + >a : number + >x : [boolean, ...string[]] + >...t2 : string | number | boolean +@@= skipped -37, +37 lines =@@ >t2 : [number, boolean, ...string[]] declare function f2(cb: (...args: typeof t2) => void): void; ->f2 : (cb: (...args: typeof t2) => void) => void -+>f2 : (cb: (args_0: number, args_1: boolean, ...args: string[]) => void) => void - >cb : (args_0: number, args_1: boolean, ...args: string[]) => void +->cb : (args_0: number, args_1: boolean, ...args: string[]) => void ++>f2 : (cb: (...args: [number, boolean, ...string[]]) => void) => void ++>cb : (...args: [number, boolean, ...string[]]) => void >args : [number, boolean, ...string[]] >t2 : [number, boolean, ...string[]] f2((a, b, c) => {}) >f2((a, b, c) => {}) : void ->f2 : (cb: (...args: typeof t2) => void) => void -+>f2 : (cb: (args_0: number, args_1: boolean, ...args: string[]) => void) => void ++>f2 : (cb: (...args: [number, boolean, ...string[]]) => void) => void >(a, b, c) => {} : (a: number, b: boolean, c: string) => void >a : number >b : boolean @@ -72,22 +143,24 @@ f2((...x) => {}) >f2((...x) => {}) : void ->f2 : (cb: (...args: typeof t2) => void) => void -+>f2 : (cb: (args_0: number, args_1: boolean, ...args: string[]) => void) => void - >(...x) => {} : (x_0: number, x_1: boolean, ...x: string[]) => void +->(...x) => {} : (x_0: number, x_1: boolean, ...x: string[]) => void ++>f2 : (cb: (...args: [number, boolean, ...string[]]) => void) => void ++>(...x) => {} : (...x: [number, boolean, ...string[]]) => void >x : [number, boolean, ...string[]] f2((a, ...x) => {}) >f2((a, ...x) => {}) : void ->f2 : (cb: (...args: typeof t2) => void) => void -+>f2 : (cb: (args_0: number, args_1: boolean, ...args: string[]) => void) => void - >(a, ...x) => {} : (a: number, x_0: boolean, ...x: string[]) => void +->(a, ...x) => {} : (a: number, x_0: boolean, ...x: string[]) => void ++>f2 : (cb: (...args: [number, boolean, ...string[]]) => void) => void ++>(a, ...x) => {} : (a: number, ...x: [boolean, ...string[]]) => void >a : number >x : [boolean, ...string[]] f2((a, b, ...x) => {}) >f2((a, b, ...x) => {}) : void ->f2 : (cb: (...args: typeof t2) => void) => void -+>f2 : (cb: (args_0: number, args_1: boolean, ...args: string[]) => void) => void ++>f2 : (cb: (...args: [number, boolean, ...string[]]) => void) => void >(a, b, ...x) => {} : (a: number, b: boolean, ...x: string[]) => void >a : number >b : boolean @@ -96,49 +169,74 @@ f2((a, b, c, ...x) => {}) >f2((a, b, c, ...x) => {}) : void ->f2 : (cb: (...args: typeof t2) => void) => void -+>f2 : (cb: (args_0: number, args_1: boolean, ...args: string[]) => void) => void ++>f2 : (cb: (...args: [number, boolean, ...string[]]) => void) => void >(a, b, c, ...x) => {} : (a: number, b: boolean, c: string, ...x: string[]) => void >a : number >b : boolean -@@= skipped -64, +64 lines =@@ +@@= skipped -23, +23 lines =@@ + + (function (...x){})(1, ...t3); + >(function (...x){})(1, ...t3) : void +->(function (...x){}) : (x_0: number, x_1: boolean, ...x: string[]) => void +->function (...x){} : (x_0: number, x_1: boolean, ...x: string[]) => void ++>(function (...x){}) : (...x: [number, boolean, ...string[]]) => void ++>function (...x){} : (...x: [number, boolean, ...string[]]) => void + >x : [number, boolean, ...string[]] + >1 : 1 + >...t3 : string | boolean +@@= skipped -9, +9 lines =@@ + + (function (a, ...x){})(1, ...t3); + >(function (a, ...x){})(1, ...t3) : void +->(function (a, ...x){}) : (a: number, x_0: boolean, ...x: string[]) => void +->function (a, ...x){} : (a: number, x_0: boolean, ...x: string[]) => void ++>(function (a, ...x){}) : (a: number, ...x: [boolean, ...string[]]) => void ++>function (a, ...x){} : (a: number, ...x: [boolean, ...string[]]) => void + >a : number + >x : [boolean, ...string[]] + >1 : 1 +@@= skipped -32, +32 lines =@@ >t3 : [boolean, ...string[]] declare function f3(cb: (x: number, ...args: typeof t3) => void): void; ->f3 : (cb: (x: number, ...args: typeof t3) => void) => void -+>f3 : (cb: (x: number, args_0: boolean, ...args: string[]) => void) => void - >cb : (x: number, args_0: boolean, ...args: string[]) => void +->cb : (x: number, args_0: boolean, ...args: string[]) => void ++>f3 : (cb: (x: number, ...args: [boolean, ...string[]]) => void) => void ++>cb : (x: number, ...args: [boolean, ...string[]]) => void >x : number >args : [boolean, ...string[]] -@@= skipped -8, +8 lines =@@ + >t3 : [boolean, ...string[]] f3((a, b, c) => {}) >f3((a, b, c) => {}) : void ->f3 : (cb: (x: number, ...args: typeof t3) => void) => void -+>f3 : (cb: (x: number, args_0: boolean, ...args: string[]) => void) => void ++>f3 : (cb: (x: number, ...args: [boolean, ...string[]]) => void) => void >(a, b, c) => {} : (a: number, b: boolean, c: string) => void >a : number >b : boolean -@@= skipped -8, +8 lines =@@ +@@= skipped -16, +16 lines =@@ f3((...x) => {}) >f3((...x) => {}) : void ->f3 : (cb: (x: number, ...args: typeof t3) => void) => void -+>f3 : (cb: (x: number, args_0: boolean, ...args: string[]) => void) => void - >(...x) => {} : (x: number, x_1: boolean, ...x_2: string[]) => void +->(...x) => {} : (x: number, x_1: boolean, ...x_2: string[]) => void ++>f3 : (cb: (x: number, ...args: [boolean, ...string[]]) => void) => void ++>(...x) => {} : (...x: [x: number, boolean, ...string[]]) => void >x : [x: number, boolean, ...string[]] f3((a, ...x) => {}) >f3((a, ...x) => {}) : void ->f3 : (cb: (x: number, ...args: typeof t3) => void) => void -+>f3 : (cb: (x: number, args_0: boolean, ...args: string[]) => void) => void - >(a, ...x) => {} : (a: number, x_0: boolean, ...x: string[]) => void +->(a, ...x) => {} : (a: number, x_0: boolean, ...x: string[]) => void ++>f3 : (cb: (x: number, ...args: [boolean, ...string[]]) => void) => void ++>(a, ...x) => {} : (a: number, ...x: [boolean, ...string[]]) => void >a : number >x : [boolean, ...string[]] f3((a, b, ...x) => {}) >f3((a, b, ...x) => {}) : void ->f3 : (cb: (x: number, ...args: typeof t3) => void) => void -+>f3 : (cb: (x: number, args_0: boolean, ...args: string[]) => void) => void ++>f3 : (cb: (x: number, ...args: [boolean, ...string[]]) => void) => void >(a, b, ...x) => {} : (a: number, b: boolean, ...x: string[]) => void >a : number >b : boolean @@ -147,7 +245,133 @@ f3((a, b, c, ...x) => {}) >f3((a, b, c, ...x) => {}) : void ->f3 : (cb: (x: number, ...args: typeof t3) => void) => void -+>f3 : (cb: (x: number, args_0: boolean, ...args: string[]) => void) => void ++>f3 : (cb: (x: number, ...args: [boolean, ...string[]]) => void) => void >(a, b, c, ...x) => {} : (a: number, b: boolean, c: string, ...x: string[]) => void >a : number - >b : boolean \ No newline at end of file + >b : boolean +@@= skipped -31, +31 lines =@@ + + (function(a, ...x){})(1, 2, ...t); + >(function(a, ...x){})(1, 2, ...t) : void +->(function(a, ...x){}) : (a: number, x_0: number, ...x: T) => void +->function(a, ...x){} : (a: number, x_0: number, ...x: T) => void ++>(function(a, ...x){}) : (a: number, ...x: [number, ...T]) => void ++>function(a, ...x){} : (a: number, ...x: [number, ...T]) => void + >a : number + >x : [number, ...T] + >1 : 1 +@@= skipped -18, +18 lines =@@ + f((...x) => {}); + >f((...x) => {}) : void + >f : (cb: (x: number, ...args: T) => void) => void +->(...x) => {} : (x: number, ...args: T) => void ++>(...x) => {} : (...x: [x: number, ...args: T]) => void + >x : [x: number, ...args: T] + + f((a, ...x) => {}); +@@= skipped -26, +26 lines =@@ + >args : T + + let g0 = f5(() => "hello"); +->g0 : () => string +->f5(() => "hello") : () => string ++>g0 : (...args: []) => string ++>f5(() => "hello") : (...args: []) => string + >f5 : (f: (...args: T) => U) => (...args: T) => U + >() => "hello" : () => string + >"hello" : "hello" + + let g1 = f5((x, y) => 42); +->g1 : (x: any, y: any) => number +->f5((x, y) => 42) : (x: any, y: any) => number ++>g1 : (...args: [x: any, y: any]) => number ++>f5((x, y) => 42) : (...args: [x: any, y: any]) => number + >f5 : (f: (...args: T) => U) => (...args: T) => U + >(x, y) => 42 : (x: any, y: any) => number + >x : any +@@= skipped -16, +16 lines =@@ + >42 : 42 + + let g2 = f5((x: number, y) => 42); +->g2 : (x: number, y: any) => number +->f5((x: number, y) => 42) : (x: number, y: any) => number ++>g2 : (...args: [x: number, y: any]) => number ++>f5((x: number, y) => 42) : (...args: [x: number, y: any]) => number + >f5 : (f: (...args: T) => U) => (...args: T) => U + >(x: number, y) => 42 : (x: number, y: any) => number + >x : number +@@= skipped -9, +9 lines =@@ + >42 : 42 + + let g3 = f5((x: number, y: number) => x + y); +->g3 : (x: number, y: number) => number +->f5((x: number, y: number) => x + y) : (x: number, y: number) => number ++>g3 : (...args: [x: number, y: number]) => number ++>f5((x: number, y: number) => x + y) : (...args: [x: number, y: number]) => number + >f5 : (f: (...args: T) => U) => (...args: T) => U + >(x: number, y: number) => x + y : (x: number, y: number) => number + >x : number +@@= skipped -27, +27 lines =@@ + >args : A + + let g5 = pipe(() => true, b => 42); +->g5 : () => number +->pipe(() => true, b => 42) : () => number ++>g5 : (...args: []) => number ++>pipe(() => true, b => 42) : (...args: []) => number + >pipe : (f: (...args: A) => B, g: (x: B) => C) => (...args: A) => C + >() => true : () => boolean + >true : true +@@= skipped -10, +10 lines =@@ + >42 : 42 + + let g6 = pipe(x => "hello", s => s.length); +->g6 : (x: any) => number +->pipe(x => "hello", s => s.length) : (x: any) => number ++>g6 : (...args: [x: any]) => number ++>pipe(x => "hello", s => s.length) : (...args: [x: any]) => number + >pipe : (f: (...args: A) => B, g: (x: B) => C) => (...args: A) => C + >x => "hello" : (x: any) => string + >x : any +@@= skipped -13, +13 lines =@@ + >length : number + + let g7 = pipe((x, y) => 42, x => "" + x); +->g7 : (x: any, y: any) => string +->pipe((x, y) => 42, x => "" + x) : (x: any, y: any) => string ++>g7 : (...args: [x: any, y: any]) => string ++>pipe((x, y) => 42, x => "" + x) : (...args: [x: any, y: any]) => string + >pipe : (f: (...args: A) => B, g: (x: B) => C) => (...args: A) => C + >(x, y) => 42 : (x: any, y: any) => number + >x : any +@@= skipped -14, +14 lines =@@ + >x : number + + let g8 = pipe((x: number, y: string) => 42, x => "" + x); +->g8 : (x: number, y: string) => string +->pipe((x: number, y: string) => 42, x => "" + x) : (x: number, y: string) => string ++>g8 : (...args: [x: number, y: string]) => string ++>pipe((x: number, y: string) => 42, x => "" + x) : (...args: [x: number, y: string]) => string + >pipe : (f: (...args: A) => B, g: (x: B) => C) => (...args: A) => C + >(x: number, y: string) => 42 : (x: number, y: string) => number + >x : number +@@= skipped -39, +39 lines =@@ + (function foo(...rest){}(1, '')); + >(function foo(...rest){}(1, '')) : void + >function foo(...rest){}(1, '') : void +->function foo(...rest){} : (rest_0: number, rest_1: string) => void +->foo : (rest_0: number, rest_1: string) => void ++>function foo(...rest){} : (...rest: [number, string]) => void ++>foo : (...rest: [number, string]) => void + >rest : [number, string] + >1 : 1 + >'' : "" +@@= skipped -9, +9 lines =@@ + take(function(...rest){}); + >take(function(...rest){}) : void + >take : (cb: (a: number, b: string) => void) => void +->function(...rest){} : (a: number, b: string) => void ++>function(...rest){} : (...rest: [a: number, b: string]) => void + >rest : [a: number, b: string] + + // Repro from #29833 \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/strictBindCallApply1.errors.txt b/testdata/baselines/reference/submodule/conformance/strictBindCallApply1.errors.txt index f587b62209..9d6a82b282 100644 --- a/testdata/baselines/reference/submodule/conformance/strictBindCallApply1.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/strictBindCallApply1.errors.txt @@ -38,7 +38,7 @@ strictBindCallApply1.ts(76,5): error TS2769: No overload matches this call. 'unknown[]' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'unknown[]'. strictBindCallApply1.ts(81,5): error TS2769: No overload matches this call. The last overload gave the following error. - The 'this' context of type '(this: 1, ...args: T extends 1 ? [unknown] : [unknown, unknown]) => void' is not assignable to method's 'this' of type '(this: 1, args_0: unknown) => void'. + The 'this' context of type '(this: 1, ...args: T extends 1 ? [unknown] : [unknown, unknown]) => void' is not assignable to method's 'this' of type '(this: 1, ...args: [unknown]) => void'. Types of parameters 'args' and 'args' are incompatible. Type '[unknown]' is not assignable to type 'T extends 1 ? [unknown] : [unknown, unknown]'. @@ -193,7 +193,7 @@ strictBindCallApply1.ts(81,5): error TS2769: No overload matches this call. ~~~~~~~~ !!! error TS2769: No overload matches this call. !!! error TS2769: The last overload gave the following error. -!!! error TS2769: The 'this' context of type '(this: 1, ...args: T extends 1 ? [unknown] : [unknown, unknown]) => void' is not assignable to method's 'this' of type '(this: 1, args_0: unknown) => void'. +!!! error TS2769: The 'this' context of type '(this: 1, ...args: T extends 1 ? [unknown] : [unknown, unknown]) => void' is not assignable to method's 'this' of type '(this: 1, ...args: [unknown]) => void'. !!! error TS2769: Types of parameters 'args' and 'args' are incompatible. !!! error TS2769: Type '[unknown]' is not assignable to type 'T extends 1 ? [unknown] : [unknown, unknown]'. !!! related TS2771 lib.es5.d.ts:--:--: The last overload is declared here. diff --git a/testdata/baselines/reference/submodule/conformance/strictBindCallApply1.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/strictBindCallApply1.errors.txt.diff index 5ce52243fe..6d251989a8 100644 --- a/testdata/baselines/reference/submodule/conformance/strictBindCallApply1.errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/strictBindCallApply1.errors.txt.diff @@ -29,10 +29,11 @@ - Overload 1 of 2, '(this: (this: 1, ...args: T extends 1 ? [unknown] : [unknown, unknown]) => void, thisArg: 1): (...args: T extends 1 ? [unknown] : [unknown, unknown]) => void', gave the following error. - Argument of type '2' is not assignable to parameter of type '1'. - Overload 2 of 2, '(this: (this: 1, args_0: unknown) => void, thisArg: 1): (args_0: unknown) => void', gave the following error. +- The 'this' context of type '(this: 1, ...args: T extends 1 ? [unknown] : [unknown, unknown]) => void' is not assignable to method's 'this' of type '(this: 1, args_0: unknown) => void'. +- Types of parameters 'args' and 'args_0' are incompatible. +strictBindCallApply1.ts(81,5): error TS2769: No overload matches this call. + The last overload gave the following error. - The 'this' context of type '(this: 1, ...args: T extends 1 ? [unknown] : [unknown, unknown]) => void' is not assignable to method's 'this' of type '(this: 1, args_0: unknown) => void'. -- Types of parameters 'args' and 'args_0' are incompatible. ++ The 'this' context of type '(this: 1, ...args: T extends 1 ? [unknown] : [unknown, unknown]) => void' is not assignable to method's 'this' of type '(this: 1, ...args: [unknown]) => void'. + Types of parameters 'args' and 'args' are incompatible. Type '[unknown]' is not assignable to type 'T extends 1 ? [unknown] : [unknown, unknown]'. @@ -78,9 +79,10 @@ -!!! error TS2769: Overload 1 of 2, '(this: (this: 1, ...args: T extends 1 ? [unknown] : [unknown, unknown]) => void, thisArg: 1): (...args: T extends 1 ? [unknown] : [unknown, unknown]) => void', gave the following error. -!!! error TS2769: Argument of type '2' is not assignable to parameter of type '1'. -!!! error TS2769: Overload 2 of 2, '(this: (this: 1, args_0: unknown) => void, thisArg: 1): (args_0: unknown) => void', gave the following error. -+!!! error TS2769: The last overload gave the following error. - !!! error TS2769: The 'this' context of type '(this: 1, ...args: T extends 1 ? [unknown] : [unknown, unknown]) => void' is not assignable to method's 'this' of type '(this: 1, args_0: unknown) => void'. +-!!! error TS2769: The 'this' context of type '(this: 1, ...args: T extends 1 ? [unknown] : [unknown, unknown]) => void' is not assignable to method's 'this' of type '(this: 1, args_0: unknown) => void'. -!!! error TS2769: Types of parameters 'args' and 'args_0' are incompatible. ++!!! error TS2769: The last overload gave the following error. ++!!! error TS2769: The 'this' context of type '(this: 1, ...args: T extends 1 ? [unknown] : [unknown, unknown]) => void' is not assignable to method's 'this' of type '(this: 1, ...args: [unknown]) => void'. +!!! error TS2769: Types of parameters 'args' and 'args' are incompatible. !!! error TS2769: Type '[unknown]' is not assignable to type 'T extends 1 ? [unknown] : [unknown, unknown]'. +!!! related TS2771 lib.es5.d.ts:--:--: The last overload is declared here. diff --git a/testdata/baselines/reference/submodule/conformance/strictBindCallApply1.types b/testdata/baselines/reference/submodule/conformance/strictBindCallApply1.types index a679c78c38..43f6595aea 100644 --- a/testdata/baselines/reference/submodule/conformance/strictBindCallApply1.types +++ b/testdata/baselines/reference/submodule/conformance/strictBindCallApply1.types @@ -27,8 +27,8 @@ let f00 = foo.bind(undefined); >undefined : undefined let f01 = foo.bind(undefined, 10); ->f01 : (b: string) => string ->foo.bind(undefined, 10) : (b: string) => string +>f01 : (...args: [b: string]) => string +>foo.bind(undefined, 10) : (...args: [b: string]) => string >foo.bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (this: (this: T, ...args: [...A, ...B]) => R, thisArg: T, ...args: A): (...args: B) => R; } >foo : (a: number, b: string) => string >bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (this: (this: T, ...args: [...A, ...B]) => R, thisArg: T, ...args: A): (...args: B) => R; } @@ -36,8 +36,8 @@ let f01 = foo.bind(undefined, 10); >10 : 10 let f02 = foo.bind(undefined, 10, "hello"); ->f02 : () => string ->foo.bind(undefined, 10, "hello") : () => string +>f02 : (...args: []) => string +>foo.bind(undefined, 10, "hello") : (...args: []) => string >foo.bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (this: (this: T, ...args: [...A, ...B]) => R, thisArg: T, ...args: A): (...args: B) => R; } >foo : (a: number, b: string) => string >bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (this: (this: T, ...args: [...A, ...B]) => R, thisArg: T, ...args: A): (...args: B) => R; } @@ -46,8 +46,8 @@ let f02 = foo.bind(undefined, 10, "hello"); >"hello" : "hello" let f03 = foo.bind(undefined, 10, 20); // Error ->f03 : () => string ->foo.bind(undefined, 10, 20) : () => string +>f03 : (...args: []) => string +>foo.bind(undefined, 10, 20) : (...args: []) => string >foo.bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (this: (this: T, ...args: [...A, ...B]) => R, thisArg: T, ...args: A): (...args: B) => R; } >foo : (a: number, b: string) => string >bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (this: (this: T, ...args: [...A, ...B]) => R, thisArg: T, ...args: A): (...args: B) => R; } @@ -196,8 +196,8 @@ declare let obj: {}; >obj : {} let f10 = c.foo.bind(c); ->f10 : (a: number, b: string) => string ->c.foo.bind(c) : (a: number, b: string) => string +>f10 : (...args: [a: number, b: string]) => string +>c.foo.bind(c) : (...args: [a: number, b: string]) => string >c.foo.bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (this: (this: T, ...args: [...A, ...B]) => R, thisArg: T, ...args: A): (...args: B) => R; } >c.foo : (this: C, a: number, b: string) => string >c : C @@ -206,8 +206,8 @@ let f10 = c.foo.bind(c); >c : C let f11 = c.foo.bind(c, 10); ->f11 : (b: string) => string ->c.foo.bind(c, 10) : (b: string) => string +>f11 : (...args: [b: string]) => string +>c.foo.bind(c, 10) : (...args: [b: string]) => string >c.foo.bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (this: (this: T, ...args: [...A, ...B]) => R, thisArg: T, ...args: A): (...args: B) => R; } >c.foo : (this: C, a: number, b: string) => string >c : C @@ -217,8 +217,8 @@ let f11 = c.foo.bind(c, 10); >10 : 10 let f12 = c.foo.bind(c, 10, "hello"); ->f12 : () => string ->c.foo.bind(c, 10, "hello") : () => string +>f12 : (...args: []) => string +>c.foo.bind(c, 10, "hello") : (...args: []) => string >c.foo.bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (this: (this: T, ...args: [...A, ...B]) => R, thisArg: T, ...args: A): (...args: B) => R; } >c.foo : (this: C, a: number, b: string) => string >c : C @@ -229,8 +229,8 @@ let f12 = c.foo.bind(c, 10, "hello"); >"hello" : "hello" let f13 = c.foo.bind(c, 10, 20); // Error ->f13 : () => string ->c.foo.bind(c, 10, 20) : () => string +>f13 : (...args: []) => string +>c.foo.bind(c, 10, 20) : (...args: []) => string >c.foo.bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (this: (this: T, ...args: [...A, ...B]) => R, thisArg: T, ...args: A): (...args: B) => R; } >c.foo : (this: C, a: number, b: string) => string >c : C @@ -241,8 +241,8 @@ let f13 = c.foo.bind(c, 10, 20); // Error >20 : 20 let f14 = c.foo.bind(undefined); // Error ->f14 : (a: number, b: string) => string ->c.foo.bind(undefined) : (a: number, b: string) => string +>f14 : (...args: [a: number, b: string]) => string +>c.foo.bind(undefined) : (...args: [a: number, b: string]) => string >c.foo.bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (this: (this: T, ...args: [...A, ...B]) => R, thisArg: T, ...args: A): (...args: B) => R; } >c.foo : (this: C, a: number, b: string) => string >c : C @@ -404,8 +404,8 @@ let f20 = C.bind(undefined); >undefined : undefined let f21 = C.bind(undefined, 10); ->f21 : new (b: string) => C ->C.bind(undefined, 10) : new (b: string) => C +>f21 : new (...args: [b: string]) => C +>C.bind(undefined, 10) : new (...args: [b: string]) => C >C.bind : { (this: T, thisArg: any): T; (this: new (...args: [...A, ...B]) => R, thisArg: any, ...args: A): new (...args: B) => R; } >C : typeof C >bind : { (this: T, thisArg: any): T; (this: new (...args: [...A, ...B]) => R, thisArg: any, ...args: A): new (...args: B) => R; } @@ -413,8 +413,8 @@ let f21 = C.bind(undefined, 10); >10 : 10 let f22 = C.bind(undefined, 10, "hello"); ->f22 : new () => C ->C.bind(undefined, 10, "hello") : new () => C +>f22 : new (...args: []) => C +>C.bind(undefined, 10, "hello") : new (...args: []) => C >C.bind : { (this: T, thisArg: any): T; (this: new (...args: [...A, ...B]) => R, thisArg: any, ...args: A): new (...args: B) => R; } >C : typeof C >bind : { (this: T, thisArg: any): T; (this: new (...args: [...A, ...B]) => R, thisArg: any, ...args: A): new (...args: B) => R; } @@ -423,8 +423,8 @@ let f22 = C.bind(undefined, 10, "hello"); >"hello" : "hello" let f23 = C.bind(undefined, 10, 20); // Error ->f23 : new () => C ->C.bind(undefined, 10, 20) : new () => C +>f23 : new (...args: []) => C +>C.bind(undefined, 10, 20) : new (...args: []) => C >C.bind : { (this: T, thisArg: any): T; (this: new (...args: [...A, ...B]) => R, thisArg: any, ...args: A): new (...args: B) => R; } >C : typeof C >bind : { (this: T, thisArg: any): T; (this: new (...args: [...A, ...B]) => R, thisArg: any, ...args: A): new (...args: B) => R; } diff --git a/testdata/baselines/reference/submodule/conformance/strictBindCallApply1.types.diff b/testdata/baselines/reference/submodule/conformance/strictBindCallApply1.types.diff new file mode 100644 index 0000000000..fa5ef09804 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/strictBindCallApply1.types.diff @@ -0,0 +1,123 @@ +--- old.strictBindCallApply1.types ++++ new.strictBindCallApply1.types +@@= skipped -26, +26 lines =@@ + >undefined : undefined + + let f01 = foo.bind(undefined, 10); +->f01 : (b: string) => string +->foo.bind(undefined, 10) : (b: string) => string ++>f01 : (...args: [b: string]) => string ++>foo.bind(undefined, 10) : (...args: [b: string]) => string + >foo.bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (this: (this: T, ...args: [...A, ...B]) => R, thisArg: T, ...args: A): (...args: B) => R; } + >foo : (a: number, b: string) => string + >bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (this: (this: T, ...args: [...A, ...B]) => R, thisArg: T, ...args: A): (...args: B) => R; } +@@= skipped -9, +9 lines =@@ + >10 : 10 + + let f02 = foo.bind(undefined, 10, "hello"); +->f02 : () => string +->foo.bind(undefined, 10, "hello") : () => string ++>f02 : (...args: []) => string ++>foo.bind(undefined, 10, "hello") : (...args: []) => string + >foo.bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (this: (this: T, ...args: [...A, ...B]) => R, thisArg: T, ...args: A): (...args: B) => R; } + >foo : (a: number, b: string) => string + >bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (this: (this: T, ...args: [...A, ...B]) => R, thisArg: T, ...args: A): (...args: B) => R; } +@@= skipped -10, +10 lines =@@ + >"hello" : "hello" + + let f03 = foo.bind(undefined, 10, 20); // Error +->f03 : () => string +->foo.bind(undefined, 10, 20) : () => string ++>f03 : (...args: []) => string ++>foo.bind(undefined, 10, 20) : (...args: []) => string + >foo.bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (this: (this: T, ...args: [...A, ...B]) => R, thisArg: T, ...args: A): (...args: B) => R; } + >foo : (a: number, b: string) => string + >bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (this: (this: T, ...args: [...A, ...B]) => R, thisArg: T, ...args: A): (...args: B) => R; } +@@= skipped -150, +150 lines =@@ + >obj : {} + + let f10 = c.foo.bind(c); +->f10 : (a: number, b: string) => string +->c.foo.bind(c) : (a: number, b: string) => string ++>f10 : (...args: [a: number, b: string]) => string ++>c.foo.bind(c) : (...args: [a: number, b: string]) => string + >c.foo.bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (this: (this: T, ...args: [...A, ...B]) => R, thisArg: T, ...args: A): (...args: B) => R; } + >c.foo : (this: C, a: number, b: string) => string + >c : C +@@= skipped -10, +10 lines =@@ + >c : C + + let f11 = c.foo.bind(c, 10); +->f11 : (b: string) => string +->c.foo.bind(c, 10) : (b: string) => string ++>f11 : (...args: [b: string]) => string ++>c.foo.bind(c, 10) : (...args: [b: string]) => string + >c.foo.bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (this: (this: T, ...args: [...A, ...B]) => R, thisArg: T, ...args: A): (...args: B) => R; } + >c.foo : (this: C, a: number, b: string) => string + >c : C +@@= skipped -11, +11 lines =@@ + >10 : 10 + + let f12 = c.foo.bind(c, 10, "hello"); +->f12 : () => string +->c.foo.bind(c, 10, "hello") : () => string ++>f12 : (...args: []) => string ++>c.foo.bind(c, 10, "hello") : (...args: []) => string + >c.foo.bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (this: (this: T, ...args: [...A, ...B]) => R, thisArg: T, ...args: A): (...args: B) => R; } + >c.foo : (this: C, a: number, b: string) => string + >c : C +@@= skipped -12, +12 lines =@@ + >"hello" : "hello" + + let f13 = c.foo.bind(c, 10, 20); // Error +->f13 : () => string +->c.foo.bind(c, 10, 20) : () => string ++>f13 : (...args: []) => string ++>c.foo.bind(c, 10, 20) : (...args: []) => string + >c.foo.bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (this: (this: T, ...args: [...A, ...B]) => R, thisArg: T, ...args: A): (...args: B) => R; } + >c.foo : (this: C, a: number, b: string) => string + >c : C +@@= skipped -12, +12 lines =@@ + >20 : 20 + + let f14 = c.foo.bind(undefined); // Error +->f14 : (a: number, b: string) => string +->c.foo.bind(undefined) : (a: number, b: string) => string ++>f14 : (...args: [a: number, b: string]) => string ++>c.foo.bind(undefined) : (...args: [a: number, b: string]) => string + >c.foo.bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (this: (this: T, ...args: [...A, ...B]) => R, thisArg: T, ...args: A): (...args: B) => R; } + >c.foo : (this: C, a: number, b: string) => string + >c : C +@@= skipped -163, +163 lines =@@ + >undefined : undefined + + let f21 = C.bind(undefined, 10); +->f21 : new (b: string) => C +->C.bind(undefined, 10) : new (b: string) => C ++>f21 : new (...args: [b: string]) => C ++>C.bind(undefined, 10) : new (...args: [b: string]) => C + >C.bind : { (this: T, thisArg: any): T; (this: new (...args: [...A, ...B]) => R, thisArg: any, ...args: A): new (...args: B) => R; } + >C : typeof C + >bind : { (this: T, thisArg: any): T; (this: new (...args: [...A, ...B]) => R, thisArg: any, ...args: A): new (...args: B) => R; } +@@= skipped -9, +9 lines =@@ + >10 : 10 + + let f22 = C.bind(undefined, 10, "hello"); +->f22 : new () => C +->C.bind(undefined, 10, "hello") : new () => C ++>f22 : new (...args: []) => C ++>C.bind(undefined, 10, "hello") : new (...args: []) => C + >C.bind : { (this: T, thisArg: any): T; (this: new (...args: [...A, ...B]) => R, thisArg: any, ...args: A): new (...args: B) => R; } + >C : typeof C + >bind : { (this: T, thisArg: any): T; (this: new (...args: [...A, ...B]) => R, thisArg: any, ...args: A): new (...args: B) => R; } +@@= skipped -10, +10 lines =@@ + >"hello" : "hello" + + let f23 = C.bind(undefined, 10, 20); // Error +->f23 : new () => C +->C.bind(undefined, 10, 20) : new () => C ++>f23 : new (...args: []) => C ++>C.bind(undefined, 10, 20) : new (...args: []) => C + >C.bind : { (this: T, thisArg: any): T; (this: new (...args: [...A, ...B]) => R, thisArg: any, ...args: A): new (...args: B) => R; } + >C : typeof C + >bind : { (this: T, thisArg: any): T; (this: new (...args: [...A, ...B]) => R, thisArg: any, ...args: A): new (...args: B) => R; } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/strictBindCallApply2.types b/testdata/baselines/reference/submodule/conformance/strictBindCallApply2.types index 2442c452eb..6fde02adfe 100644 --- a/testdata/baselines/reference/submodule/conformance/strictBindCallApply2.types +++ b/testdata/baselines/reference/submodule/conformance/strictBindCallApply2.types @@ -15,8 +15,8 @@ type Test = ThisParameterType; >fn : (this: Foo) => void const fb = fn.bind({ blub: "blub" }); ->fb : () => void ->fn.bind({ blub: "blub" }) : () => void +>fb : (...args: []) => void +>fn.bind({ blub: "blub" }) : (...args: []) => void >fn.bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (this: (this: T, ...args: [...A, ...B]) => R, thisArg: T, ...args: A): (...args: B) => R; } >fn : (this: Foo) => void >bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (this: (this: T, ...args: [...A, ...B]) => R, thisArg: T, ...args: A): (...args: B) => R; } diff --git a/testdata/baselines/reference/submodule/conformance/strictBindCallApply2.types.diff b/testdata/baselines/reference/submodule/conformance/strictBindCallApply2.types.diff new file mode 100644 index 0000000000..ff66c3bf6e --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/strictBindCallApply2.types.diff @@ -0,0 +1,13 @@ +--- old.strictBindCallApply2.types ++++ new.strictBindCallApply2.types +@@= skipped -14, +14 lines =@@ + >fn : (this: Foo) => void + + const fb = fn.bind({ blub: "blub" }); +->fb : () => void +->fn.bind({ blub: "blub" }) : () => void ++>fb : (...args: []) => void ++>fn.bind({ blub: "blub" }) : (...args: []) => void + >fn.bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (this: (this: T, ...args: [...A, ...B]) => R, thisArg: T, ...args: A): (...args: B) => R; } + >fn : (this: Foo) => void + >bind : { (this: T, thisArg: ThisParameterType): OmitThisParameter; (this: (this: T, ...args: [...A, ...B]) => R, thisArg: T, ...args: A): (...args: B) => R; } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/variadicTuples1.js b/testdata/baselines/reference/submodule/conformance/variadicTuples1.js index 27417dce6d..651b020ee2 100644 --- a/testdata/baselines/reference/submodule/conformance/variadicTuples1.js +++ b/testdata/baselines/reference/submodule/conformance/variadicTuples1.js @@ -742,14 +742,14 @@ type R35 = DropLast; type R36 = DropLast; declare function curry(f: (...args: [...T, ...U]) => R, ...a: T): (...b: U) => R; declare const fn1: (a: number, b: string, c: boolean, d: string[]) => number; -declare const c0: (a: number, b: string, c: boolean, d: string[]) => number; -declare const c1: (b: string, c: boolean, d: string[]) => number; -declare const c2: (c: boolean, d: string[]) => number; -declare const c3: (d: string[]) => number; -declare const c4: () => number; +declare const c0: (...b: [a: number, b: string, c: boolean, d: string[]]) => number; +declare const c1: (...b: [b: string, c: boolean, d: string[]]) => number; +declare const c2: (...b: [c: boolean, d: string[]]) => number; +declare const c3: (...b: [d: string[]]) => number; +declare const c4: (...b: []) => number; declare const fn2: (x: number, b: boolean, ...args: string[]) => number; -declare const c10: (x: number, b: boolean, ...args: string[]) => number; -declare const c11: (b: boolean, ...args: string[]) => number; +declare const c10: (...b: [x: number, b: boolean, ...args: string[]]) => number; +declare const c11: (...b: [b: boolean, ...args: string[]]) => number; declare const c12: (...b: string[]) => number; declare const c13: (...b: string[]) => number; declare const fn3: (...args: string[]) => number; @@ -778,7 +778,7 @@ declare function getOrgUser(id: string, orgId: number, options?: { y?: number; z?: boolean; }): void; -declare function callApi(method: (...args: [...T, object]) => U): (...args: T) => U; +declare function callApi(method: (...args: [...T, object]) => U): (...args: [...T]) => U; type Numbers = number[]; type Unbounded = [...Numbers, boolean]; declare const data: Unbounded; diff --git a/testdata/baselines/reference/submodule/conformance/variadicTuples1.js.diff b/testdata/baselines/reference/submodule/conformance/variadicTuples1.js.diff index 99a67cafac..55ac575721 100644 --- a/testdata/baselines/reference/submodule/conformance/variadicTuples1.js.diff +++ b/testdata/baselines/reference/submodule/conformance/variadicTuples1.js.diff @@ -9,12 +9,25 @@ // Variadics in array literals function tup2(t, u) { return [1, ...t, 2, ...u, 3]; -@@= skipped -354, +352 lines =@@ - y?: number; - z?: boolean; - }): void; --declare function callApi(method: (...args: [...T, object]) => U): (...args: [...T]) => U; -+declare function callApi(method: (...args: [...T, object]) => U): (...args: T) => U; - type Numbers = number[]; - type Unbounded = [...Numbers, boolean]; - declare const data: Unbounded; \ No newline at end of file +@@= skipped -318, +316 lines =@@ + type R36 = DropLast; + declare function curry(f: (...args: [...T, ...U]) => R, ...a: T): (...b: U) => R; + declare const fn1: (a: number, b: string, c: boolean, d: string[]) => number; +-declare const c0: (a: number, b: string, c: boolean, d: string[]) => number; +-declare const c1: (b: string, c: boolean, d: string[]) => number; +-declare const c2: (c: boolean, d: string[]) => number; +-declare const c3: (d: string[]) => number; +-declare const c4: () => number; ++declare const c0: (...b: [a: number, b: string, c: boolean, d: string[]]) => number; ++declare const c1: (...b: [b: string, c: boolean, d: string[]]) => number; ++declare const c2: (...b: [c: boolean, d: string[]]) => number; ++declare const c3: (...b: [d: string[]]) => number; ++declare const c4: (...b: []) => number; + declare const fn2: (x: number, b: boolean, ...args: string[]) => number; +-declare const c10: (x: number, b: boolean, ...args: string[]) => number; +-declare const c11: (b: boolean, ...args: string[]) => number; ++declare const c10: (...b: [x: number, b: boolean, ...args: string[]]) => number; ++declare const c11: (...b: [b: boolean, ...args: string[]]) => number; + declare const c12: (...b: string[]) => number; + declare const c13: (...b: string[]) => number; + declare const fn3: (...args: string[]) => number; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/variadicTuples1.types b/testdata/baselines/reference/submodule/conformance/variadicTuples1.types index 2388f2462c..f054160872 100644 --- a/testdata/baselines/reference/submodule/conformance/variadicTuples1.types +++ b/testdata/baselines/reference/submodule/conformance/variadicTuples1.types @@ -1061,29 +1061,29 @@ const fn1 = (a: number, b: string, c: boolean, d: string[]) => 0; >0 : 0 const c0 = curry(fn1); // (a: number, b: string, c: boolean, d: string[]) => number ->c0 : (a: number, b: string, c: boolean, d: string[]) => number ->curry(fn1) : (a: number, b: string, c: boolean, d: string[]) => number +>c0 : (...b: [a: number, b: string, c: boolean, d: string[]]) => number +>curry(fn1) : (...b: [a: number, b: string, c: boolean, d: string[]]) => number >curry : (f: (...args: [...T, ...U]) => R, ...a: T) => (...b: U) => R >fn1 : (a: number, b: string, c: boolean, d: string[]) => number const c1 = curry(fn1, 1); // (b: string, c: boolean, d: string[]) => number ->c1 : (b: string, c: boolean, d: string[]) => number ->curry(fn1, 1) : (b: string, c: boolean, d: string[]) => number +>c1 : (...b: [b: string, c: boolean, d: string[]]) => number +>curry(fn1, 1) : (...b: [b: string, c: boolean, d: string[]]) => number >curry : (f: (...args: [...T, ...U]) => R, ...a: T) => (...b: U) => R >fn1 : (a: number, b: string, c: boolean, d: string[]) => number >1 : 1 const c2 = curry(fn1, 1, 'abc'); // (c: boolean, d: string[]) => number ->c2 : (c: boolean, d: string[]) => number ->curry(fn1, 1, 'abc') : (c: boolean, d: string[]) => number +>c2 : (...b: [c: boolean, d: string[]]) => number +>curry(fn1, 1, 'abc') : (...b: [c: boolean, d: string[]]) => number >curry : (f: (...args: [...T, ...U]) => R, ...a: T) => (...b: U) => R >fn1 : (a: number, b: string, c: boolean, d: string[]) => number >1 : 1 >'abc' : "abc" const c3 = curry(fn1, 1, 'abc', true); // (d: string[]) => number ->c3 : (d: string[]) => number ->curry(fn1, 1, 'abc', true) : (d: string[]) => number +>c3 : (...b: [d: string[]]) => number +>curry(fn1, 1, 'abc', true) : (...b: [d: string[]]) => number >curry : (f: (...args: [...T, ...U]) => R, ...a: T) => (...b: U) => R >fn1 : (a: number, b: string, c: boolean, d: string[]) => number >1 : 1 @@ -1091,8 +1091,8 @@ const c3 = curry(fn1, 1, 'abc', true); // (d: string[]) => number >true : true const c4 = curry(fn1, 1, 'abc', true, ['x', 'y']); // () => number ->c4 : () => number ->curry(fn1, 1, 'abc', true, ['x', 'y']) : () => number +>c4 : (...b: []) => number +>curry(fn1, 1, 'abc', true, ['x', 'y']) : (...b: []) => number >curry : (f: (...args: [...T, ...U]) => R, ...a: T) => (...b: U) => R >fn1 : (a: number, b: string, c: boolean, d: string[]) => number >1 : 1 @@ -1111,14 +1111,14 @@ const fn2 = (x: number, b: boolean, ...args: string[]) => 0; >0 : 0 const c10 = curry(fn2); // (x: number, b: boolean, ...args: string[]) => number ->c10 : (x: number, b: boolean, ...args: string[]) => number ->curry(fn2) : (x: number, b: boolean, ...args: string[]) => number +>c10 : (...b: [x: number, b: boolean, ...args: string[]]) => number +>curry(fn2) : (...b: [x: number, b: boolean, ...args: string[]]) => number >curry : (f: (...args: [...T, ...U]) => R, ...a: T) => (...b: U) => R >fn2 : (x: number, b: boolean, ...args: string[]) => number const c11 = curry(fn2, 1); // (b: boolean, ...args: string[]) => number ->c11 : (b: boolean, ...args: string[]) => number ->curry(fn2, 1) : (b: boolean, ...args: string[]) => number +>c11 : (...b: [b: boolean, ...args: string[]]) => number +>curry(fn2, 1) : (...b: [b: boolean, ...args: string[]]) => number >curry : (f: (...args: [...T, ...U]) => R, ...a: T) => (...b: U) => R >fn2 : (x: number, b: boolean, ...args: string[]) => number >1 : 1 @@ -1400,12 +1400,12 @@ declare function getOrgUser(id: string, orgId: number, options?: { y?: number, z >z : boolean | undefined function callApi(method: (...args: [...T, object]) => U) { ->callApi : (method: (...args: [...T, object]) => U) => (...args: T) => U +>callApi : (method: (...args: [...T, object]) => U) => (...args: [...T]) => U >method : (...args: [...T, object]) => U >args : [...T, object] return (...args: [...T]) => method(...args, {}); ->(...args: [...T]) => method(...args, {}) : (...args: T) => U +>(...args: [...T]) => method(...args, {}) : (...args: [...T]) => U >args : [...T] >method(...args, {}) : U >method : (...args: [...T, object]) => U @@ -1415,13 +1415,13 @@ function callApi(method: (...args: [...T, ob } callApi(getUser); ->callApi(getUser) : (id: string) => string ->callApi : (method: (...args: [...T, object]) => U) => (...args: T) => U +>callApi(getUser) : (...args: [id: string]) => string +>callApi : (method: (...args: [...T, object]) => U) => (...args: [...T]) => U >getUser : (id: string, options?: { x?: string | undefined; } | undefined) => string callApi(getOrgUser); ->callApi(getOrgUser) : (id: string, orgId: number) => void ->callApi : (method: (...args: [...T, object]) => U) => (...args: T) => U +>callApi(getOrgUser) : (...args: [id: string, orgId: number]) => void +>callApi : (method: (...args: [...T, object]) => U) => (...args: [...T]) => U >getOrgUser : (id: string, orgId: number, options?: { y?: number | undefined; z?: boolean | undefined; } | undefined) => void // Repro from #40235 diff --git a/testdata/baselines/reference/submodule/conformance/variadicTuples1.types.diff b/testdata/baselines/reference/submodule/conformance/variadicTuples1.types.diff index 356240df29..97665de738 100644 --- a/testdata/baselines/reference/submodule/conformance/variadicTuples1.types.diff +++ b/testdata/baselines/reference/submodule/conformance/variadicTuples1.types.diff @@ -16,7 +16,75 @@ >[['abc'], [42], [true], ['def']] : [string[], number[], true[], string[]] >['abc'] : string[] >'abc' : "abc" -@@= skipped -794, +794 lines =@@ +@@= skipped -639, +639 lines =@@ + >0 : 0 + + const c0 = curry(fn1); // (a: number, b: string, c: boolean, d: string[]) => number +->c0 : (a: number, b: string, c: boolean, d: string[]) => number +->curry(fn1) : (a: number, b: string, c: boolean, d: string[]) => number ++>c0 : (...b: [a: number, b: string, c: boolean, d: string[]]) => number ++>curry(fn1) : (...b: [a: number, b: string, c: boolean, d: string[]]) => number + >curry : (f: (...args: [...T, ...U]) => R, ...a: T) => (...b: U) => R + >fn1 : (a: number, b: string, c: boolean, d: string[]) => number + + const c1 = curry(fn1, 1); // (b: string, c: boolean, d: string[]) => number +->c1 : (b: string, c: boolean, d: string[]) => number +->curry(fn1, 1) : (b: string, c: boolean, d: string[]) => number ++>c1 : (...b: [b: string, c: boolean, d: string[]]) => number ++>curry(fn1, 1) : (...b: [b: string, c: boolean, d: string[]]) => number + >curry : (f: (...args: [...T, ...U]) => R, ...a: T) => (...b: U) => R + >fn1 : (a: number, b: string, c: boolean, d: string[]) => number + >1 : 1 + + const c2 = curry(fn1, 1, 'abc'); // (c: boolean, d: string[]) => number +->c2 : (c: boolean, d: string[]) => number +->curry(fn1, 1, 'abc') : (c: boolean, d: string[]) => number ++>c2 : (...b: [c: boolean, d: string[]]) => number ++>curry(fn1, 1, 'abc') : (...b: [c: boolean, d: string[]]) => number + >curry : (f: (...args: [...T, ...U]) => R, ...a: T) => (...b: U) => R + >fn1 : (a: number, b: string, c: boolean, d: string[]) => number + >1 : 1 + >'abc' : "abc" + + const c3 = curry(fn1, 1, 'abc', true); // (d: string[]) => number +->c3 : (d: string[]) => number +->curry(fn1, 1, 'abc', true) : (d: string[]) => number ++>c3 : (...b: [d: string[]]) => number ++>curry(fn1, 1, 'abc', true) : (...b: [d: string[]]) => number + >curry : (f: (...args: [...T, ...U]) => R, ...a: T) => (...b: U) => R + >fn1 : (a: number, b: string, c: boolean, d: string[]) => number + >1 : 1 +@@= skipped -30, +30 lines =@@ + >true : true + + const c4 = curry(fn1, 1, 'abc', true, ['x', 'y']); // () => number +->c4 : () => number +->curry(fn1, 1, 'abc', true, ['x', 'y']) : () => number ++>c4 : (...b: []) => number ++>curry(fn1, 1, 'abc', true, ['x', 'y']) : (...b: []) => number + >curry : (f: (...args: [...T, ...U]) => R, ...a: T) => (...b: U) => R + >fn1 : (a: number, b: string, c: boolean, d: string[]) => number + >1 : 1 +@@= skipped -20, +20 lines =@@ + >0 : 0 + + const c10 = curry(fn2); // (x: number, b: boolean, ...args: string[]) => number +->c10 : (x: number, b: boolean, ...args: string[]) => number +->curry(fn2) : (x: number, b: boolean, ...args: string[]) => number ++>c10 : (...b: [x: number, b: boolean, ...args: string[]]) => number ++>curry(fn2) : (...b: [x: number, b: boolean, ...args: string[]]) => number + >curry : (f: (...args: [...T, ...U]) => R, ...a: T) => (...b: U) => R + >fn2 : (x: number, b: boolean, ...args: string[]) => number + + const c11 = curry(fn2, 1); // (b: boolean, ...args: string[]) => number +->c11 : (b: boolean, ...args: string[]) => number +->curry(fn2, 1) : (b: boolean, ...args: string[]) => number ++>c11 : (...b: [b: boolean, ...args: string[]]) => number ++>curry(fn2, 1) : (...b: [b: boolean, ...args: string[]]) => number + >curry : (f: (...args: [...T, ...U]) => R, ...a: T) => (...b: U) => R + >fn2 : (x: number, b: boolean, ...args: string[]) => number + >1 : 1 +@@= skipped -105, +105 lines =@@ // Inference to [...T] has higher priority than inference to [...T, number?] declare function ft(t1: [...T], t2: [...T, number?]): T; @@ -139,26 +207,30 @@ >y : number | undefined >z : boolean | undefined - function callApi(method: (...args: [...T, object]) => U) { -->callApi : (method: (...args: [...T, object]) => U) => (...args: [...T]) => U -+>callApi : (method: (...args: [...T, object]) => U) => (...args: T) => U - >method : (...args: [...T, object]) => U +@@= skipped -19, +19 lines =@@ >args : [...T, object] -@@= skipped -30, +30 lines =@@ + return (...args: [...T]) => method(...args, {}); +->(...args: [...T]) => method(...args, {}) : (...args: T) => U ++>(...args: [...T]) => method(...args, {}) : (...args: [...T]) => U + >args : [...T] + >method(...args, {}) : U + >method : (...args: [...T, object]) => U +@@= skipped -10, +10 lines =@@ + } callApi(getUser); - >callApi(getUser) : (id: string) => string -->callApi : (method: (...args: [...T, object]) => U) => (...args: [...T]) => U +->callApi(getUser) : (id: string) => string ++>callApi(getUser) : (...args: [id: string]) => string + >callApi : (method: (...args: [...T, object]) => U) => (...args: [...T]) => U ->getUser : (id: string, options?: { x?: string; }) => string -+>callApi : (method: (...args: [...T, object]) => U) => (...args: T) => U +>getUser : (id: string, options?: { x?: string | undefined; } | undefined) => string callApi(getOrgUser); - >callApi(getOrgUser) : (id: string, orgId: number) => void -->callApi : (method: (...args: [...T, object]) => U) => (...args: [...T]) => U +->callApi(getOrgUser) : (id: string, orgId: number) => void ++>callApi(getOrgUser) : (...args: [id: string, orgId: number]) => void + >callApi : (method: (...args: [...T, object]) => U) => (...args: [...T]) => U ->getOrgUser : (id: string, orgId: number, options?: { y?: number; z?: boolean; }) => void -+>callApi : (method: (...args: [...T, object]) => U) => (...args: T) => U +>getOrgUser : (id: string, orgId: number, options?: { y?: number | undefined; z?: boolean | undefined; } | undefined) => void // Repro from #40235 diff --git a/testdata/baselines/reference/submodule/conformance/variadicTuples2.types b/testdata/baselines/reference/submodule/conformance/variadicTuples2.types index 5187373d73..675e43ca69 100644 --- a/testdata/baselines/reference/submodule/conformance/variadicTuples2.types +++ b/testdata/baselines/reference/submodule/conformance/variadicTuples2.types @@ -385,7 +385,7 @@ pipe("foo", 123, true, (...x) => { >"foo" : "foo" >123 : 123 >true : true ->(...x) => { x; // [string, number, boolean]} : (x_0: string, x_1: number, x_2: boolean) => void +>(...x) => { x; // [string, number, boolean]} : (...x: [string, number, boolean]) => void >x : [string, number, boolean] x; // [string, number, boolean] diff --git a/testdata/baselines/reference/submodule/conformance/variadicTuples2.types.diff b/testdata/baselines/reference/submodule/conformance/variadicTuples2.types.diff index 2e00ce1f94..48ae7b4f0c 100644 --- a/testdata/baselines/reference/submodule/conformance/variadicTuples2.types.diff +++ b/testdata/baselines/reference/submodule/conformance/variadicTuples2.types.diff @@ -11,4 +11,13 @@ +>slice : (start?: number | undefined, end?: number | undefined) => (((...values: T) => void) | T[number])[] >0 : 0 >-1 : -1 - >1 : 1 \ No newline at end of file + >1 : 1 +@@= skipped -42, +42 lines =@@ + >"foo" : "foo" + >123 : 123 + >true : true +->(...x) => { x; // [string, number, boolean]} : (x_0: string, x_1: number, x_2: boolean) => void ++>(...x) => { x; // [string, number, boolean]} : (...x: [string, number, boolean]) => void + >x : [string, number, boolean] + + x; // [string, number, boolean] \ No newline at end of file