From 4130deadb7b41f164d07a7bbdc91977b7a108462 Mon Sep 17 00:00:00 2001 From: craigphicks <13205732+craigphicks@users.noreply.github.com> Date: Sat, 4 Nov 2023 05:54:41 +0000 Subject: [PATCH] new and old tests, all results with old code --- src/compiler/checker.ts | 79 +-- src/lib/es5.d.ts | 12 - tests/baselines/reference/arrayFilter.symbols | 4 +- tests/baselines/reference/arrayFilter.types | 4 +- ...rload#56013WithoutExternalOverload.symbols | 16 +- ...verload#56013WithoutExternalOverload.types | 20 +- .../reference/arrayFilterBooleanOverload.js | 4 +- .../arrayFilterBooleanOverload.symbols | 12 +- .../arrayFilterBooleanOverload.types | 20 +- .../reference/arrayMapPredicates1.errors.txt | 114 ++++ .../reference/arrayMapPredicates1.js | 93 ++++ .../reference/arrayMapPredicates1.symbols | 187 +++++++ .../reference/arrayMapPredicates1.types | 185 +++++++ .../reference/bestChoiceType.symbols | 6 - .../baselines/reference/bestChoiceType.types | 46 +- .../reference/booleanFilterAnyArray.symbols | 12 +- .../reference/booleanFilterAnyArray.types | 12 +- .../completionEntryForUnionMethod.baseline | 514 +++++++++++++----- ...xtuallyTypeAsyncFunctionReturnType.symbols | 4 +- ...textuallyTypeAsyncFunctionReturnType.types | 4 +- .../controlFlowArrayErrors.errors.txt | 5 +- .../reference/declarationEmitPromise.symbols | 8 +- .../reference/declarationEmitPromise.types | 8 +- .../reference/genericContextualTypes1.symbols | 4 +- .../reference/genericContextualTypes1.types | 4 +- .../genericMethodOverspecialization.symbols | 4 +- .../genericMethodOverspecialization.types | 4 +- ...oToTypeDefinition_arrayType.baseline.jsonc | 12 - .../implementArrayInterface.errors.txt | 45 -- .../reference/mappedTypeAsClauses.types | 4 +- ...ithAsClauseAndLateBoundProperty.errors.txt | 4 +- ...TypeWithAsClauseAndLateBoundProperty.types | 6 +- ...edTypeWithAsClauseAndLateBoundProperty2.js | 2 - ...ypeWithAsClauseAndLateBoundProperty2.types | 6 +- .../nonInferrableTypePropagation3.symbols | 4 +- .../nonInferrableTypePropagation3.types | 4 +- ...objectInstantiationFromUnionSpread.symbols | 8 +- .../objectInstantiationFromUnionSpread.types | 8 +- .../restElementWithNumberPropertyName.types | 2 +- .../reference/restInvalidArgumentType.types | 2 +- .../restParameterWithBindingPattern3.types | 2 +- .../restPropertyWithBindingPattern.types | 4 +- ...natureHelpJSMissingPropertyAccess.baseline | 267 --------- .../reference/spreadInvalidArgumentType.types | 4 +- .../reference/typeFromJSInitializer.symbols | 4 +- .../reference/typeFromJSInitializer.types | 4 +- .../typeInferenceTypePredicate2.symbols | 4 +- .../typeInferenceTypePredicate2.types | 4 +- .../typePredicateFreshLiteralWidening.symbols | 8 +- .../typePredicateFreshLiteralWidening.types | 8 +- ...typePredicateTopLevelTypeParameter.symbols | 4 +- .../typePredicateTopLevelTypeParameter.types | 4 +- .../unionOfArraysBooleanFilterCall.symbols | 24 +- .../unionOfArraysBooleanFilterCall.types | 32 +- .../reference/unionOfArraysFilterCall.symbols | 12 +- .../reference/unionOfArraysFilterCall.types | 38 +- .../unknownSymbolOffContextualType1.symbols | 4 +- .../unknownSymbolOffContextualType1.types | 4 +- 58 files changed, 1172 insertions(+), 751 deletions(-) create mode 100644 tests/baselines/reference/arrayMapPredicates1.errors.txt create mode 100644 tests/baselines/reference/arrayMapPredicates1.js create mode 100644 tests/baselines/reference/arrayMapPredicates1.symbols create mode 100644 tests/baselines/reference/arrayMapPredicates1.types delete mode 100644 tests/baselines/reference/implementArrayInterface.errors.txt diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 19448727f37ab..3ac1038a4cdbe 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -14748,70 +14748,21 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { * Return the signatures of the given kind in the given type. Creates synthetic union signatures when necessary and * maps primitive types and type parameters are to their apparent types. */ - function getSignaturesOfType(typeIn: Type, kind: SignatureKind): readonly Signature[] { - const reducedType = getReducedApparentType(typeIn); - function carveoutResult(): readonly Signature[] | undefined { - if (kind === SignatureKind.Call && reducedType.flags & TypeFlags.Union) { - // If the union is all different instantiations of a member of the global array type... - let memberName: __String; - if (everyType(reducedType, t => !!t.symbol?.parent && isArrayOrTupleSymbol(t.symbol.parent) && (!memberName ? (memberName = t.symbol.escapedName, true) : memberName === t.symbol.escapedName))) { - if ((reducedType as UnionType).arrayFallbackSignatures) { - return (reducedType as UnionType).arrayFallbackSignatures!; - } - - // calculate return types as union of return types over the associated type, rather than return type associated with the union of types - const numTypes = (reducedType as UnionType).types.length; - const numSigs = (reducedType as UnionType).types[0].symbol.declarations?.length; - Debug.assert(numSigs); - const returnTypes = (new Array(numSigs).fill(/*value*/ undefined)).map((_, isig): Type | undefined => { - // getUnionType(*,UnionReduction.Subtype) doesn't detect duplicate types (unless I'm mistaken) so use set first. - const rtset = new Set(); - new Array(numTypes).fill(/*value*/ undefined).forEach((_, itype) => { - // Notice we potentially generate the whole signature to get the return type. - // Maybe that could be avoided? - const callSignatures = ((reducedType as UnionType).types[itype] as ObjectType).callSignatures - ?? getSignaturesOfStructuredType((reducedType as UnionType).types[itype] as ObjectType, SignatureKind.Call); - if (callSignatures[isig].typeParameters) return; // skip generic signatures, i.e. - const returnType = callSignatures[isig].resolvedReturnType - ?? getReturnTypeOfSignature(callSignatures[isig]); - Debug.assert(returnType); - rtset.add(returnType); - }); - const art: Type[] = []; - rtset.forEach(rt => art.push(rt)); - if (art.length === 0) return undefined; - if (art.length === 1) return art[0]; - return getUnionType(art, UnionReduction.Subtype); - }); - - // Transform the type from `(A[] | B[])["member"]` to `(A | B)[]["member"]` (since we pretend array is covariant anyway) - const arrayArg = mapType(reducedType, t => getMappedType((isReadonlyArraySymbol(t.symbol.parent) ? globalReadonlyArrayType : globalArrayType).typeParameters![0], (t as AnonymousType).mapper!)); - const arrayType = createArrayType(arrayArg, someType(reducedType, t => isReadonlyArraySymbol(t.symbol.parent))); - const result = getSignaturesOfType(getTypeOfPropertyOfType(arrayType, memberName!)!, kind); - - returnTypes.forEach((returnType, sigidx) => { - if (returnType) result[sigidx].resolvedReturnType = returnTypes[sigidx]; - }); - return (reducedType as UnionType).arrayFallbackSignatures = result; - - // const arrayArg = mapType(type, t => getMappedType((isReadonlyArraySymbol(t.symbol.parent) ? globalReadonlyArrayType : globalArrayType).typeParameters![0], (t as AnonymousType).mapper!)); - // const arrayType = createArrayType(arrayArg, someType(type, t => isReadonlyArraySymbol(t.symbol.parent))); - // return (type as UnionType).arrayFallbackSignatures = getSignaturesOfType(getTypeOfPropertyOfType(arrayType, memberName!)!, kind); - } - } - return undefined; - } - let result = carveoutResult(); - if (result) return result; - - if (kind === SignatureKind.Call && reducedType.flags & TypeFlags.Union) { - if ((reducedType as UnionType).arrayFallbackSignatures) { - return (reducedType as UnionType).arrayFallbackSignatures!; - } - } - result = getSignaturesOfStructuredType(reducedType, kind); - if (kind === SignatureKind.Call && reducedType.flags & TypeFlags.Union) { - (reducedType as UnionType).arrayFallbackSignatures = result; + function getSignaturesOfType(type: Type, kind: SignatureKind): readonly Signature[] { + const result = getSignaturesOfStructuredType(getReducedApparentType(type), kind); + if (kind === SignatureKind.Call && !length(result) && type.flags & TypeFlags.Union) { + if ((type as UnionType).arrayFallbackSignatures) { + return (type as UnionType).arrayFallbackSignatures!; + } + // If the union is all different instantiations of a member of the global array type... + let memberName: __String; + if (everyType(type, t => !!t.symbol?.parent && isArrayOrTupleSymbol(t.symbol.parent) && (!memberName ? (memberName = t.symbol.escapedName, true) : memberName === t.symbol.escapedName))) { + // Transform the type from `(A[] | B[])["member"]` to `(A | B)[]["member"]` (since we pretend array is covariant anyway) + const arrayArg = mapType(type, t => getMappedType((isReadonlyArraySymbol(t.symbol.parent) ? globalReadonlyArrayType : globalArrayType).typeParameters![0], (t as AnonymousType).mapper!)); + const arrayType = createArrayType(arrayArg, someType(type, t => isReadonlyArraySymbol(t.symbol.parent))); + return (type as UnionType).arrayFallbackSignatures = getSignaturesOfType(getTypeOfPropertyOfType(arrayType, memberName!)!, kind); + } + (type as UnionType).arrayFallbackSignatures = result; } return result; } diff --git a/src/lib/es5.d.ts b/src/lib/es5.d.ts index cde1b3cb809da..8065e2d3de83c 100644 --- a/src/lib/es5.d.ts +++ b/src/lib/es5.d.ts @@ -1257,12 +1257,6 @@ interface ReadonlyArray { * @param thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value. */ filter(predicate: (value: T, index: number, array: readonly T[]) => value is S, thisArg?: any): S[]; - /** - * Returns the non-Falsy elements of an array - * @param predicate Must be exactly "Boolean" - * @param thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value. - */ - filter(predicate: BooleanConstructor, thisArg?: any): (T extends false | 0 | "" | null | undefined | 0n ? never : T)[]; /** * Returns the elements of an array that meet the condition specified in a callback function. * @param predicate A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array. @@ -1454,12 +1448,6 @@ interface Array { * @param thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value. */ filter(predicate: (value: T, index: number, array: T[]) => value is S, thisArg?: any): S[]; - /** - * Returns the non-Falsy elements of an array - * @param predicate Must be exactly "Boolean" - * @param thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value. - */ - filter(predicate: BooleanConstructor, thisArg?: any): (T extends false | 0 | "" | null | undefined | 0n ? never : T)[]; /** * Returns the elements of an array that meet the condition specified in a callback function. * @param predicate A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array. diff --git a/tests/baselines/reference/arrayFilter.symbols b/tests/baselines/reference/arrayFilter.symbols index 54f648f5ff77f..448246fd2b8bf 100644 --- a/tests/baselines/reference/arrayFilter.symbols +++ b/tests/baselines/reference/arrayFilter.symbols @@ -16,9 +16,9 @@ var foo = [ ] foo.filter(x => x.name); //should accepted all possible types not only boolean! ->foo.filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>foo.filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >foo : Symbol(foo, Decl(arrayFilter.ts, 0, 3)) ->filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >x : Symbol(x, Decl(arrayFilter.ts, 6, 11)) >x.name : Symbol(name, Decl(arrayFilter.ts, 1, 5)) >x : Symbol(x, Decl(arrayFilter.ts, 6, 11)) diff --git a/tests/baselines/reference/arrayFilter.types b/tests/baselines/reference/arrayFilter.types index e7352e94ad8f8..fd0cc58780ae0 100644 --- a/tests/baselines/reference/arrayFilter.types +++ b/tests/baselines/reference/arrayFilter.types @@ -23,9 +23,9 @@ var foo = [ foo.filter(x => x.name); //should accepted all possible types not only boolean! >foo.filter(x => x.name) : { name: string; }[] ->foo.filter : { (predicate: (value: { name: string; }, index: number, array: { name: string; }[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): { name: string; }[]; (predicate: (value: { name: string; }, index: number, array: { name: string; }[]) => unknown, thisArg?: any): { name: string; }[]; } +>foo.filter : { (predicate: (value: { name: string; }, index: number, array: { name: string; }[]) => value is S, thisArg?: any): S[]; (predicate: (value: { name: string; }, index: number, array: { name: string; }[]) => unknown, thisArg?: any): { name: string; }[]; } >foo : { name: string; }[] ->filter : { (predicate: (value: { name: string; }, index: number, array: { name: string; }[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): { name: string; }[]; (predicate: (value: { name: string; }, index: number, array: { name: string; }[]) => unknown, thisArg?: any): { name: string; }[]; } +>filter : { (predicate: (value: { name: string; }, index: number, array: { name: string; }[]) => value is S, thisArg?: any): S[]; (predicate: (value: { name: string; }, index: number, array: { name: string; }[]) => unknown, thisArg?: any): { name: string; }[]; } >x => x.name : (x: { name: string; }) => string >x : { name: string; } >x.name : string diff --git a/tests/baselines/reference/arrayFilterBooleanOverload#56013WithoutExternalOverload.symbols b/tests/baselines/reference/arrayFilterBooleanOverload#56013WithoutExternalOverload.symbols index 50311f02a62cf..9be8948391ac2 100644 --- a/tests/baselines/reference/arrayFilterBooleanOverload#56013WithoutExternalOverload.symbols +++ b/tests/baselines/reference/arrayFilterBooleanOverload#56013WithoutExternalOverload.symbols @@ -18,27 +18,27 @@ const id = () => (t: T) => !!t; >t : Symbol(t, Decl(arrayFilterBooleanOverload#56013WithoutExternalOverload.ts, 4, 22)) ['foo', 'bar'].filter(id()); // // expect id() = (t: string) => boolean ->['foo', 'bar'].filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>['foo', 'bar'].filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >id : Symbol(id, Decl(arrayFilterBooleanOverload#56013WithoutExternalOverload.ts, 4, 5)) ['foo', 'bar', 1].filter(id()); // // expect id() = (t: string | number) => boolean ->['foo', 'bar', 1].filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>['foo', 'bar', 1].filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >id : Symbol(id, Decl(arrayFilterBooleanOverload#56013WithoutExternalOverload.ts, 4, 5)) declare const maybe: boolean; >maybe : Symbol(maybe, Decl(arrayFilterBooleanOverload#56013WithoutExternalOverload.ts, 10, 13)) (maybe ? ['foo', 'bar'] : [1] ).filter(id()); // expect id() = (t: string | number) => boolean ->(maybe ? ['foo', 'bar'] : [1] ).filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) +>(maybe ? ['foo', 'bar'] : [1] ).filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >maybe : Symbol(maybe, Decl(arrayFilterBooleanOverload#56013WithoutExternalOverload.ts, 10, 13)) ->filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) +>filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >id : Symbol(id, Decl(arrayFilterBooleanOverload#56013WithoutExternalOverload.ts, 4, 5)) ['foo', 'bar', undefined].filter(id()); // expect id() = (t: string | undefined) => boolean ->['foo', 'bar', undefined].filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>['foo', 'bar', undefined].filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >undefined : Symbol(undefined) ->filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >id : Symbol(id, Decl(arrayFilterBooleanOverload#56013WithoutExternalOverload.ts, 4, 5)) diff --git a/tests/baselines/reference/arrayFilterBooleanOverload#56013WithoutExternalOverload.types b/tests/baselines/reference/arrayFilterBooleanOverload#56013WithoutExternalOverload.types index 94b601ebe1166..5d3f8546a4d11 100644 --- a/tests/baselines/reference/arrayFilterBooleanOverload#56013WithoutExternalOverload.types +++ b/tests/baselines/reference/arrayFilterBooleanOverload#56013WithoutExternalOverload.types @@ -19,22 +19,22 @@ const id = () => (t: T) => !!t; ['foo', 'bar'].filter(id()); // // expect id() = (t: string) => boolean >['foo', 'bar'].filter(id()) : string[] ->['foo', 'bar'].filter : { (predicate: (value: string, index: number, array: string[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): string[]; (predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): string[]; } +>['foo', 'bar'].filter : { (predicate: (value: string, index: number, array: string[]) => value is S, thisArg?: any): S[]; (predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): string[]; } >['foo', 'bar'] : string[] >'foo' : "foo" >'bar' : "bar" ->filter : { (predicate: (value: string, index: number, array: string[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): string[]; (predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): string[]; } +>filter : { (predicate: (value: string, index: number, array: string[]) => value is S, thisArg?: any): S[]; (predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): string[]; } >id() : (t: string) => boolean >id : () => (t: T) => boolean ['foo', 'bar', 1].filter(id()); // // expect id() = (t: string | number) => boolean ->['foo', 'bar', 1].filter(id()) : string[] | number[] ->['foo', 'bar', 1].filter : { (predicate: (value: string | number, index: number, array: (string | number)[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): string[] | number[]; (predicate: (value: string | number, index: number, array: (string | number)[]) => unknown, thisArg?: any): string[] | number[]; } +>['foo', 'bar', 1].filter(id()) : (string | number)[] +>['foo', 'bar', 1].filter : { (predicate: (value: string | number, index: number, array: (string | number)[]) => value is S, thisArg?: any): S[]; (predicate: (value: string | number, index: number, array: (string | number)[]) => unknown, thisArg?: any): (string | number)[]; } >['foo', 'bar', 1] : (string | number)[] >'foo' : "foo" >'bar' : "bar" >1 : 1 ->filter : { (predicate: (value: string | number, index: number, array: (string | number)[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): string[] | number[]; (predicate: (value: string | number, index: number, array: (string | number)[]) => unknown, thisArg?: any): string[] | number[]; } +>filter : { (predicate: (value: string | number, index: number, array: (string | number)[]) => value is S, thisArg?: any): S[]; (predicate: (value: string | number, index: number, array: (string | number)[]) => unknown, thisArg?: any): (string | number)[]; } >id() : (t: string | number) => boolean >id : () => (t: T) => boolean @@ -42,8 +42,8 @@ declare const maybe: boolean; >maybe : boolean (maybe ? ['foo', 'bar'] : [1] ).filter(id()); // expect id() = (t: string | number) => boolean ->(maybe ? ['foo', 'bar'] : [1] ).filter(id()) : string[] | number[] ->(maybe ? ['foo', 'bar'] : [1] ).filter : { (predicate: (value: string, index: number, array: string[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): string[]; (predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): string[]; } | { (predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): number[]; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): number[]; } +>(maybe ? ['foo', 'bar'] : [1] ).filter(id()) : (string | number)[] +>(maybe ? ['foo', 'bar'] : [1] ).filter : { (predicate: (value: string, index: number, array: string[]) => value is S, thisArg?: any): S[]; (predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): string[]; } | { (predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): S[]; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): number[]; } >(maybe ? ['foo', 'bar'] : [1] ) : string[] | number[] >maybe ? ['foo', 'bar'] : [1] : string[] | number[] >maybe : boolean @@ -52,18 +52,18 @@ declare const maybe: boolean; >'bar' : "bar" >[1] : number[] >1 : 1 ->filter : { (predicate: (value: string, index: number, array: string[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): string[]; (predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): string[]; } | { (predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): number[]; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): number[]; } +>filter : { (predicate: (value: string, index: number, array: string[]) => value is S, thisArg?: any): S[]; (predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): string[]; } | { (predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): S[]; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): number[]; } >id() : (t: string | number) => boolean >id : () => (t: T) => boolean ['foo', 'bar', undefined].filter(id()); // expect id() = (t: string | undefined) => boolean >['foo', 'bar', undefined].filter(id()) : (string | undefined)[] ->['foo', 'bar', undefined].filter : { (predicate: (value: string | undefined, index: number, array: (string | undefined)[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): string[]; (predicate: (value: string | undefined, index: number, array: (string | undefined)[]) => unknown, thisArg?: any): (string | undefined)[]; } +>['foo', 'bar', undefined].filter : { (predicate: (value: string | undefined, index: number, array: (string | undefined)[]) => value is S, thisArg?: any): S[]; (predicate: (value: string | undefined, index: number, array: (string | undefined)[]) => unknown, thisArg?: any): (string | undefined)[]; } >['foo', 'bar', undefined] : (string | undefined)[] >'foo' : "foo" >'bar' : "bar" >undefined : undefined ->filter : { (predicate: (value: string | undefined, index: number, array: (string | undefined)[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): string[]; (predicate: (value: string | undefined, index: number, array: (string | undefined)[]) => unknown, thisArg?: any): (string | undefined)[]; } +>filter : { (predicate: (value: string | undefined, index: number, array: (string | undefined)[]) => value is S, thisArg?: any): S[]; (predicate: (value: string | undefined, index: number, array: (string | undefined)[]) => unknown, thisArg?: any): (string | undefined)[]; } >id() : (t: string | undefined) => boolean >id : () => (t: T) => boolean diff --git a/tests/baselines/reference/arrayFilterBooleanOverload.js b/tests/baselines/reference/arrayFilterBooleanOverload.js index ace5769bd8c9b..ab2385ba9963d 100644 --- a/tests/baselines/reference/arrayFilterBooleanOverload.js +++ b/tests/baselines/reference/arrayFilterBooleanOverload.js @@ -26,7 +26,7 @@ const arr2 = arr.filter(Boolean); // expect ("foo" | 1)[] //// [arrayFilterBooleanOverload.d.ts] declare const nullableValues: (string | null)[]; -declare const values1: string[]; +declare const values1: (string | null)[]; declare const values2: (string | null)[]; declare const arr: readonly [0, 1, "", "foo", null]; -declare const arr2: (1 | "foo")[]; +declare const arr2: ("" | 0 | 1 | "foo" | null)[]; diff --git a/tests/baselines/reference/arrayFilterBooleanOverload.symbols b/tests/baselines/reference/arrayFilterBooleanOverload.symbols index 0413ac47d10f0..611ed5a8a7b94 100644 --- a/tests/baselines/reference/arrayFilterBooleanOverload.symbols +++ b/tests/baselines/reference/arrayFilterBooleanOverload.symbols @@ -6,17 +6,17 @@ const nullableValues = ['a', 'b', null]; // expect (string | null)[] const values1 = nullableValues.filter(Boolean); // expect string[] >values1 : Symbol(values1, Decl(arrayFilterBooleanOverload.ts, 2, 5)) ->nullableValues.filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>nullableValues.filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >nullableValues : Symbol(nullableValues, Decl(arrayFilterBooleanOverload.ts, 0, 5)) ->filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >Boolean : Symbol(Boolean, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) // @ts-expect-error const values2 = nullableValues.filter(new Boolean); >values2 : Symbol(values2, Decl(arrayFilterBooleanOverload.ts, 5, 5)) ->nullableValues.filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>nullableValues.filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >nullableValues : Symbol(nullableValues, Decl(arrayFilterBooleanOverload.ts, 0, 5)) ->filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >Boolean : Symbol(Boolean, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) const arr = [0, 1, "", "foo", null] as const; @@ -25,9 +25,9 @@ const arr = [0, 1, "", "foo", null] as const; const arr2 = arr.filter(Boolean); // expect ("foo" | 1)[] >arr2 : Symbol(arr2, Decl(arrayFilterBooleanOverload.ts, 9, 5)) ->arr.filter : Symbol(ReadonlyArray.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>arr.filter : Symbol(ReadonlyArray.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >arr : Symbol(arr, Decl(arrayFilterBooleanOverload.ts, 7, 5)) ->filter : Symbol(ReadonlyArray.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>filter : Symbol(ReadonlyArray.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >Boolean : Symbol(Boolean, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) diff --git a/tests/baselines/reference/arrayFilterBooleanOverload.types b/tests/baselines/reference/arrayFilterBooleanOverload.types index a939497b312dc..57768d1f5fd7a 100644 --- a/tests/baselines/reference/arrayFilterBooleanOverload.types +++ b/tests/baselines/reference/arrayFilterBooleanOverload.types @@ -8,20 +8,20 @@ const nullableValues = ['a', 'b', null]; // expect (string | null)[] >'b' : "b" const values1 = nullableValues.filter(Boolean); // expect string[] ->values1 : string[] ->nullableValues.filter(Boolean) : string[] ->nullableValues.filter : { (predicate: (value: string | null, index: number, array: (string | null)[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): string[]; (predicate: (value: string | null, index: number, array: (string | null)[]) => unknown, thisArg?: any): (string | null)[]; } +>values1 : (string | null)[] +>nullableValues.filter(Boolean) : (string | null)[] +>nullableValues.filter : { (predicate: (value: string | null, index: number, array: (string | null)[]) => value is S, thisArg?: any): S[]; (predicate: (value: string | null, index: number, array: (string | null)[]) => unknown, thisArg?: any): (string | null)[]; } >nullableValues : (string | null)[] ->filter : { (predicate: (value: string | null, index: number, array: (string | null)[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): string[]; (predicate: (value: string | null, index: number, array: (string | null)[]) => unknown, thisArg?: any): (string | null)[]; } +>filter : { (predicate: (value: string | null, index: number, array: (string | null)[]) => value is S, thisArg?: any): S[]; (predicate: (value: string | null, index: number, array: (string | null)[]) => unknown, thisArg?: any): (string | null)[]; } >Boolean : BooleanConstructor // @ts-expect-error const values2 = nullableValues.filter(new Boolean); >values2 : (string | null)[] >nullableValues.filter(new Boolean) : (string | null)[] ->nullableValues.filter : { (predicate: (value: string | null, index: number, array: (string | null)[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): string[]; (predicate: (value: string | null, index: number, array: (string | null)[]) => unknown, thisArg?: any): (string | null)[]; } +>nullableValues.filter : { (predicate: (value: string | null, index: number, array: (string | null)[]) => value is S, thisArg?: any): S[]; (predicate: (value: string | null, index: number, array: (string | null)[]) => unknown, thisArg?: any): (string | null)[]; } >nullableValues : (string | null)[] ->filter : { (predicate: (value: string | null, index: number, array: (string | null)[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): string[]; (predicate: (value: string | null, index: number, array: (string | null)[]) => unknown, thisArg?: any): (string | null)[]; } +>filter : { (predicate: (value: string | null, index: number, array: (string | null)[]) => value is S, thisArg?: any): S[]; (predicate: (value: string | null, index: number, array: (string | null)[]) => unknown, thisArg?: any): (string | null)[]; } >new Boolean : Boolean >Boolean : BooleanConstructor @@ -35,11 +35,11 @@ const arr = [0, 1, "", "foo", null] as const; >"foo" : "foo" const arr2 = arr.filter(Boolean); // expect ("foo" | 1)[] ->arr2 : (1 | "foo")[] ->arr.filter(Boolean) : (1 | "foo")[] ->arr.filter : { (predicate: (value: "" | 0 | 1 | "foo" | null, index: number, array: readonly ("" | 0 | 1 | "foo" | null)[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): (1 | "foo")[]; (predicate: (value: "" | 0 | 1 | "foo" | null, index: number, array: readonly ("" | 0 | 1 | "foo" | null)[]) => unknown, thisArg?: any): ("" | 0 | 1 | "foo" | null)[]; } +>arr2 : ("" | 0 | 1 | "foo" | null)[] +>arr.filter(Boolean) : ("" | 0 | 1 | "foo" | null)[] +>arr.filter : { (predicate: (value: "" | 0 | 1 | "foo" | null, index: number, array: readonly ("" | 0 | 1 | "foo" | null)[]) => value is S, thisArg?: any): S[]; (predicate: (value: "" | 0 | 1 | "foo" | null, index: number, array: readonly ("" | 0 | 1 | "foo" | null)[]) => unknown, thisArg?: any): ("" | 0 | 1 | "foo" | null)[]; } >arr : readonly [0, 1, "", "foo", null] ->filter : { (predicate: (value: "" | 0 | 1 | "foo" | null, index: number, array: readonly ("" | 0 | 1 | "foo" | null)[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): (1 | "foo")[]; (predicate: (value: "" | 0 | 1 | "foo" | null, index: number, array: readonly ("" | 0 | 1 | "foo" | null)[]) => unknown, thisArg?: any): ("" | 0 | 1 | "foo" | null)[]; } +>filter : { (predicate: (value: "" | 0 | 1 | "foo" | null, index: number, array: readonly ("" | 0 | 1 | "foo" | null)[]) => value is S, thisArg?: any): S[]; (predicate: (value: "" | 0 | 1 | "foo" | null, index: number, array: readonly ("" | 0 | 1 | "foo" | null)[]) => unknown, thisArg?: any): ("" | 0 | 1 | "foo" | null)[]; } >Boolean : BooleanConstructor diff --git a/tests/baselines/reference/arrayMapPredicates1.errors.txt b/tests/baselines/reference/arrayMapPredicates1.errors.txt new file mode 100644 index 0000000000000..ef13e3dce88e7 --- /dev/null +++ b/tests/baselines/reference/arrayMapPredicates1.errors.txt @@ -0,0 +1,114 @@ +arrayMapPredicates1.ts(22,9): error TS2345: Argument of type 'ArrayPredISect' is not assignable to parameter of type '((value: string, index: number, array: string[]) => number) & ((value: number, index: number, array: number[]) => number)'. + Type 'ArrayPredISect' is not assignable to type '(value: string, index: number, array: string[]) => number'. + Type 'string' is not assignable to type 'number'. +arrayMapPredicates1.ts(25,9): error TS2345: Argument of type 'ArrayPredOverload' is not assignable to parameter of type '((value: string, index: number, array: string[]) => number) & ((value: number, index: number, array: number[]) => number)'. + Type 'ArrayPredOverload' is not assignable to type '(value: string, index: number, array: string[]) => number'. + Type 'string' is not assignable to type 'number'. +arrayMapPredicates1.ts(33,10): error TS2345: Argument of type 'ArrayPredISect' is not assignable to parameter of type '(value: string | number, index: number, array: (string | number)[]) => number'. + Types of parameters 'value' and 'value' are incompatible. + Type 'string | number' is not assignable to type 'string'. + Type 'number' is not assignable to type 'string'. +arrayMapPredicates1.ts(34,10): error TS2345: Argument of type 'ArrayPredISect' is not assignable to parameter of type '(value: string | number, index: number, array: (string | number)[]) => unknown'. + Types of parameters 'value' and 'value' are incompatible. + Type 'string | number' is not assignable to type 'string'. + Type 'number' is not assignable to type 'string'. +arrayMapPredicates1.ts(36,10): error TS2345: Argument of type 'ArrayPredOverload' is not assignable to parameter of type '(value: string | number, index: number, array: (string | number)[]) => number'. + Types of parameters 'value' and 'value' are incompatible. + Type 'string | number' is not assignable to type 'string'. + Type 'number' is not assignable to type 'string'. +arrayMapPredicates1.ts(37,10): error TS2345: Argument of type 'ArrayPredOverload' is not assignable to parameter of type '(value: string | number, index: number, array: (string | number)[]) => unknown'. + Types of parameters 'value' and 'value' are incompatible. + Type 'string | number' is not assignable to type 'string'. + Type 'number' is not assignable to type 'string'. +arrayMapPredicates1.ts(43,10): error TS2345: Argument of type 'ArrayPredISect' is not assignable to parameter of type '(value: string, index: number, array: string[]) => number'. + Type 'string' is not assignable to type 'number'. +arrayMapPredicates1.ts(46,10): error TS2345: Argument of type 'ArrayPredOverload' is not assignable to parameter of type '(value: string, index: number, array: string[]) => number'. + Type 'string' is not assignable to type 'number'. + + +==== arrayMapPredicates1.ts (8 errors) ==== + type ArrayPredISect = ((value: string, index: number, array: string[]) => S) & ((value: number, index: number, array: number[]) => N) + + interface ArrayPredOverload { + (value: string, index: number, array: string[]): S, + (value: number, index: number, array: number[]): N + } + + type ArrayPredUnion = ((value: string|number, index: number, array: (string|number)[]) => S | N) + + + declare const pisect1:ArrayPredISect + declare const pisect2:ArrayPredISect + + declare const poload1:ArrayPredOverload + declare const poload2:ArrayPredOverload + + declare const punion1:ArrayPredUnion + declare const punion2:ArrayPredUnion + + + declare const asn: string[]|number[]; + asn.map(pisect1); // 5.2.2. error + ~~~~~~~ +!!! error TS2345: Argument of type 'ArrayPredISect' is not assignable to parameter of type '((value: string, index: number, array: string[]) => number) & ((value: number, index: number, array: number[]) => number)'. +!!! error TS2345: Type 'ArrayPredISect' is not assignable to type '(value: string, index: number, array: string[]) => number'. +!!! error TS2345: Type 'string' is not assignable to type 'number'. + asn.map(pisect2); + + asn.map(poload1); // 5.2.2. error + ~~~~~~~ +!!! error TS2345: Argument of type 'ArrayPredOverload' is not assignable to parameter of type '((value: string, index: number, array: string[]) => number) & ((value: number, index: number, array: number[]) => number)'. +!!! error TS2345: Type 'ArrayPredOverload' is not assignable to type '(value: string, index: number, array: string[]) => number'. +!!! error TS2345: Type 'string' is not assignable to type 'number'. + asn.map(poload2); + + asn.map(punion1); + asn.map(punion2); + + declare const asun: (string|number)[]; + + asun.map(pisect1); // 5.2.2. error + ~~~~~~~ +!!! error TS2345: Argument of type 'ArrayPredISect' is not assignable to parameter of type '(value: string | number, index: number, array: (string | number)[]) => number'. +!!! error TS2345: Types of parameters 'value' and 'value' are incompatible. +!!! error TS2345: Type 'string | number' is not assignable to type 'string'. +!!! error TS2345: Type 'number' is not assignable to type 'string'. + asun.map(pisect2); // 5.2.2. error + ~~~~~~~ +!!! error TS2345: Argument of type 'ArrayPredISect' is not assignable to parameter of type '(value: string | number, index: number, array: (string | number)[]) => unknown'. +!!! error TS2345: Types of parameters 'value' and 'value' are incompatible. +!!! error TS2345: Type 'string | number' is not assignable to type 'string'. +!!! error TS2345: Type 'number' is not assignable to type 'string'. + + asun.map(poload1); // 5.2.2. error + ~~~~~~~ +!!! error TS2345: Argument of type 'ArrayPredOverload' is not assignable to parameter of type '(value: string | number, index: number, array: (string | number)[]) => number'. +!!! error TS2345: Types of parameters 'value' and 'value' are incompatible. +!!! error TS2345: Type 'string | number' is not assignable to type 'string'. +!!! error TS2345: Type 'number' is not assignable to type 'string'. + asun.map(poload2); // 5.2.2. error + ~~~~~~~ +!!! error TS2345: Argument of type 'ArrayPredOverload' is not assignable to parameter of type '(value: string | number, index: number, array: (string | number)[]) => unknown'. +!!! error TS2345: Types of parameters 'value' and 'value' are incompatible. +!!! error TS2345: Type 'string | number' is not assignable to type 'string'. +!!! error TS2345: Type 'number' is not assignable to type 'string'. + + asun.map(punion1); + asun.map(punion2); + + declare const astr: string[]; + astr.map(pisect1); // 5.2.2. error + ~~~~~~~ +!!! error TS2345: Argument of type 'ArrayPredISect' is not assignable to parameter of type '(value: string, index: number, array: string[]) => number'. +!!! error TS2345: Type 'string' is not assignable to type 'number'. + astr.map(pisect2); + + astr.map(poload1); // 5.2.2. error + ~~~~~~~ +!!! error TS2345: Argument of type 'ArrayPredOverload' is not assignable to parameter of type '(value: string, index: number, array: string[]) => number'. +!!! error TS2345: Type 'string' is not assignable to type 'number'. + astr.map(poload2); + + astr.map(punion1); + astr.map(punion2); + \ No newline at end of file diff --git a/tests/baselines/reference/arrayMapPredicates1.js b/tests/baselines/reference/arrayMapPredicates1.js new file mode 100644 index 0000000000000..e4331c4d807a9 --- /dev/null +++ b/tests/baselines/reference/arrayMapPredicates1.js @@ -0,0 +1,93 @@ +//// [tests/cases/compiler/arrayMapPredicates1.ts] //// + +//// [arrayMapPredicates1.ts] +type ArrayPredISect = ((value: string, index: number, array: string[]) => S) & ((value: number, index: number, array: number[]) => N) + +interface ArrayPredOverload { + (value: string, index: number, array: string[]): S, + (value: number, index: number, array: number[]): N +} + +type ArrayPredUnion = ((value: string|number, index: number, array: (string|number)[]) => S | N) + + +declare const pisect1:ArrayPredISect +declare const pisect2:ArrayPredISect + +declare const poload1:ArrayPredOverload +declare const poload2:ArrayPredOverload + +declare const punion1:ArrayPredUnion +declare const punion2:ArrayPredUnion + + +declare const asn: string[]|number[]; +asn.map(pisect1); // 5.2.2. error +asn.map(pisect2); + +asn.map(poload1); // 5.2.2. error +asn.map(poload2); + +asn.map(punion1); +asn.map(punion2); + +declare const asun: (string|number)[]; + +asun.map(pisect1); // 5.2.2. error +asun.map(pisect2); // 5.2.2. error + +asun.map(poload1); // 5.2.2. error +asun.map(poload2); // 5.2.2. error + +asun.map(punion1); +asun.map(punion2); + +declare const astr: string[]; +astr.map(pisect1); // 5.2.2. error +astr.map(pisect2); + +astr.map(poload1); // 5.2.2. error +astr.map(poload2); + +astr.map(punion1); +astr.map(punion2); + + +//// [arrayMapPredicates1.js] +"use strict"; +asn.map(pisect1); // 5.2.2. error +asn.map(pisect2); +asn.map(poload1); // 5.2.2. error +asn.map(poload2); +asn.map(punion1); +asn.map(punion2); +asun.map(pisect1); // 5.2.2. error +asun.map(pisect2); // 5.2.2. error +asun.map(poload1); // 5.2.2. error +asun.map(poload2); // 5.2.2. error +asun.map(punion1); +asun.map(punion2); +astr.map(pisect1); // 5.2.2. error +astr.map(pisect2); +astr.map(poload1); // 5.2.2. error +astr.map(poload2); +astr.map(punion1); +astr.map(punion2); + + +//// [arrayMapPredicates1.d.ts] +type ArrayPredISect = ((value: string, index: number, array: string[]) => S) & ((value: number, index: number, array: number[]) => N); +interface ArrayPredOverload { + (value: string, index: number, array: string[]): S; + (value: number, index: number, array: number[]): N; +} +type ArrayPredUnion = ((value: string | number, index: number, array: (string | number)[]) => S | N); +declare const pisect1: ArrayPredISect; +declare const pisect2: ArrayPredISect; +declare const poload1: ArrayPredOverload; +declare const poload2: ArrayPredOverload; +declare const punion1: ArrayPredUnion; +declare const punion2: ArrayPredUnion; +declare const asn: string[] | number[]; +declare const asun: (string | number)[]; +declare const astr: string[]; diff --git a/tests/baselines/reference/arrayMapPredicates1.symbols b/tests/baselines/reference/arrayMapPredicates1.symbols new file mode 100644 index 0000000000000..04c43770e5307 --- /dev/null +++ b/tests/baselines/reference/arrayMapPredicates1.symbols @@ -0,0 +1,187 @@ +//// [tests/cases/compiler/arrayMapPredicates1.ts] //// + +=== arrayMapPredicates1.ts === +type ArrayPredISect = ((value: string, index: number, array: string[]) => S) & ((value: number, index: number, array: number[]) => N) +>ArrayPredISect : Symbol(ArrayPredISect, Decl(arrayMapPredicates1.ts, 0, 0)) +>S : Symbol(S, Decl(arrayMapPredicates1.ts, 0, 20)) +>N : Symbol(N, Decl(arrayMapPredicates1.ts, 0, 22)) +>value : Symbol(value, Decl(arrayMapPredicates1.ts, 0, 29)) +>index : Symbol(index, Decl(arrayMapPredicates1.ts, 0, 43)) +>array : Symbol(array, Decl(arrayMapPredicates1.ts, 0, 58)) +>S : Symbol(S, Decl(arrayMapPredicates1.ts, 0, 20)) +>value : Symbol(value, Decl(arrayMapPredicates1.ts, 0, 86)) +>index : Symbol(index, Decl(arrayMapPredicates1.ts, 0, 100)) +>array : Symbol(array, Decl(arrayMapPredicates1.ts, 0, 115)) +>N : Symbol(N, Decl(arrayMapPredicates1.ts, 0, 22)) + +interface ArrayPredOverload { +>ArrayPredOverload : Symbol(ArrayPredOverload, Decl(arrayMapPredicates1.ts, 0, 138)) +>S : Symbol(S, Decl(arrayMapPredicates1.ts, 2, 29)) +>N : Symbol(N, Decl(arrayMapPredicates1.ts, 2, 31)) + + (value: string, index: number, array: string[]): S, +>value : Symbol(value, Decl(arrayMapPredicates1.ts, 3, 5)) +>index : Symbol(index, Decl(arrayMapPredicates1.ts, 3, 19)) +>array : Symbol(array, Decl(arrayMapPredicates1.ts, 3, 34)) +>S : Symbol(S, Decl(arrayMapPredicates1.ts, 2, 29)) + + (value: number, index: number, array: number[]): N +>value : Symbol(value, Decl(arrayMapPredicates1.ts, 4, 5)) +>index : Symbol(index, Decl(arrayMapPredicates1.ts, 4, 19)) +>array : Symbol(array, Decl(arrayMapPredicates1.ts, 4, 34)) +>N : Symbol(N, Decl(arrayMapPredicates1.ts, 2, 31)) +} + +type ArrayPredUnion = ((value: string|number, index: number, array: (string|number)[]) => S | N) +>ArrayPredUnion : Symbol(ArrayPredUnion, Decl(arrayMapPredicates1.ts, 5, 1)) +>S : Symbol(S, Decl(arrayMapPredicates1.ts, 7, 20)) +>N : Symbol(N, Decl(arrayMapPredicates1.ts, 7, 22)) +>value : Symbol(value, Decl(arrayMapPredicates1.ts, 7, 29)) +>index : Symbol(index, Decl(arrayMapPredicates1.ts, 7, 50)) +>array : Symbol(array, Decl(arrayMapPredicates1.ts, 7, 65)) +>S : Symbol(S, Decl(arrayMapPredicates1.ts, 7, 20)) +>N : Symbol(N, Decl(arrayMapPredicates1.ts, 7, 22)) + + +declare const pisect1:ArrayPredISect +>pisect1 : Symbol(pisect1, Decl(arrayMapPredicates1.ts, 10, 13)) +>ArrayPredISect : Symbol(ArrayPredISect, Decl(arrayMapPredicates1.ts, 0, 0)) + +declare const pisect2:ArrayPredISect +>pisect2 : Symbol(pisect2, Decl(arrayMapPredicates1.ts, 11, 13)) +>ArrayPredISect : Symbol(ArrayPredISect, Decl(arrayMapPredicates1.ts, 0, 0)) + +declare const poload1:ArrayPredOverload +>poload1 : Symbol(poload1, Decl(arrayMapPredicates1.ts, 13, 13)) +>ArrayPredOverload : Symbol(ArrayPredOverload, Decl(arrayMapPredicates1.ts, 0, 138)) + +declare const poload2:ArrayPredOverload +>poload2 : Symbol(poload2, Decl(arrayMapPredicates1.ts, 14, 13)) +>ArrayPredOverload : Symbol(ArrayPredOverload, Decl(arrayMapPredicates1.ts, 0, 138)) + +declare const punion1:ArrayPredUnion +>punion1 : Symbol(punion1, Decl(arrayMapPredicates1.ts, 16, 13)) +>ArrayPredUnion : Symbol(ArrayPredUnion, Decl(arrayMapPredicates1.ts, 5, 1)) + +declare const punion2:ArrayPredUnion +>punion2 : Symbol(punion2, Decl(arrayMapPredicates1.ts, 17, 13)) +>ArrayPredUnion : Symbol(ArrayPredUnion, Decl(arrayMapPredicates1.ts, 5, 1)) + + +declare const asn: string[]|number[]; +>asn : Symbol(asn, Decl(arrayMapPredicates1.ts, 20, 13)) + +asn.map(pisect1); // 5.2.2. error +>asn.map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>asn : Symbol(asn, Decl(arrayMapPredicates1.ts, 20, 13)) +>map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>pisect1 : Symbol(pisect1, Decl(arrayMapPredicates1.ts, 10, 13)) + +asn.map(pisect2); +>asn.map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>asn : Symbol(asn, Decl(arrayMapPredicates1.ts, 20, 13)) +>map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>pisect2 : Symbol(pisect2, Decl(arrayMapPredicates1.ts, 11, 13)) + +asn.map(poload1); // 5.2.2. error +>asn.map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>asn : Symbol(asn, Decl(arrayMapPredicates1.ts, 20, 13)) +>map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>poload1 : Symbol(poload1, Decl(arrayMapPredicates1.ts, 13, 13)) + +asn.map(poload2); +>asn.map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>asn : Symbol(asn, Decl(arrayMapPredicates1.ts, 20, 13)) +>map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>poload2 : Symbol(poload2, Decl(arrayMapPredicates1.ts, 14, 13)) + +asn.map(punion1); +>asn.map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>asn : Symbol(asn, Decl(arrayMapPredicates1.ts, 20, 13)) +>map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>punion1 : Symbol(punion1, Decl(arrayMapPredicates1.ts, 16, 13)) + +asn.map(punion2); +>asn.map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>asn : Symbol(asn, Decl(arrayMapPredicates1.ts, 20, 13)) +>map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>punion2 : Symbol(punion2, Decl(arrayMapPredicates1.ts, 17, 13)) + +declare const asun: (string|number)[]; +>asun : Symbol(asun, Decl(arrayMapPredicates1.ts, 30, 13)) + +asun.map(pisect1); // 5.2.2. error +>asun.map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --)) +>asun : Symbol(asun, Decl(arrayMapPredicates1.ts, 30, 13)) +>map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --)) +>pisect1 : Symbol(pisect1, Decl(arrayMapPredicates1.ts, 10, 13)) + +asun.map(pisect2); // 5.2.2. error +>asun.map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --)) +>asun : Symbol(asun, Decl(arrayMapPredicates1.ts, 30, 13)) +>map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --)) +>pisect2 : Symbol(pisect2, Decl(arrayMapPredicates1.ts, 11, 13)) + +asun.map(poload1); // 5.2.2. error +>asun.map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --)) +>asun : Symbol(asun, Decl(arrayMapPredicates1.ts, 30, 13)) +>map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --)) +>poload1 : Symbol(poload1, Decl(arrayMapPredicates1.ts, 13, 13)) + +asun.map(poload2); // 5.2.2. error +>asun.map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --)) +>asun : Symbol(asun, Decl(arrayMapPredicates1.ts, 30, 13)) +>map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --)) +>poload2 : Symbol(poload2, Decl(arrayMapPredicates1.ts, 14, 13)) + +asun.map(punion1); +>asun.map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --)) +>asun : Symbol(asun, Decl(arrayMapPredicates1.ts, 30, 13)) +>map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --)) +>punion1 : Symbol(punion1, Decl(arrayMapPredicates1.ts, 16, 13)) + +asun.map(punion2); +>asun.map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --)) +>asun : Symbol(asun, Decl(arrayMapPredicates1.ts, 30, 13)) +>map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --)) +>punion2 : Symbol(punion2, Decl(arrayMapPredicates1.ts, 17, 13)) + +declare const astr: string[]; +>astr : Symbol(astr, Decl(arrayMapPredicates1.ts, 41, 13)) + +astr.map(pisect1); // 5.2.2. error +>astr.map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --)) +>astr : Symbol(astr, Decl(arrayMapPredicates1.ts, 41, 13)) +>map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --)) +>pisect1 : Symbol(pisect1, Decl(arrayMapPredicates1.ts, 10, 13)) + +astr.map(pisect2); +>astr.map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --)) +>astr : Symbol(astr, Decl(arrayMapPredicates1.ts, 41, 13)) +>map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --)) +>pisect2 : Symbol(pisect2, Decl(arrayMapPredicates1.ts, 11, 13)) + +astr.map(poload1); // 5.2.2. error +>astr.map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --)) +>astr : Symbol(astr, Decl(arrayMapPredicates1.ts, 41, 13)) +>map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --)) +>poload1 : Symbol(poload1, Decl(arrayMapPredicates1.ts, 13, 13)) + +astr.map(poload2); +>astr.map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --)) +>astr : Symbol(astr, Decl(arrayMapPredicates1.ts, 41, 13)) +>map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --)) +>poload2 : Symbol(poload2, Decl(arrayMapPredicates1.ts, 14, 13)) + +astr.map(punion1); +>astr.map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --)) +>astr : Symbol(astr, Decl(arrayMapPredicates1.ts, 41, 13)) +>map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --)) +>punion1 : Symbol(punion1, Decl(arrayMapPredicates1.ts, 16, 13)) + +astr.map(punion2); +>astr.map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --)) +>astr : Symbol(astr, Decl(arrayMapPredicates1.ts, 41, 13)) +>map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --)) +>punion2 : Symbol(punion2, Decl(arrayMapPredicates1.ts, 17, 13)) + diff --git a/tests/baselines/reference/arrayMapPredicates1.types b/tests/baselines/reference/arrayMapPredicates1.types new file mode 100644 index 0000000000000..de986bebfa489 --- /dev/null +++ b/tests/baselines/reference/arrayMapPredicates1.types @@ -0,0 +1,185 @@ +//// [tests/cases/compiler/arrayMapPredicates1.ts] //// + +=== arrayMapPredicates1.ts === +type ArrayPredISect = ((value: string, index: number, array: string[]) => S) & ((value: number, index: number, array: number[]) => N) +>ArrayPredISect : ArrayPredISect +>value : string +>index : number +>array : string[] +>value : number +>index : number +>array : number[] + +interface ArrayPredOverload { + (value: string, index: number, array: string[]): S, +>value : string +>index : number +>array : string[] + + (value: number, index: number, array: number[]): N +>value : number +>index : number +>array : number[] +} + +type ArrayPredUnion = ((value: string|number, index: number, array: (string|number)[]) => S | N) +>ArrayPredUnion : ArrayPredUnion +>value : string | number +>index : number +>array : (string | number)[] + + +declare const pisect1:ArrayPredISect +>pisect1 : ArrayPredISect + +declare const pisect2:ArrayPredISect +>pisect2 : ArrayPredISect + +declare const poload1:ArrayPredOverload +>poload1 : ArrayPredOverload + +declare const poload2:ArrayPredOverload +>poload2 : ArrayPredOverload + +declare const punion1:ArrayPredUnion +>punion1 : ArrayPredUnion + +declare const punion2:ArrayPredUnion +>punion2 : ArrayPredUnion + + +declare const asn: string[]|number[]; +>asn : string[] | number[] + +asn.map(pisect1); // 5.2.2. error +>asn.map(pisect1) : number[] +>asn.map : ((callbackfn: (value: string, index: number, array: string[]) => U, thisArg?: any) => U[]) | ((callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[]) +>asn : string[] | number[] +>map : ((callbackfn: (value: string, index: number, array: string[]) => U, thisArg?: any) => U[]) | ((callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[]) +>pisect1 : ArrayPredISect + +asn.map(pisect2); +>asn.map(pisect2) : unknown[] +>asn.map : ((callbackfn: (value: string, index: number, array: string[]) => U, thisArg?: any) => U[]) | ((callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[]) +>asn : string[] | number[] +>map : ((callbackfn: (value: string, index: number, array: string[]) => U, thisArg?: any) => U[]) | ((callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[]) +>pisect2 : ArrayPredISect + +asn.map(poload1); // 5.2.2. error +>asn.map(poload1) : number[] +>asn.map : ((callbackfn: (value: string, index: number, array: string[]) => U, thisArg?: any) => U[]) | ((callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[]) +>asn : string[] | number[] +>map : ((callbackfn: (value: string, index: number, array: string[]) => U, thisArg?: any) => U[]) | ((callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[]) +>poload1 : ArrayPredOverload + +asn.map(poload2); +>asn.map(poload2) : unknown[] +>asn.map : ((callbackfn: (value: string, index: number, array: string[]) => U, thisArg?: any) => U[]) | ((callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[]) +>asn : string[] | number[] +>map : ((callbackfn: (value: string, index: number, array: string[]) => U, thisArg?: any) => U[]) | ((callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[]) +>poload2 : ArrayPredOverload + +asn.map(punion1); +>asn.map(punion1) : (string | number)[] +>asn.map : ((callbackfn: (value: string, index: number, array: string[]) => U, thisArg?: any) => U[]) | ((callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[]) +>asn : string[] | number[] +>map : ((callbackfn: (value: string, index: number, array: string[]) => U, thisArg?: any) => U[]) | ((callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[]) +>punion1 : ArrayPredUnion + +asn.map(punion2); +>asn.map(punion2) : unknown[] +>asn.map : ((callbackfn: (value: string, index: number, array: string[]) => U, thisArg?: any) => U[]) | ((callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[]) +>asn : string[] | number[] +>map : ((callbackfn: (value: string, index: number, array: string[]) => U, thisArg?: any) => U[]) | ((callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[]) +>punion2 : ArrayPredUnion + +declare const asun: (string|number)[]; +>asun : (string | number)[] + +asun.map(pisect1); // 5.2.2. error +>asun.map(pisect1) : number[] +>asun.map : (callbackfn: (value: string | number, index: number, array: (string | number)[]) => U, thisArg?: any) => U[] +>asun : (string | number)[] +>map : (callbackfn: (value: string | number, index: number, array: (string | number)[]) => U, thisArg?: any) => U[] +>pisect1 : ArrayPredISect + +asun.map(pisect2); // 5.2.2. error +>asun.map(pisect2) : unknown[] +>asun.map : (callbackfn: (value: string | number, index: number, array: (string | number)[]) => U, thisArg?: any) => U[] +>asun : (string | number)[] +>map : (callbackfn: (value: string | number, index: number, array: (string | number)[]) => U, thisArg?: any) => U[] +>pisect2 : ArrayPredISect + +asun.map(poload1); // 5.2.2. error +>asun.map(poload1) : number[] +>asun.map : (callbackfn: (value: string | number, index: number, array: (string | number)[]) => U, thisArg?: any) => U[] +>asun : (string | number)[] +>map : (callbackfn: (value: string | number, index: number, array: (string | number)[]) => U, thisArg?: any) => U[] +>poload1 : ArrayPredOverload + +asun.map(poload2); // 5.2.2. error +>asun.map(poload2) : unknown[] +>asun.map : (callbackfn: (value: string | number, index: number, array: (string | number)[]) => U, thisArg?: any) => U[] +>asun : (string | number)[] +>map : (callbackfn: (value: string | number, index: number, array: (string | number)[]) => U, thisArg?: any) => U[] +>poload2 : ArrayPredOverload + +asun.map(punion1); +>asun.map(punion1) : (string | number)[] +>asun.map : (callbackfn: (value: string | number, index: number, array: (string | number)[]) => U, thisArg?: any) => U[] +>asun : (string | number)[] +>map : (callbackfn: (value: string | number, index: number, array: (string | number)[]) => U, thisArg?: any) => U[] +>punion1 : ArrayPredUnion + +asun.map(punion2); +>asun.map(punion2) : unknown[] +>asun.map : (callbackfn: (value: string | number, index: number, array: (string | number)[]) => U, thisArg?: any) => U[] +>asun : (string | number)[] +>map : (callbackfn: (value: string | number, index: number, array: (string | number)[]) => U, thisArg?: any) => U[] +>punion2 : ArrayPredUnion + +declare const astr: string[]; +>astr : string[] + +astr.map(pisect1); // 5.2.2. error +>astr.map(pisect1) : number[] +>astr.map : (callbackfn: (value: string, index: number, array: string[]) => U, thisArg?: any) => U[] +>astr : string[] +>map : (callbackfn: (value: string, index: number, array: string[]) => U, thisArg?: any) => U[] +>pisect1 : ArrayPredISect + +astr.map(pisect2); +>astr.map(pisect2) : unknown[] +>astr.map : (callbackfn: (value: string, index: number, array: string[]) => U, thisArg?: any) => U[] +>astr : string[] +>map : (callbackfn: (value: string, index: number, array: string[]) => U, thisArg?: any) => U[] +>pisect2 : ArrayPredISect + +astr.map(poload1); // 5.2.2. error +>astr.map(poload1) : number[] +>astr.map : (callbackfn: (value: string, index: number, array: string[]) => U, thisArg?: any) => U[] +>astr : string[] +>map : (callbackfn: (value: string, index: number, array: string[]) => U, thisArg?: any) => U[] +>poload1 : ArrayPredOverload + +astr.map(poload2); +>astr.map(poload2) : unknown[] +>astr.map : (callbackfn: (value: string, index: number, array: string[]) => U, thisArg?: any) => U[] +>astr : string[] +>map : (callbackfn: (value: string, index: number, array: string[]) => U, thisArg?: any) => U[] +>poload2 : ArrayPredOverload + +astr.map(punion1); +>astr.map(punion1) : (string | number)[] +>astr.map : (callbackfn: (value: string, index: number, array: string[]) => U, thisArg?: any) => U[] +>astr : string[] +>map : (callbackfn: (value: string, index: number, array: string[]) => U, thisArg?: any) => U[] +>punion1 : ArrayPredUnion + +astr.map(punion2); +>astr.map(punion2) : unknown[] +>astr.map : (callbackfn: (value: string, index: number, array: string[]) => U, thisArg?: any) => U[] +>astr : string[] +>map : (callbackfn: (value: string, index: number, array: string[]) => U, thisArg?: any) => U[] +>punion2 : ArrayPredUnion + diff --git a/tests/baselines/reference/bestChoiceType.symbols b/tests/baselines/reference/bestChoiceType.symbols index cfe8c803799f7..5be12e3b2d026 100644 --- a/tests/baselines/reference/bestChoiceType.symbols +++ b/tests/baselines/reference/bestChoiceType.symbols @@ -9,9 +9,7 @@ >match : Symbol(String.match, Decl(lib.es5.d.ts, --, --)) >map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >s : Symbol(s, Decl(bestChoiceType.ts, 2, 26)) ->s.toLowerCase : Symbol(String.toLowerCase, Decl(lib.es5.d.ts, --, --)) >s : Symbol(s, Decl(bestChoiceType.ts, 2, 26)) ->toLowerCase : Symbol(String.toLowerCase, Decl(lib.es5.d.ts, --, --)) // Similar cases @@ -33,9 +31,7 @@ function f1() { >y : Symbol(y, Decl(bestChoiceType.ts, 8, 7)) >map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >s : Symbol(s, Decl(bestChoiceType.ts, 9, 18)) ->s.toLowerCase : Symbol(String.toLowerCase, Decl(lib.es5.d.ts, --, --)) >s : Symbol(s, Decl(bestChoiceType.ts, 9, 18)) ->toLowerCase : Symbol(String.toLowerCase, Decl(lib.es5.d.ts, --, --)) } function f2() { @@ -57,8 +53,6 @@ function f2() { >y : Symbol(y, Decl(bestChoiceType.ts, 14, 7)) >map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >s : Symbol(s, Decl(bestChoiceType.ts, 15, 18)) ->s.toLowerCase : Symbol(String.toLowerCase, Decl(lib.es5.d.ts, --, --)) >s : Symbol(s, Decl(bestChoiceType.ts, 15, 18)) ->toLowerCase : Symbol(String.toLowerCase, Decl(lib.es5.d.ts, --, --)) } diff --git a/tests/baselines/reference/bestChoiceType.types b/tests/baselines/reference/bestChoiceType.types index fe9bc1784c85c..11acdb67bd9e8 100644 --- a/tests/baselines/reference/bestChoiceType.types +++ b/tests/baselines/reference/bestChoiceType.types @@ -4,7 +4,7 @@ // Repro from #10041 (''.match(/ /) || []).map(s => s.toLowerCase()); ->(''.match(/ /) || []).map(s => s.toLowerCase()) : string[] +>(''.match(/ /) || []).map(s => s.toLowerCase()) : any[] >(''.match(/ /) || []).map : ((callbackfn: (value: string, index: number, array: string[]) => U, thisArg?: any) => U[]) | ((callbackfn: (value: never, index: number, array: never[]) => U, thisArg?: any) => U[]) >(''.match(/ /) || []) : RegExpMatchArray | [] >''.match(/ /) || [] : RegExpMatchArray | [] @@ -15,12 +15,12 @@ >/ / : RegExp >[] : [] >map : ((callbackfn: (value: string, index: number, array: string[]) => U, thisArg?: any) => U[]) | ((callbackfn: (value: never, index: number, array: never[]) => U, thisArg?: any) => U[]) ->s => s.toLowerCase() : (s: string) => string ->s : string ->s.toLowerCase() : string ->s.toLowerCase : () => string ->s : string ->toLowerCase : () => string +>s => s.toLowerCase() : (s: any) => any +>s : any +>s.toLowerCase() : any +>s.toLowerCase : any +>s : any +>toLowerCase : any // Similar cases @@ -42,17 +42,17 @@ function f1() { >[] : [] let z = y.map(s => s.toLowerCase()); ->z : string[] ->y.map(s => s.toLowerCase()) : string[] +>z : any[] +>y.map(s => s.toLowerCase()) : any[] >y.map : ((callbackfn: (value: string, index: number, array: string[]) => U, thisArg?: any) => U[]) | ((callbackfn: (value: never, index: number, array: never[]) => U, thisArg?: any) => U[]) >y : RegExpMatchArray | [] >map : ((callbackfn: (value: string, index: number, array: string[]) => U, thisArg?: any) => U[]) | ((callbackfn: (value: never, index: number, array: never[]) => U, thisArg?: any) => U[]) ->s => s.toLowerCase() : (s: string) => string ->s : string ->s.toLowerCase() : string ->s.toLowerCase : () => string ->s : string ->toLowerCase : () => string +>s => s.toLowerCase() : (s: any) => any +>s : any +>s.toLowerCase() : any +>s.toLowerCase : any +>s : any +>toLowerCase : any } function f2() { @@ -74,16 +74,16 @@ function f2() { >[] : never[] let z = y.map(s => s.toLowerCase()); ->z : string[] ->y.map(s => s.toLowerCase()) : string[] +>z : any[] +>y.map(s => s.toLowerCase()) : any[] >y.map : ((callbackfn: (value: string, index: number, array: string[]) => U, thisArg?: any) => U[]) | ((callbackfn: (value: never, index: number, array: never[]) => U, thisArg?: any) => U[]) >y : RegExpMatchArray | never[] >map : ((callbackfn: (value: string, index: number, array: string[]) => U, thisArg?: any) => U[]) | ((callbackfn: (value: never, index: number, array: never[]) => U, thisArg?: any) => U[]) ->s => s.toLowerCase() : (s: string) => string ->s : string ->s.toLowerCase() : string ->s.toLowerCase : () => string ->s : string ->toLowerCase : () => string +>s => s.toLowerCase() : (s: any) => any +>s : any +>s.toLowerCase() : any +>s.toLowerCase : any +>s : any +>toLowerCase : any } diff --git a/tests/baselines/reference/booleanFilterAnyArray.symbols b/tests/baselines/reference/booleanFilterAnyArray.symbols index ff5521a64ce37..cebda515d0c75 100644 --- a/tests/baselines/reference/booleanFilterAnyArray.symbols +++ b/tests/baselines/reference/booleanFilterAnyArray.symbols @@ -72,9 +72,9 @@ var ys: any[]; var ys = realanys.filter(Boolean) >ys : Symbol(ys, Decl(booleanFilterAnyArray.ts, 16, 3), Decl(booleanFilterAnyArray.ts, 17, 3)) ->realanys.filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>realanys.filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >realanys : Symbol(realanys, Decl(booleanFilterAnyArray.ts, 15, 11)) ->filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >Boolean : Symbol(Boolean, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) var foo = [{ name: 'x' }] @@ -88,9 +88,9 @@ var foor: Array<{name: string}> var foor = foo.filter(x => x.name) >foor : Symbol(foor, Decl(booleanFilterAnyArray.ts, 20, 3), Decl(booleanFilterAnyArray.ts, 21, 3)) ->foo.filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>foo.filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >foo : Symbol(foo, Decl(booleanFilterAnyArray.ts, 19, 3)) ->filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >x : Symbol(x, Decl(booleanFilterAnyArray.ts, 21, 22)) >x.name : Symbol(name, Decl(booleanFilterAnyArray.ts, 19, 12)) >x : Symbol(x, Decl(booleanFilterAnyArray.ts, 21, 22)) @@ -102,8 +102,8 @@ var foos: Array var foos = [true, true, false, null].filter((thing): thing is boolean => thing !== null) >foos : Symbol(foos, Decl(booleanFilterAnyArray.ts, 22, 3), Decl(booleanFilterAnyArray.ts, 23, 3)) ->[true, true, false, null].filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>[true, true, false, null].filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >thing : Symbol(thing, Decl(booleanFilterAnyArray.ts, 23, 45)) >thing : Symbol(thing, Decl(booleanFilterAnyArray.ts, 23, 45)) >thing : Symbol(thing, Decl(booleanFilterAnyArray.ts, 23, 45)) diff --git a/tests/baselines/reference/booleanFilterAnyArray.types b/tests/baselines/reference/booleanFilterAnyArray.types index f84632e5b4028..c35c1bb352864 100644 --- a/tests/baselines/reference/booleanFilterAnyArray.types +++ b/tests/baselines/reference/booleanFilterAnyArray.types @@ -47,9 +47,9 @@ var ys: any[]; var ys = realanys.filter(Boolean) >ys : any[] >realanys.filter(Boolean) : any[] ->realanys.filter : { (predicate: (value: any, index: number, array: any[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): any[]; (predicate: (value: any, index: number, array: any[]) => unknown, thisArg?: any): any[]; } +>realanys.filter : { (predicate: (value: any, index: number, array: any[]) => value is S, thisArg?: any): S[]; (predicate: (value: any, index: number, array: any[]) => unknown, thisArg?: any): any[]; } >realanys : any[] ->filter : { (predicate: (value: any, index: number, array: any[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): any[]; (predicate: (value: any, index: number, array: any[]) => unknown, thisArg?: any): any[]; } +>filter : { (predicate: (value: any, index: number, array: any[]) => value is S, thisArg?: any): S[]; (predicate: (value: any, index: number, array: any[]) => unknown, thisArg?: any): any[]; } >Boolean : BooleanConstructor var foo = [{ name: 'x' }] @@ -66,9 +66,9 @@ var foor: Array<{name: string}> var foor = foo.filter(x => x.name) >foor : { name: string; }[] >foo.filter(x => x.name) : { name: string; }[] ->foo.filter : { (predicate: (value: { name: string; }, index: number, array: { name: string; }[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): { name: string; }[]; (predicate: (value: { name: string; }, index: number, array: { name: string; }[]) => unknown, thisArg?: any): { name: string; }[]; } +>foo.filter : { (predicate: (value: { name: string; }, index: number, array: { name: string; }[]) => value is S, thisArg?: any): S[]; (predicate: (value: { name: string; }, index: number, array: { name: string; }[]) => unknown, thisArg?: any): { name: string; }[]; } >foo : { name: string; }[] ->filter : { (predicate: (value: { name: string; }, index: number, array: { name: string; }[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): { name: string; }[]; (predicate: (value: { name: string; }, index: number, array: { name: string; }[]) => unknown, thisArg?: any): { name: string; }[]; } +>filter : { (predicate: (value: { name: string; }, index: number, array: { name: string; }[]) => value is S, thisArg?: any): S[]; (predicate: (value: { name: string; }, index: number, array: { name: string; }[]) => unknown, thisArg?: any): { name: string; }[]; } >x => x.name : (x: { name: string; }) => string >x : { name: string; } >x.name : string @@ -81,12 +81,12 @@ var foos: Array var foos = [true, true, false, null].filter((thing): thing is boolean => thing !== null) >foos : boolean[] >[true, true, false, null].filter((thing): thing is boolean => thing !== null) : boolean[] ->[true, true, false, null].filter : { (predicate: (value: boolean, index: number, array: boolean[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): true[]; (predicate: (value: boolean, index: number, array: boolean[]) => unknown, thisArg?: any): boolean[]; } +>[true, true, false, null].filter : { (predicate: (value: boolean, index: number, array: boolean[]) => value is S, thisArg?: any): S[]; (predicate: (value: boolean, index: number, array: boolean[]) => unknown, thisArg?: any): boolean[]; } >[true, true, false, null] : boolean[] >true : true >true : true >false : false ->filter : { (predicate: (value: boolean, index: number, array: boolean[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): true[]; (predicate: (value: boolean, index: number, array: boolean[]) => unknown, thisArg?: any): boolean[]; } +>filter : { (predicate: (value: boolean, index: number, array: boolean[]) => value is S, thisArg?: any): S[]; (predicate: (value: boolean, index: number, array: boolean[]) => unknown, thisArg?: any): boolean[]; } >(thing): thing is boolean => thing !== null : (thing: boolean) => thing is boolean >thing : boolean >thing !== null : boolean diff --git a/tests/baselines/reference/completionEntryForUnionMethod.baseline b/tests/baselines/reference/completionEntryForUnionMethod.baseline index 8dd798c410ea7..6ee4743746e23 100644 --- a/tests/baselines/reference/completionEntryForUnionMethod.baseline +++ b/tests/baselines/reference/completionEntryForUnionMethod.baseline @@ -4,28 +4,28 @@ // y.map( // ^^^ // | ---------------------------------------------------------------------- -// | (method) Array.concat(...items: ConcatArray[]): string[] | number[] (+1 overload) +// | (method) Array.concat(...items: ConcatArray[]): (string | number)[] (+1 overload) // | (method) Array.every(predicate: (value: string | number, index: number, array: (string | number)[]) => value is S, thisArg?: any): this is S[] (+1 overload) -// | (method) Array.filter(predicate: (value: string | number, index: number, array: (string | number)[]) => value is S, thisArg?: any): S[] (+2 overloads) -// | (method) Array.forEach(callbackfn: (value: string | number, index: number, array: (string | number)[]) => void, thisArg?: any): void -// | (method) Array.indexOf(searchElement: string | number, fromIndex?: number): number +// | (method) Array.filter(predicate: (value: string | number, index: number, array: (string | number)[]) => value is S, thisArg?: any): S[] (+1 overload) +// | (method) Array.forEach(callbackfn: ((value: string, index: number, array: string[]) => void) & ((value: number, index: number, array: number[]) => void), thisArg?: any): void +// | (method) Array.indexOf(searchElement: never, fromIndex?: number): number // | (method) Array.join(separator?: string): string -// | (method) Array.lastIndexOf(searchElement: string | number, fromIndex?: number): number +// | (method) Array.lastIndexOf(searchElement: never, fromIndex?: number): number // | (property) Array.length: number -// | (method) Array.map(callbackfn: (value: string | number, index: number, array: (string | number)[]) => unknown, thisArg?: any): unknown[] +// | (method) Array.map(callbackfn: ((value: string, index: number, array: string[]) => unknown) & ((value: number, index: number, array: number[]) => unknown), thisArg?: any): unknown[] // | (method) Array.pop(): string | number -// | (method) Array.push(...items: (string | number)[]): number +// | (method) Array.push(...items: never[]): number // | (method) Array.reduce(callbackfn: (previousValue: string | number, currentValue: string | number, currentIndex: number, array: (string | number)[]) => string | number): string | number (+2 overloads) // | (method) Array.reduceRight(callbackfn: (previousValue: string | number, currentValue: string | number, currentIndex: number, array: (string | number)[]) => string | number): string | number (+2 overloads) // | (method) Array.reverse(): string[] | number[] // | (method) Array.shift(): string | number // | (method) Array.slice(start?: number, end?: number): string[] | number[] -// | (method) Array.some(predicate: (value: string | number, index: number, array: (string | number)[]) => unknown, thisArg?: any): boolean -// | (method) Array.sort(compareFn?: (a: string | number, b: string | number) => number): string[] | number[] -// | (method) Array.splice(start: number, deleteCount?: number): string[] | number[] (+1 overload) +// | (method) Array.some(predicate: ((value: string, index: number, array: string[]) => unknown) & ((value: number, index: number, array: number[]) => unknown), thisArg?: any): boolean +// | (method) Array.sort(compareFn?: ((a: string, b: string) => number) & ((a: number, b: number) => number)): string[] | number[] +// | (method) Array.splice(start: number, deleteCount?: number): string[] | number[] (+2 overloads) // | (method) Array.toLocaleString(): string // | (method) Array.toString(): string -// | (method) Array.unshift(...items: (string | number)[]): number +// | (method) Array.unshift(...items: never[]): number // | ---------------------------------------------------------------------- [ @@ -164,16 +164,12 @@ "kind": "space" }, { - "text": "string", - "kind": "keyword" - }, - { - "text": "[", + "text": "(", "kind": "punctuation" }, { - "text": "]", - "kind": "punctuation" + "text": "string", + "kind": "keyword" }, { "text": " ", @@ -191,6 +187,10 @@ "text": "number", "kind": "keyword" }, + { + "text": ")", + "kind": "punctuation" + }, { "text": "[", "kind": "punctuation" @@ -911,7 +911,7 @@ "kind": "operator" }, { - "text": "2", + "text": "1", "kind": "numericLiteral" }, { @@ -919,7 +919,7 @@ "kind": "space" }, { - "text": "overloads", + "text": "overload", "kind": "text" }, { @@ -1036,6 +1036,10 @@ "text": "(", "kind": "punctuation" }, + { + "text": "(", + "kind": "punctuation" + }, { "text": "value", "kind": "parameterName" @@ -1052,12 +1056,20 @@ "text": "string", "kind": "keyword" }, + { + "text": ",", + "kind": "punctuation" + }, { "text": " ", "kind": "space" }, { - "text": "|", + "text": "index", + "kind": "parameterName" + }, + { + "text": ":", "kind": "punctuation" }, { @@ -1077,7 +1089,7 @@ "kind": "space" }, { - "text": "index", + "text": "array", "kind": "parameterName" }, { @@ -1089,11 +1101,19 @@ "kind": "space" }, { - "text": "number", + "text": "string", "kind": "keyword" }, { - "text": ",", + "text": "[", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": ")", "kind": "punctuation" }, { @@ -1101,11 +1121,27 @@ "kind": "space" }, { - "text": "array", - "kind": "parameterName" + "text": "=>", + "kind": "punctuation" }, { - "text": ":", + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "&", "kind": "punctuation" }, { @@ -1117,15 +1153,39 @@ "kind": "punctuation" }, { - "text": "string", + "text": "(", + "kind": "punctuation" + }, + { + "text": "value", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", "kind": "keyword" }, + { + "text": ",", + "kind": "punctuation" + }, { "text": " ", "kind": "space" }, { - "text": "|", + "text": "index", + "kind": "parameterName" + }, + { + "text": ":", "kind": "punctuation" }, { @@ -1137,9 +1197,29 @@ "kind": "keyword" }, { - "text": ")", + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "array", + "kind": "parameterName" + }, + { + "text": ":", "kind": "punctuation" }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, { "text": "[", "kind": "punctuation" @@ -1168,6 +1248,10 @@ "text": "void", "kind": "keyword" }, + { + "text": ")", + "kind": "punctuation" + }, { "text": ",", "kind": "punctuation" @@ -1319,23 +1403,7 @@ "kind": "space" }, { - "text": "string", - "kind": "keyword" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "|", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "number", + "text": "never", "kind": "keyword" }, { @@ -1602,23 +1670,7 @@ "kind": "space" }, { - "text": "string", - "kind": "keyword" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "|", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "number", + "text": "never", "kind": "keyword" }, { @@ -1853,6 +1905,10 @@ "text": "(", "kind": "punctuation" }, + { + "text": "(", + "kind": "punctuation" + }, { "text": "value", "kind": "parameterName" @@ -1869,12 +1925,20 @@ "text": "string", "kind": "keyword" }, + { + "text": ",", + "kind": "punctuation" + }, { "text": " ", "kind": "space" }, { - "text": "|", + "text": "index", + "kind": "parameterName" + }, + { + "text": ":", "kind": "punctuation" }, { @@ -1894,7 +1958,7 @@ "kind": "space" }, { - "text": "index", + "text": "array", "kind": "parameterName" }, { @@ -1906,11 +1970,19 @@ "kind": "space" }, { - "text": "number", + "text": "string", "kind": "keyword" }, { - "text": ",", + "text": "[", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": ")", "kind": "punctuation" }, { @@ -1918,11 +1990,27 @@ "kind": "space" }, { - "text": "array", - "kind": "parameterName" + "text": "=>", + "kind": "punctuation" }, { - "text": ":", + "text": " ", + "kind": "space" + }, + { + "text": "unknown", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "&", "kind": "punctuation" }, { @@ -1934,15 +2022,39 @@ "kind": "punctuation" }, { - "text": "string", + "text": "(", + "kind": "punctuation" + }, + { + "text": "value", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", "kind": "keyword" }, + { + "text": ",", + "kind": "punctuation" + }, { "text": " ", "kind": "space" }, { - "text": "|", + "text": "index", + "kind": "parameterName" + }, + { + "text": ":", "kind": "punctuation" }, { @@ -1954,9 +2066,29 @@ "kind": "keyword" }, { - "text": ")", + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "array", + "kind": "parameterName" + }, + { + "text": ":", "kind": "punctuation" }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, { "text": "[", "kind": "punctuation" @@ -1985,6 +2117,10 @@ "text": "unknown", "kind": "keyword" }, + { + "text": ")", + "kind": "punctuation" + }, { "text": ",", "kind": "punctuation" @@ -2238,33 +2374,9 @@ "kind": "space" }, { - "text": "(", - "kind": "punctuation" - }, - { - "text": "string", + "text": "never", "kind": "keyword" }, - { - "text": " ", - "kind": "space" - }, - { - "text": "|", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "number", - "kind": "keyword" - }, - { - "text": ")", - "kind": "punctuation" - }, { "text": "[", "kind": "punctuation" @@ -3484,6 +3596,10 @@ "text": "(", "kind": "punctuation" }, + { + "text": "(", + "kind": "punctuation" + }, { "text": "value", "kind": "parameterName" @@ -3500,12 +3616,20 @@ "text": "string", "kind": "keyword" }, + { + "text": ",", + "kind": "punctuation" + }, { "text": " ", "kind": "space" }, { - "text": "|", + "text": "index", + "kind": "parameterName" + }, + { + "text": ":", "kind": "punctuation" }, { @@ -3525,7 +3649,7 @@ "kind": "space" }, { - "text": "index", + "text": "array", "kind": "parameterName" }, { @@ -3537,11 +3661,19 @@ "kind": "space" }, { - "text": "number", + "text": "string", "kind": "keyword" }, { - "text": ",", + "text": "[", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": ")", "kind": "punctuation" }, { @@ -3549,11 +3681,27 @@ "kind": "space" }, { - "text": "array", - "kind": "parameterName" + "text": "=>", + "kind": "punctuation" }, { - "text": ":", + "text": " ", + "kind": "space" + }, + { + "text": "unknown", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "&", "kind": "punctuation" }, { @@ -3565,15 +3713,39 @@ "kind": "punctuation" }, { - "text": "string", + "text": "(", + "kind": "punctuation" + }, + { + "text": "value", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", "kind": "keyword" }, + { + "text": ",", + "kind": "punctuation" + }, { "text": " ", "kind": "space" }, { - "text": "|", + "text": "index", + "kind": "parameterName" + }, + { + "text": ":", "kind": "punctuation" }, { @@ -3585,9 +3757,29 @@ "kind": "keyword" }, { - "text": ")", + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "array", + "kind": "parameterName" + }, + { + "text": ":", "kind": "punctuation" }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, { "text": "[", "kind": "punctuation" @@ -3616,6 +3808,10 @@ "text": "unknown", "kind": "keyword" }, + { + "text": ")", + "kind": "punctuation" + }, { "text": ",", "kind": "punctuation" @@ -3774,6 +3970,10 @@ "text": "(", "kind": "punctuation" }, + { + "text": "(", + "kind": "punctuation" + }, { "text": "a", "kind": "parameterName" @@ -3790,12 +3990,40 @@ "text": "string", "kind": "keyword" }, + { + "text": ",", + "kind": "punctuation" + }, { "text": " ", "kind": "space" }, { - "text": "|", + "text": "b", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", "kind": "punctuation" }, { @@ -3807,7 +4035,7 @@ "kind": "keyword" }, { - "text": ",", + "text": ")", "kind": "punctuation" }, { @@ -3815,7 +4043,23 @@ "kind": "space" }, { - "text": "b", + "text": "&", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "a", "kind": "parameterName" }, { @@ -3827,15 +4071,23 @@ "kind": "space" }, { - "text": "string", + "text": "number", "kind": "keyword" }, + { + "text": ",", + "kind": "punctuation" + }, { "text": " ", "kind": "space" }, { - "text": "|", + "text": "b", + "kind": "parameterName" + }, + { + "text": ":", "kind": "punctuation" }, { @@ -3870,6 +4122,10 @@ "text": ")", "kind": "punctuation" }, + { + "text": ")", + "kind": "punctuation" + }, { "text": ":", "kind": "punctuation" @@ -4096,7 +4352,7 @@ "kind": "operator" }, { - "text": "1", + "text": "2", "kind": "numericLiteral" }, { @@ -4104,7 +4360,7 @@ "kind": "space" }, { - "text": "overload", + "text": "overloads", "kind": "text" }, { @@ -4379,33 +4635,9 @@ "kind": "space" }, { - "text": "(", - "kind": "punctuation" - }, - { - "text": "string", - "kind": "keyword" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "|", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "number", + "text": "never", "kind": "keyword" }, - { - "text": ")", - "kind": "punctuation" - }, { "text": "[", "kind": "punctuation" diff --git a/tests/baselines/reference/contextuallyTypeAsyncFunctionReturnType.symbols b/tests/baselines/reference/contextuallyTypeAsyncFunctionReturnType.symbols index 4f334d893b9f2..9c905b48944c3 100644 --- a/tests/baselines/reference/contextuallyTypeAsyncFunctionReturnType.symbols +++ b/tests/baselines/reference/contextuallyTypeAsyncFunctionReturnType.symbols @@ -213,11 +213,11 @@ async function copyExtensions( fromExtensions >fromExtensions .filter((e) => !e.isApplicationScoped) .map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --)) ->fromExtensions .filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>fromExtensions .filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >fromExtensions : Symbol(fromExtensions, Decl(contextuallyTypeAsyncFunctionReturnType.ts, 74, 30)) .filter((e) => !e.isApplicationScoped) ->filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >e : Symbol(e, Decl(contextuallyTypeAsyncFunctionReturnType.ts, 80, 17)) >e.isApplicationScoped : Symbol(ILocalExtension.isApplicationScoped, Decl(contextuallyTypeAsyncFunctionReturnType.ts, 63, 27)) >e : Symbol(e, Decl(contextuallyTypeAsyncFunctionReturnType.ts, 80, 17)) diff --git a/tests/baselines/reference/contextuallyTypeAsyncFunctionReturnType.types b/tests/baselines/reference/contextuallyTypeAsyncFunctionReturnType.types index 5f2f9e50c5730..307d73e306a1d 100644 --- a/tests/baselines/reference/contextuallyTypeAsyncFunctionReturnType.types +++ b/tests/baselines/reference/contextuallyTypeAsyncFunctionReturnType.types @@ -211,11 +211,11 @@ async function copyExtensions( >fromExtensions .filter((e) => !e.isApplicationScoped) .map(async (e) => [e, await scanMetadata(e)]) : Promise<[ILocalExtension, Metadata]>[] >fromExtensions .filter((e) => !e.isApplicationScoped) .map : (callbackfn: (value: ILocalExtension, index: number, array: ILocalExtension[]) => U, thisArg?: any) => U[] >fromExtensions .filter((e) => !e.isApplicationScoped) : ILocalExtension[] ->fromExtensions .filter : { (predicate: (value: ILocalExtension, index: number, array: ILocalExtension[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): ILocalExtension[]; (predicate: (value: ILocalExtension, index: number, array: ILocalExtension[]) => unknown, thisArg?: any): ILocalExtension[]; } +>fromExtensions .filter : { (predicate: (value: ILocalExtension, index: number, array: ILocalExtension[]) => value is S, thisArg?: any): S[]; (predicate: (value: ILocalExtension, index: number, array: ILocalExtension[]) => unknown, thisArg?: any): ILocalExtension[]; } >fromExtensions : ILocalExtension[] .filter((e) => !e.isApplicationScoped) ->filter : { (predicate: (value: ILocalExtension, index: number, array: ILocalExtension[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): ILocalExtension[]; (predicate: (value: ILocalExtension, index: number, array: ILocalExtension[]) => unknown, thisArg?: any): ILocalExtension[]; } +>filter : { (predicate: (value: ILocalExtension, index: number, array: ILocalExtension[]) => value is S, thisArg?: any): S[]; (predicate: (value: ILocalExtension, index: number, array: ILocalExtension[]) => unknown, thisArg?: any): ILocalExtension[]; } >(e) => !e.isApplicationScoped : (e: ILocalExtension) => boolean >e : ILocalExtension >!e.isApplicationScoped : boolean diff --git a/tests/baselines/reference/controlFlowArrayErrors.errors.txt b/tests/baselines/reference/controlFlowArrayErrors.errors.txt index c376d0720914d..3d12bfb05b7e1 100644 --- a/tests/baselines/reference/controlFlowArrayErrors.errors.txt +++ b/tests/baselines/reference/controlFlowArrayErrors.errors.txt @@ -6,12 +6,13 @@ controlFlowArrayErrors.ts(19,9): error TS7034: Variable 'x' implicitly has type controlFlowArrayErrors.ts(22,9): error TS7005: Variable 'x' implicitly has an 'any[]' type. controlFlowArrayErrors.ts(29,12): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string | number'. controlFlowArrayErrors.ts(34,12): error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'string | number'. +controlFlowArrayErrors.ts(48,12): error TS2345: Argument of type 'number' is not assignable to parameter of type 'never'. controlFlowArrayErrors.ts(56,12): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. controlFlowArrayErrors.ts(60,11): error TS7034: Variable 'x' implicitly has type 'any[]' in some locations where its type cannot be determined. controlFlowArrayErrors.ts(63,9): error TS7005: Variable 'x' implicitly has an 'any[]' type. -==== controlFlowArrayErrors.ts (11 errors) ==== +==== controlFlowArrayErrors.ts (12 errors) ==== declare function cond(): boolean; function f1() { @@ -76,6 +77,8 @@ controlFlowArrayErrors.ts(63,9): error TS7005: Variable 'x' implicitly has an 'a } x; // boolean[] | (string | number)[] x.push(99); // Error + ~~ +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'never'. } function f7() { diff --git a/tests/baselines/reference/declarationEmitPromise.symbols b/tests/baselines/reference/declarationEmitPromise.symbols index addaa534d0901..a0fe7bd5df6c1 100644 --- a/tests/baselines/reference/declarationEmitPromise.symbols +++ b/tests/baselines/reference/declarationEmitPromise.symbols @@ -41,13 +41,13 @@ export async function runSampleWorks( >bluebird.all : Symbol(bluebird.all, Decl(declarationEmitPromise.ts, 0, 26)) >bluebird : Symbol(bluebird, Decl(declarationEmitPromise.ts, 0, 0)) >all : Symbol(bluebird.all, Decl(declarationEmitPromise.ts, 0, 26)) ->[a, b, c, d, e].filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>[a, b, c, d, e].filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >a : Symbol(a, Decl(declarationEmitPromise.ts, 4, 52)) >b : Symbol(b, Decl(declarationEmitPromise.ts, 5, 19)) >c : Symbol(c, Decl(declarationEmitPromise.ts, 5, 36)) >d : Symbol(d, Decl(declarationEmitPromise.ts, 5, 53)) >e : Symbol(e, Decl(declarationEmitPromise.ts, 5, 70)) ->filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >el : Symbol(el, Decl(declarationEmitPromise.ts, 6, 68)) >el : Symbol(el, Decl(declarationEmitPromise.ts, 6, 68)) @@ -113,13 +113,13 @@ export async function runSampleBreaks( >bluebird.all : Symbol(bluebird.all, Decl(declarationEmitPromise.ts, 0, 26)) >bluebird : Symbol(bluebird, Decl(declarationEmitPromise.ts, 0, 0)) >all : Symbol(bluebird.all, Decl(declarationEmitPromise.ts, 0, 26)) ->[a, b, c, d, e].filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>[a, b, c, d, e].filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >a : Symbol(a, Decl(declarationEmitPromise.ts, 13, 53)) >b : Symbol(b, Decl(declarationEmitPromise.ts, 14, 19)) >c : Symbol(c, Decl(declarationEmitPromise.ts, 14, 36)) >d : Symbol(d, Decl(declarationEmitPromise.ts, 14, 53)) >e : Symbol(e, Decl(declarationEmitPromise.ts, 14, 70)) ->filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >el : Symbol(el, Decl(declarationEmitPromise.ts, 15, 68)) >el : Symbol(el, Decl(declarationEmitPromise.ts, 15, 68)) diff --git a/tests/baselines/reference/declarationEmitPromise.types b/tests/baselines/reference/declarationEmitPromise.types index 406a90db08206..7df9d08793d5b 100644 --- a/tests/baselines/reference/declarationEmitPromise.types +++ b/tests/baselines/reference/declarationEmitPromise.types @@ -28,14 +28,14 @@ export async function runSampleWorks( >bluebird : typeof bluebird >all : bluebird[] >[a, b, c, d, e].filter(el => !!el) : bluebird[] ->[a, b, c, d, e].filter : { >(predicate: (value: bluebird, index: number, array: bluebird[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): bluebird[]; (predicate: (value: bluebird, index: number, array: bluebird[]) => unknown, thisArg?: any): bluebird[]; } +>[a, b, c, d, e].filter : { >(predicate: (value: bluebird, index: number, array: bluebird[]) => value is S, thisArg?: any): S[]; (predicate: (value: bluebird, index: number, array: bluebird[]) => unknown, thisArg?: any): bluebird[]; } >[a, b, c, d, e] : bluebird[] >a : bluebird >b : bluebird >c : bluebird >d : bluebird >e : bluebird ->filter : { >(predicate: (value: bluebird, index: number, array: bluebird[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): bluebird[]; (predicate: (value: bluebird, index: number, array: bluebird[]) => unknown, thisArg?: any): bluebird[]; } +>filter : { >(predicate: (value: bluebird, index: number, array: bluebird[]) => value is S, thisArg?: any): S[]; (predicate: (value: bluebird, index: number, array: bluebird[]) => unknown, thisArg?: any): bluebird[]; } >el => !!el : (el: bluebird) => boolean >el : bluebird >!!el : boolean @@ -90,14 +90,14 @@ export async function runSampleBreaks( >bluebird : typeof bluebird >all : bluebird[] >[a, b, c, d, e].filter(el => !!el) : bluebird[] ->[a, b, c, d, e].filter : { >(predicate: (value: bluebird, index: number, array: bluebird[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): bluebird[]; (predicate: (value: bluebird, index: number, array: bluebird[]) => unknown, thisArg?: any): bluebird[]; } +>[a, b, c, d, e].filter : { >(predicate: (value: bluebird, index: number, array: bluebird[]) => value is S, thisArg?: any): S[]; (predicate: (value: bluebird, index: number, array: bluebird[]) => unknown, thisArg?: any): bluebird[]; } >[a, b, c, d, e] : bluebird[] >a : bluebird >b : bluebird >c : bluebird >d : bluebird >e : bluebird ->filter : { >(predicate: (value: bluebird, index: number, array: bluebird[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): bluebird[]; (predicate: (value: bluebird, index: number, array: bluebird[]) => unknown, thisArg?: any): bluebird[]; } +>filter : { >(predicate: (value: bluebird, index: number, array: bluebird[]) => value is S, thisArg?: any): S[]; (predicate: (value: bluebird, index: number, array: bluebird[]) => unknown, thisArg?: any): bluebird[]; } >el => !!el : (el: bluebird) => boolean >el : bluebird >!!el : boolean diff --git a/tests/baselines/reference/genericContextualTypes1.symbols b/tests/baselines/reference/genericContextualTypes1.symbols index ac3ac0a694a71..21cfc75455314 100644 --- a/tests/baselines/reference/genericContextualTypes1.symbols +++ b/tests/baselines/reference/genericContextualTypes1.symbols @@ -224,9 +224,9 @@ const arrayFilter = (f: (x: T) => boolean) => (a: T[]) => a.filter(f); >T : Symbol(T, Decl(genericContextualTypes1.ts, 33, 21)) >a : Symbol(a, Decl(genericContextualTypes1.ts, 33, 50)) >T : Symbol(T, Decl(genericContextualTypes1.ts, 33, 21)) ->a.filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>a.filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >a : Symbol(a, Decl(genericContextualTypes1.ts, 33, 50)) ->filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >f : Symbol(f, Decl(genericContextualTypes1.ts, 33, 24)) const f20: (a: string[]) => number[] = arrayMap(x => x.length); diff --git a/tests/baselines/reference/genericContextualTypes1.types b/tests/baselines/reference/genericContextualTypes1.types index 08935f8fdb525..32420da7d5490 100644 --- a/tests/baselines/reference/genericContextualTypes1.types +++ b/tests/baselines/reference/genericContextualTypes1.types @@ -157,9 +157,9 @@ const arrayFilter = (f: (x: T) => boolean) => (a: T[]) => a.filter(f); >(a: T[]) => a.filter(f) : (a: T[]) => T[] >a : T[] >a.filter(f) : T[] ->a.filter : { (predicate: (value: T, index: number, array: T[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): (T extends false | "" | 0 | 0n | null | undefined ? never : T)[]; (predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): T[]; } +>a.filter : { (predicate: (value: T, index: number, array: T[]) => value is S, thisArg?: any): S[]; (predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): T[]; } >a : T[] ->filter : { (predicate: (value: T, index: number, array: T[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): (T extends false | "" | 0 | 0n | null | undefined ? never : T)[]; (predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): T[]; } +>filter : { (predicate: (value: T, index: number, array: T[]) => value is S, thisArg?: any): S[]; (predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): T[]; } >f : (x: T) => boolean const f20: (a: string[]) => number[] = arrayMap(x => x.length); diff --git a/tests/baselines/reference/genericMethodOverspecialization.symbols b/tests/baselines/reference/genericMethodOverspecialization.symbols index 9248039eab8da..d1a61078b06d0 100644 --- a/tests/baselines/reference/genericMethodOverspecialization.symbols +++ b/tests/baselines/reference/genericMethodOverspecialization.symbols @@ -45,9 +45,9 @@ var elements = names.map(function (name) { var xxx = elements.filter(function (e) { >xxx : Symbol(xxx, Decl(genericMethodOverspecialization.ts, 17, 3)) ->elements.filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>elements.filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >elements : Symbol(elements, Decl(genericMethodOverspecialization.ts, 12, 3)) ->filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >e : Symbol(e, Decl(genericMethodOverspecialization.ts, 17, 36)) return !e.isDisabled; diff --git a/tests/baselines/reference/genericMethodOverspecialization.types b/tests/baselines/reference/genericMethodOverspecialization.types index 342facb044165..cef0476013572 100644 --- a/tests/baselines/reference/genericMethodOverspecialization.types +++ b/tests/baselines/reference/genericMethodOverspecialization.types @@ -49,9 +49,9 @@ var elements = names.map(function (name) { var xxx = elements.filter(function (e) { >xxx : HTMLElement[] >elements.filter(function (e) { return !e.isDisabled;}) : HTMLElement[] ->elements.filter : { (predicate: (value: HTMLElement, index: number, array: HTMLElement[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): HTMLElement[]; (predicate: (value: HTMLElement, index: number, array: HTMLElement[]) => unknown, thisArg?: any): HTMLElement[]; } +>elements.filter : { (predicate: (value: HTMLElement, index: number, array: HTMLElement[]) => value is S, thisArg?: any): S[]; (predicate: (value: HTMLElement, index: number, array: HTMLElement[]) => unknown, thisArg?: any): HTMLElement[]; } >elements : HTMLElement[] ->filter : { (predicate: (value: HTMLElement, index: number, array: HTMLElement[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): HTMLElement[]; (predicate: (value: HTMLElement, index: number, array: HTMLElement[]) => unknown, thisArg?: any): HTMLElement[]; } +>filter : { (predicate: (value: HTMLElement, index: number, array: HTMLElement[]) => value is S, thisArg?: any): S[]; (predicate: (value: HTMLElement, index: number, array: HTMLElement[]) => unknown, thisArg?: any): HTMLElement[]; } >function (e) { return !e.isDisabled;} : (e: HTMLElement) => boolean >e : HTMLElement diff --git a/tests/baselines/reference/goToTypeDefinition_arrayType.baseline.jsonc b/tests/baselines/reference/goToTypeDefinition_arrayType.baseline.jsonc index b7d6ff79f9b5f..1dc5b63951e85 100644 --- a/tests/baselines/reference/goToTypeDefinition_arrayType.baseline.jsonc +++ b/tests/baselines/reference/goToTypeDefinition_arrayType.baseline.jsonc @@ -162,12 +162,6 @@ // */ // filter(predicate: (value: T, index: number, array: T[]) => value is S, thisArg?: any): S[]; // /** -// * Returns the non-Falsy elements of an array -// * @param predicate Must be exactly "Boolean" -// * @param thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value. -// */ -// filter(predicate: BooleanConstructor, thisArg?: any): (T extends false | 0 | "" | null | undefined | 0n ? never : T)[]; -// /** // * Returns the elements of an array that meet the condition specified in a callback function. // * @param predicate A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array. // * @param thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value. @@ -421,12 +415,6 @@ // */ // filter(predicate: (value: T, index: number, array: T[]) => value is S, thisArg?: any): S[]; // /** -// * Returns the non-Falsy elements of an array -// * @param predicate Must be exactly "Boolean" -// * @param thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value. -// */ -// filter(predicate: BooleanConstructor, thisArg?: any): (T extends false | 0 | "" | null | undefined | 0n ? never : T)[]; -// /** // * Returns the elements of an array that meet the condition specified in a callback function. // * @param predicate A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array. // * @param thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value. diff --git a/tests/baselines/reference/implementArrayInterface.errors.txt b/tests/baselines/reference/implementArrayInterface.errors.txt deleted file mode 100644 index 301ffa82d715d..0000000000000 --- a/tests/baselines/reference/implementArrayInterface.errors.txt +++ /dev/null @@ -1,45 +0,0 @@ -implementArrayInterface.ts(23,5): error TS2416: Property 'filter' in type 'MyArray' is not assignable to the same property in base type 'T[]'. - Type '(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any) => T[]' is not assignable to type '{ (predicate: (value: T, index: number, array: T[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): (T extends false | "" | 0 | 0n ? never : T)[]; (predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): T[]; }'. - Type 'T[]' is not assignable to type '(T extends false | "" | 0 | 0n ? never : T)[]'. - Type 'T' is not assignable to type 'T extends false | "" | 0 | 0n ? never : T'. - - -==== implementArrayInterface.ts (1 errors) ==== - declare class MyArray implements Array { - toString(): string; - toLocaleString(): string; - concat(...items: U[]): T[]; - concat(...items: T[]): T[]; - join(separator?: string): string; - pop(): T; - push(...items: T[]): number; - reverse(): T[]; - shift(): T; - slice(start?: number, end?: number): T[]; - sort(compareFn?: (a: T, b: T) => number): this; - splice(start: number): T[]; - splice(start: number, deleteCount: number, ...items: T[]): T[]; - unshift(...items: T[]): number; - - indexOf(searchElement: T, fromIndex?: number): number; - lastIndexOf(searchElement: T, fromIndex?: number): number; - every(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; - some(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; - forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; - map(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; - filter(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): T[]; - ~~~~~~ -!!! error TS2416: Property 'filter' in type 'MyArray' is not assignable to the same property in base type 'T[]'. -!!! error TS2416: Type '(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any) => T[]' is not assignable to type '{ (predicate: (value: T, index: number, array: T[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): (T extends false | "" | 0 | 0n ? never : T)[]; (predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): T[]; }'. -!!! error TS2416: Type 'T[]' is not assignable to type '(T extends false | "" | 0 | 0n ? never : T)[]'. -!!! error TS2416: Type 'T' is not assignable to type 'T extends false | "" | 0 | 0n ? never : T'. - reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; - reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; - reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; - reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; - - length: number; - - [n: number]: T; - } - \ No newline at end of file diff --git a/tests/baselines/reference/mappedTypeAsClauses.types b/tests/baselines/reference/mappedTypeAsClauses.types index 6fec304b4a0b4..f92414a60d1fa 100644 --- a/tests/baselines/reference/mappedTypeAsClauses.types +++ b/tests/baselines/reference/mappedTypeAsClauses.types @@ -35,10 +35,10 @@ type TP1 = TypeFromDefs<{ name: 'a', type: string } | { name: 'b', type: number // No array or tuple type mapping when 'as N' clause present type TA1 = Getters; ->TA1 : { getConcat: () => { (...items: ConcatArray[]): string[]; (...items: (string | ConcatArray)[]): string[]; }; getIndexOf: () => (searchElement: string, fromIndex?: number | undefined) => number; getLastIndexOf: () => (searchElement: string, fromIndex?: number | undefined) => number; getSlice: () => (start?: number | undefined, end?: number | undefined) => string[]; getLength: () => number; getToString: () => () => string; getToLocaleString: () => () => string; getPop: () => () => string | undefined; getPush: () => (...items: string[]) => number; getJoin: () => (separator?: string | undefined) => string; getReverse: () => () => string[]; getShift: () => () => string | undefined; getSort: () => (compareFn?: ((a: string, b: string) => number) | undefined) => string[]; getSplice: () => { (start: number, deleteCount?: number | undefined): string[]; (start: number, deleteCount: number, ...items: string[]): string[]; }; getUnshift: () => (...items: string[]) => number; getEvery: () => { (predicate: (value: string, index: number, array: string[]) => value is S, thisArg?: any): this is S[]; (predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): boolean; }; getSome: () => (predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any) => boolean; getForEach: () => (callbackfn: (value: string, index: number, array: string[]) => void, thisArg?: any) => void; getMap: () => (callbackfn: (value: string, index: number, array: string[]) => U, thisArg?: any) => U[]; getFilter: () => { (predicate: (value: string, index: number, array: string[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): string[]; (predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): string[]; }; getReduce: () => { (callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string): string; (callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string, initialValue: string): string; (callbackfn: (previousValue: U, currentValue: string, currentIndex: number, array: string[]) => U, initialValue: U): U; }; getReduceRight: () => { (callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string): string; (callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string, initialValue: string): string; (callbackfn: (previousValue: U, currentValue: string, currentIndex: number, array: string[]) => U, initialValue: U): U; }; } +>TA1 : { getConcat: () => { (...items: ConcatArray[]): string[]; (...items: (string | ConcatArray)[]): string[]; }; getIndexOf: () => (searchElement: string, fromIndex?: number | undefined) => number; getLastIndexOf: () => (searchElement: string, fromIndex?: number | undefined) => number; getSlice: () => (start?: number | undefined, end?: number | undefined) => string[]; getLength: () => number; getToString: () => () => string; getToLocaleString: () => () => string; getPop: () => () => string | undefined; getPush: () => (...items: string[]) => number; getJoin: () => (separator?: string | undefined) => string; getReverse: () => () => string[]; getShift: () => () => string | undefined; getSort: () => (compareFn?: ((a: string, b: string) => number) | undefined) => string[]; getSplice: () => { (start: number, deleteCount?: number | undefined): string[]; (start: number, deleteCount: number, ...items: string[]): string[]; }; getUnshift: () => (...items: string[]) => number; getEvery: () => { (predicate: (value: string, index: number, array: string[]) => value is S, thisArg?: any): this is S[]; (predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): boolean; }; getSome: () => (predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any) => boolean; getForEach: () => (callbackfn: (value: string, index: number, array: string[]) => void, thisArg?: any) => void; getMap: () => (callbackfn: (value: string, index: number, array: string[]) => U, thisArg?: any) => U[]; getFilter: () => { (predicate: (value: string, index: number, array: string[]) => value is S, thisArg?: any): S[]; (predicate: (value: string, index: number, array: string[]) => unknown, thisArg?: any): string[]; }; getReduce: () => { (callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string): string; (callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string, initialValue: string): string; (callbackfn: (previousValue: U, currentValue: string, currentIndex: number, array: string[]) => U, initialValue: U): U; }; getReduceRight: () => { (callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string): string; (callbackfn: (previousValue: string, currentValue: string, currentIndex: number, array: string[]) => string, initialValue: string): string; (callbackfn: (previousValue: U, currentValue: string, currentIndex: number, array: string[]) => U, initialValue: U): U; }; } type TA2 = Getters<[number, boolean]>; ->TA2 : { getConcat: () => { (...items: ConcatArray[]): (number | boolean)[]; (...items: (number | boolean | ConcatArray)[]): (number | boolean)[]; }; getIndexOf: () => (searchElement: number | boolean, fromIndex?: number | undefined) => number; getLastIndexOf: () => (searchElement: number | boolean, fromIndex?: number | undefined) => number; getSlice: () => (start?: number | undefined, end?: number | undefined) => (number | boolean)[]; getLength: () => 2; getToString: () => () => string; getToLocaleString: () => () => string; getPop: () => () => number | boolean | undefined; getPush: () => (...items: (number | boolean)[]) => number; getJoin: () => (separator?: string | undefined) => string; getReverse: () => () => (number | boolean)[]; getShift: () => () => number | boolean | undefined; getSort: () => (compareFn?: ((a: number | boolean, b: number | boolean) => number) | undefined) => [number, boolean]; getSplice: () => { (start: number, deleteCount?: number | undefined): (number | boolean)[]; (start: number, deleteCount: number, ...items: (number | boolean)[]): (number | boolean)[]; }; getUnshift: () => (...items: (number | boolean)[]) => number; getEvery: () => { (predicate: (value: number | boolean, index: number, array: (number | boolean)[]) => value is S, thisArg?: any): this is S[]; (predicate: (value: number | boolean, index: number, array: (number | boolean)[]) => unknown, thisArg?: any): boolean; }; getSome: () => (predicate: (value: number | boolean, index: number, array: (number | boolean)[]) => unknown, thisArg?: any) => boolean; getForEach: () => (callbackfn: (value: number | boolean, index: number, array: (number | boolean)[]) => void, thisArg?: any) => void; getMap: () => (callbackfn: (value: number | boolean, index: number, array: (number | boolean)[]) => U, thisArg?: any) => U[]; getFilter: () => { (predicate: (value: number | boolean, index: number, array: (number | boolean)[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): (number | true)[]; (predicate: (value: number | boolean, index: number, array: (number | boolean)[]) => unknown, thisArg?: any): (number | boolean)[]; }; getReduce: () => { (callbackfn: (previousValue: number | boolean, currentValue: number | boolean, currentIndex: number, array: (number | boolean)[]) => number | boolean): number | boolean; (callbackfn: (previousValue: number | boolean, currentValue: number | boolean, currentIndex: number, array: (number | boolean)[]) => number | boolean, initialValue: number | boolean): number | boolean; (callbackfn: (previousValue: U, currentValue: number | boolean, currentIndex: number, array: (number | boolean)[]) => U, initialValue: U): U; }; getReduceRight: () => { (callbackfn: (previousValue: number | boolean, currentValue: number | boolean, currentIndex: number, array: (number | boolean)[]) => number | boolean): number | boolean; (callbackfn: (previousValue: number | boolean, currentValue: number | boolean, currentIndex: number, array: (number | boolean)[]) => number | boolean, initialValue: number | boolean): number | boolean; (callbackfn: (previousValue: U, currentValue: number | boolean, currentIndex: number, array: (number | boolean)[]) => U, initialValue: U): U; }; get0: () => number; get1: () => boolean; } +>TA2 : { getConcat: () => { (...items: ConcatArray[]): (number | boolean)[]; (...items: (number | boolean | ConcatArray)[]): (number | boolean)[]; }; getIndexOf: () => (searchElement: number | boolean, fromIndex?: number | undefined) => number; getLastIndexOf: () => (searchElement: number | boolean, fromIndex?: number | undefined) => number; getSlice: () => (start?: number | undefined, end?: number | undefined) => (number | boolean)[]; getLength: () => 2; getToString: () => () => string; getToLocaleString: () => () => string; getPop: () => () => number | boolean | undefined; getPush: () => (...items: (number | boolean)[]) => number; getJoin: () => (separator?: string | undefined) => string; getReverse: () => () => (number | boolean)[]; getShift: () => () => number | boolean | undefined; getSort: () => (compareFn?: ((a: number | boolean, b: number | boolean) => number) | undefined) => [number, boolean]; getSplice: () => { (start: number, deleteCount?: number | undefined): (number | boolean)[]; (start: number, deleteCount: number, ...items: (number | boolean)[]): (number | boolean)[]; }; getUnshift: () => (...items: (number | boolean)[]) => number; getEvery: () => { (predicate: (value: number | boolean, index: number, array: (number | boolean)[]) => value is S, thisArg?: any): this is S[]; (predicate: (value: number | boolean, index: number, array: (number | boolean)[]) => unknown, thisArg?: any): boolean; }; getSome: () => (predicate: (value: number | boolean, index: number, array: (number | boolean)[]) => unknown, thisArg?: any) => boolean; getForEach: () => (callbackfn: (value: number | boolean, index: number, array: (number | boolean)[]) => void, thisArg?: any) => void; getMap: () => (callbackfn: (value: number | boolean, index: number, array: (number | boolean)[]) => U, thisArg?: any) => U[]; getFilter: () => { (predicate: (value: number | boolean, index: number, array: (number | boolean)[]) => value is S, thisArg?: any): S[]; (predicate: (value: number | boolean, index: number, array: (number | boolean)[]) => unknown, thisArg?: any): (number | boolean)[]; }; getReduce: () => { (callbackfn: (previousValue: number | boolean, currentValue: number | boolean, currentIndex: number, array: (number | boolean)[]) => number | boolean): number | boolean; (callbackfn: (previousValue: number | boolean, currentValue: number | boolean, currentIndex: number, array: (number | boolean)[]) => number | boolean, initialValue: number | boolean): number | boolean; (callbackfn: (previousValue: U, currentValue: number | boolean, currentIndex: number, array: (number | boolean)[]) => U, initialValue: U): U; }; getReduceRight: () => { (callbackfn: (previousValue: number | boolean, currentValue: number | boolean, currentIndex: number, array: (number | boolean)[]) => number | boolean): number | boolean; (callbackfn: (previousValue: number | boolean, currentValue: number | boolean, currentIndex: number, array: (number | boolean)[]) => number | boolean, initialValue: number | boolean): number | boolean; (callbackfn: (previousValue: U, currentValue: number | boolean, currentIndex: number, array: (number | boolean)[]) => U, initialValue: U): U; }; get0: () => number; get1: () => boolean; } // Filtering using 'as N' clause diff --git a/tests/baselines/reference/mappedTypeWithAsClauseAndLateBoundProperty.errors.txt b/tests/baselines/reference/mappedTypeWithAsClauseAndLateBoundProperty.errors.txt index 153fda4db192e..6dac97e6c4f8e 100644 --- a/tests/baselines/reference/mappedTypeWithAsClauseAndLateBoundProperty.errors.txt +++ b/tests/baselines/reference/mappedTypeWithAsClauseAndLateBoundProperty.errors.txt @@ -1,4 +1,4 @@ -mappedTypeWithAsClauseAndLateBoundProperty.ts(3,1): error TS2741: Property 'length' is missing in type '{ [x: number]: number; toString: () => string; toLocaleString: () => string; pop: () => number; push: (...items: number[]) => number; concat: { (...items: ConcatArray[]): number[]; (...items: (number | ConcatArray)[]): number[]; }; join: (separator?: string) => string; reverse: () => number[]; shift: () => number; slice: (start?: number, end?: number) => number[]; sort: (compareFn?: (a: number, b: number) => number) => number[]; splice: { (start: number, deleteCount?: number): number[]; (start: number, deleteCount: number, ...items: number[]): number[]; }; unshift: (...items: number[]) => number; indexOf: (searchElement: number, fromIndex?: number) => number; lastIndexOf: (searchElement: number, fromIndex?: number) => number; 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; }; some: (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any) => boolean; forEach: (callbackfn: (value: number, index: number, array: number[]) => void, thisArg?: any) => void; map: (callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[]; filter: { (predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): number[]; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): number[]; }; reduce: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; reduceRight: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; find: { (predicate: (value: number, index: number, obj: number[]) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any): number; }; findIndex: (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any) => number; fill: (value: number, start?: number, end?: number) => number[]; copyWithin: (target: number, start: number, end?: number) => number[]; entries: () => IterableIterator<[number, number]>; keys: () => IterableIterator; values: () => IterableIterator; includes: (searchElement: number, fromIndex?: number) => boolean; flatMap: (callback: (this: This, value: number, index: number, array: number[]) => U | readonly U[], thisArg?: This) => U[]; flat: (this: A, depth?: D) => FlatArray[]; [Symbol.iterator]: () => IterableIterator; readonly [Symbol.unscopables]: { [x: number]: boolean; length?: boolean; toString?: boolean; toLocaleString?: boolean; pop?: boolean; push?: boolean; concat?: boolean; join?: boolean; reverse?: boolean; shift?: boolean; slice?: boolean; sort?: boolean; splice?: boolean; unshift?: boolean; indexOf?: boolean; lastIndexOf?: boolean; every?: boolean; some?: boolean; forEach?: boolean; map?: boolean; filter?: boolean; reduce?: boolean; reduceRight?: boolean; find?: boolean; findIndex?: boolean; fill?: boolean; copyWithin?: boolean; entries?: boolean; keys?: boolean; values?: boolean; includes?: boolean; flatMap?: boolean; flat?: boolean; [Symbol.iterator]?: boolean; readonly [Symbol.unscopables]?: boolean; }; }' but required in type 'number[]'. +mappedTypeWithAsClauseAndLateBoundProperty.ts(3,1): error TS2741: Property 'length' is missing in type '{ [x: number]: number; toString: () => string; toLocaleString: () => string; pop: () => number; push: (...items: number[]) => number; concat: { (...items: ConcatArray[]): number[]; (...items: (number | ConcatArray)[]): number[]; }; join: (separator?: string) => string; reverse: () => number[]; shift: () => number; slice: (start?: number, end?: number) => number[]; sort: (compareFn?: (a: number, b: number) => number) => number[]; splice: { (start: number, deleteCount?: number): number[]; (start: number, deleteCount: number, ...items: number[]): number[]; }; unshift: (...items: number[]) => number; indexOf: (searchElement: number, fromIndex?: number) => number; lastIndexOf: (searchElement: number, fromIndex?: number) => number; 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; }; some: (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any) => boolean; forEach: (callbackfn: (value: number, index: number, array: number[]) => void, thisArg?: any) => void; map: (callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[]; filter: { (predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): S[]; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): number[]; }; reduce: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; reduceRight: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; find: { (predicate: (value: number, index: number, obj: number[]) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any): number; }; findIndex: (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any) => number; fill: (value: number, start?: number, end?: number) => number[]; copyWithin: (target: number, start: number, end?: number) => number[]; entries: () => IterableIterator<[number, number]>; keys: () => IterableIterator; values: () => IterableIterator; includes: (searchElement: number, fromIndex?: number) => boolean; flatMap: (callback: (this: This, value: number, index: number, array: number[]) => U | readonly U[], thisArg?: This) => U[]; flat: (this: A, depth?: D) => FlatArray[]; [Symbol.iterator]: () => IterableIterator; readonly [Symbol.unscopables]: { [x: number]: boolean; length?: boolean; toString?: boolean; toLocaleString?: boolean; pop?: boolean; push?: boolean; concat?: boolean; join?: boolean; reverse?: boolean; shift?: boolean; slice?: boolean; sort?: boolean; splice?: boolean; unshift?: boolean; indexOf?: boolean; lastIndexOf?: boolean; every?: boolean; some?: boolean; forEach?: boolean; map?: boolean; filter?: boolean; reduce?: boolean; reduceRight?: boolean; find?: boolean; findIndex?: boolean; fill?: boolean; copyWithin?: boolean; entries?: boolean; keys?: boolean; values?: boolean; includes?: boolean; flatMap?: boolean; flat?: boolean; [Symbol.iterator]?: boolean; readonly [Symbol.unscopables]?: boolean; }; }' but required in type 'number[]'. ==== mappedTypeWithAsClauseAndLateBoundProperty.ts (1 errors) ==== @@ -6,6 +6,6 @@ mappedTypeWithAsClauseAndLateBoundProperty.ts(3,1): error TS2741: Property 'leng declare let src2: { [K in keyof number[] as Exclude]: (number[])[K] }; tgt2 = src2; // Should error ~~~~ -!!! error TS2741: Property 'length' is missing in type '{ [x: number]: number; toString: () => string; toLocaleString: () => string; pop: () => number; push: (...items: number[]) => number; concat: { (...items: ConcatArray[]): number[]; (...items: (number | ConcatArray)[]): number[]; }; join: (separator?: string) => string; reverse: () => number[]; shift: () => number; slice: (start?: number, end?: number) => number[]; sort: (compareFn?: (a: number, b: number) => number) => number[]; splice: { (start: number, deleteCount?: number): number[]; (start: number, deleteCount: number, ...items: number[]): number[]; }; unshift: (...items: number[]) => number; indexOf: (searchElement: number, fromIndex?: number) => number; lastIndexOf: (searchElement: number, fromIndex?: number) => number; 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; }; some: (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any) => boolean; forEach: (callbackfn: (value: number, index: number, array: number[]) => void, thisArg?: any) => void; map: (callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[]; filter: { (predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): number[]; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): number[]; }; reduce: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; reduceRight: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; find: { (predicate: (value: number, index: number, obj: number[]) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any): number; }; findIndex: (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any) => number; fill: (value: number, start?: number, end?: number) => number[]; copyWithin: (target: number, start: number, end?: number) => number[]; entries: () => IterableIterator<[number, number]>; keys: () => IterableIterator; values: () => IterableIterator; includes: (searchElement: number, fromIndex?: number) => boolean; flatMap: (callback: (this: This, value: number, index: number, array: number[]) => U | readonly U[], thisArg?: This) => U[]; flat: (this: A, depth?: D) => FlatArray[]; [Symbol.iterator]: () => IterableIterator; readonly [Symbol.unscopables]: { [x: number]: boolean; length?: boolean; toString?: boolean; toLocaleString?: boolean; pop?: boolean; push?: boolean; concat?: boolean; join?: boolean; reverse?: boolean; shift?: boolean; slice?: boolean; sort?: boolean; splice?: boolean; unshift?: boolean; indexOf?: boolean; lastIndexOf?: boolean; every?: boolean; some?: boolean; forEach?: boolean; map?: boolean; filter?: boolean; reduce?: boolean; reduceRight?: boolean; find?: boolean; findIndex?: boolean; fill?: boolean; copyWithin?: boolean; entries?: boolean; keys?: boolean; values?: boolean; includes?: boolean; flatMap?: boolean; flat?: boolean; [Symbol.iterator]?: boolean; readonly [Symbol.unscopables]?: boolean; }; }' but required in type 'number[]'. +!!! error TS2741: Property 'length' is missing in type '{ [x: number]: number; toString: () => string; toLocaleString: () => string; pop: () => number; push: (...items: number[]) => number; concat: { (...items: ConcatArray[]): number[]; (...items: (number | ConcatArray)[]): number[]; }; join: (separator?: string) => string; reverse: () => number[]; shift: () => number; slice: (start?: number, end?: number) => number[]; sort: (compareFn?: (a: number, b: number) => number) => number[]; splice: { (start: number, deleteCount?: number): number[]; (start: number, deleteCount: number, ...items: number[]): number[]; }; unshift: (...items: number[]) => number; indexOf: (searchElement: number, fromIndex?: number) => number; lastIndexOf: (searchElement: number, fromIndex?: number) => number; 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; }; some: (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any) => boolean; forEach: (callbackfn: (value: number, index: number, array: number[]) => void, thisArg?: any) => void; map: (callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[]; filter: { (predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): S[]; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): number[]; }; reduce: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; reduceRight: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; find: { (predicate: (value: number, index: number, obj: number[]) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any): number; }; findIndex: (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any) => number; fill: (value: number, start?: number, end?: number) => number[]; copyWithin: (target: number, start: number, end?: number) => number[]; entries: () => IterableIterator<[number, number]>; keys: () => IterableIterator; values: () => IterableIterator; includes: (searchElement: number, fromIndex?: number) => boolean; flatMap: (callback: (this: This, value: number, index: number, array: number[]) => U | readonly U[], thisArg?: This) => U[]; flat: (this: A, depth?: D) => FlatArray[]; [Symbol.iterator]: () => IterableIterator; readonly [Symbol.unscopables]: { [x: number]: boolean; length?: boolean; toString?: boolean; toLocaleString?: boolean; pop?: boolean; push?: boolean; concat?: boolean; join?: boolean; reverse?: boolean; shift?: boolean; slice?: boolean; sort?: boolean; splice?: boolean; unshift?: boolean; indexOf?: boolean; lastIndexOf?: boolean; every?: boolean; some?: boolean; forEach?: boolean; map?: boolean; filter?: boolean; reduce?: boolean; reduceRight?: boolean; find?: boolean; findIndex?: boolean; fill?: boolean; copyWithin?: boolean; entries?: boolean; keys?: boolean; values?: boolean; includes?: boolean; flatMap?: boolean; flat?: boolean; [Symbol.iterator]?: boolean; readonly [Symbol.unscopables]?: boolean; }; }' but required in type 'number[]'. !!! related TS2728 lib.es5.d.ts:--:--: 'length' is declared here. \ No newline at end of file diff --git a/tests/baselines/reference/mappedTypeWithAsClauseAndLateBoundProperty.types b/tests/baselines/reference/mappedTypeWithAsClauseAndLateBoundProperty.types index 6922672eeeb7d..c49cadf3bc2ce 100644 --- a/tests/baselines/reference/mappedTypeWithAsClauseAndLateBoundProperty.types +++ b/tests/baselines/reference/mappedTypeWithAsClauseAndLateBoundProperty.types @@ -5,10 +5,10 @@ declare let tgt2: number[]; >tgt2 : number[] declare let src2: { [K in keyof number[] as Exclude]: (number[])[K] }; ->src2 : { [x: number]: number; toString: () => string; toLocaleString: () => string; pop: () => number; push: (...items: number[]) => number; concat: { (...items: ConcatArray[]): number[]; (...items: (number | ConcatArray)[]): number[]; }; join: (separator?: string) => string; reverse: () => number[]; shift: () => number; slice: (start?: number, end?: number) => number[]; sort: (compareFn?: (a: number, b: number) => number) => number[]; splice: { (start: number, deleteCount?: number): number[]; (start: number, deleteCount: number, ...items: number[]): number[]; }; unshift: (...items: number[]) => number; indexOf: (searchElement: number, fromIndex?: number) => number; lastIndexOf: (searchElement: number, fromIndex?: number) => number; 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; }; some: (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any) => boolean; forEach: (callbackfn: (value: number, index: number, array: number[]) => void, thisArg?: any) => void; map: (callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[]; filter: { (predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): number[]; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): number[]; }; reduce: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; reduceRight: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; find: { (predicate: (value: number, index: number, obj: number[]) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any): number; }; findIndex: (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any) => number; fill: (value: number, start?: number, end?: number) => number[]; copyWithin: (target: number, start: number, end?: number) => number[]; entries: () => IterableIterator<[number, number]>; keys: () => IterableIterator; values: () => IterableIterator; includes: (searchElement: number, fromIndex?: number) => boolean; flatMap: (callback: (this: This, value: number, index: number, array: number[]) => U | readonly U[], thisArg?: This) => U[]; flat: (this: A, depth?: D) => FlatArray[]; [Symbol.iterator]: () => IterableIterator; readonly [Symbol.unscopables]: { [x: number]: boolean; length?: boolean; toString?: boolean; toLocaleString?: boolean; pop?: boolean; push?: boolean; concat?: boolean; join?: boolean; reverse?: boolean; shift?: boolean; slice?: boolean; sort?: boolean; splice?: boolean; unshift?: boolean; indexOf?: boolean; lastIndexOf?: boolean; every?: boolean; some?: boolean; forEach?: boolean; map?: boolean; filter?: boolean; reduce?: boolean; reduceRight?: boolean; find?: boolean; findIndex?: boolean; fill?: boolean; copyWithin?: boolean; entries?: boolean; keys?: boolean; values?: boolean; includes?: boolean; flatMap?: boolean; flat?: boolean; [Symbol.iterator]?: boolean; readonly [Symbol.unscopables]?: boolean; }; } +>src2 : { [x: number]: number; toString: () => string; toLocaleString: () => string; pop: () => number; push: (...items: number[]) => number; concat: { (...items: ConcatArray[]): number[]; (...items: (number | ConcatArray)[]): number[]; }; join: (separator?: string) => string; reverse: () => number[]; shift: () => number; slice: (start?: number, end?: number) => number[]; sort: (compareFn?: (a: number, b: number) => number) => number[]; splice: { (start: number, deleteCount?: number): number[]; (start: number, deleteCount: number, ...items: number[]): number[]; }; unshift: (...items: number[]) => number; indexOf: (searchElement: number, fromIndex?: number) => number; lastIndexOf: (searchElement: number, fromIndex?: number) => number; 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; }; some: (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any) => boolean; forEach: (callbackfn: (value: number, index: number, array: number[]) => void, thisArg?: any) => void; map: (callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[]; filter: { (predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): S[]; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): number[]; }; reduce: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; reduceRight: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; find: { (predicate: (value: number, index: number, obj: number[]) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any): number; }; findIndex: (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any) => number; fill: (value: number, start?: number, end?: number) => number[]; copyWithin: (target: number, start: number, end?: number) => number[]; entries: () => IterableIterator<[number, number]>; keys: () => IterableIterator; values: () => IterableIterator; includes: (searchElement: number, fromIndex?: number) => boolean; flatMap: (callback: (this: This, value: number, index: number, array: number[]) => U | readonly U[], thisArg?: This) => U[]; flat: (this: A, depth?: D) => FlatArray[]; [Symbol.iterator]: () => IterableIterator; readonly [Symbol.unscopables]: { [x: number]: boolean; length?: boolean; toString?: boolean; toLocaleString?: boolean; pop?: boolean; push?: boolean; concat?: boolean; join?: boolean; reverse?: boolean; shift?: boolean; slice?: boolean; sort?: boolean; splice?: boolean; unshift?: boolean; indexOf?: boolean; lastIndexOf?: boolean; every?: boolean; some?: boolean; forEach?: boolean; map?: boolean; filter?: boolean; reduce?: boolean; reduceRight?: boolean; find?: boolean; findIndex?: boolean; fill?: boolean; copyWithin?: boolean; entries?: boolean; keys?: boolean; values?: boolean; includes?: boolean; flatMap?: boolean; flat?: boolean; [Symbol.iterator]?: boolean; readonly [Symbol.unscopables]?: boolean; }; } tgt2 = src2; // Should error ->tgt2 = src2 : { [x: number]: number; toString: () => string; toLocaleString: () => string; pop: () => number; push: (...items: number[]) => number; concat: { (...items: ConcatArray[]): number[]; (...items: (number | ConcatArray)[]): number[]; }; join: (separator?: string) => string; reverse: () => number[]; shift: () => number; slice: (start?: number, end?: number) => number[]; sort: (compareFn?: (a: number, b: number) => number) => number[]; splice: { (start: number, deleteCount?: number): number[]; (start: number, deleteCount: number, ...items: number[]): number[]; }; unshift: (...items: number[]) => number; indexOf: (searchElement: number, fromIndex?: number) => number; lastIndexOf: (searchElement: number, fromIndex?: number) => number; 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; }; some: (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any) => boolean; forEach: (callbackfn: (value: number, index: number, array: number[]) => void, thisArg?: any) => void; map: (callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[]; filter: { (predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): number[]; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): number[]; }; reduce: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; reduceRight: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; find: { (predicate: (value: number, index: number, obj: number[]) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any): number; }; findIndex: (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any) => number; fill: (value: number, start?: number, end?: number) => number[]; copyWithin: (target: number, start: number, end?: number) => number[]; entries: () => IterableIterator<[number, number]>; keys: () => IterableIterator; values: () => IterableIterator; includes: (searchElement: number, fromIndex?: number) => boolean; flatMap: (callback: (this: This, value: number, index: number, array: number[]) => U | readonly U[], thisArg?: This) => U[]; flat: (this: A, depth?: D) => FlatArray[]; [Symbol.iterator]: () => IterableIterator; readonly [Symbol.unscopables]: { [x: number]: boolean; length?: boolean; toString?: boolean; toLocaleString?: boolean; pop?: boolean; push?: boolean; concat?: boolean; join?: boolean; reverse?: boolean; shift?: boolean; slice?: boolean; sort?: boolean; splice?: boolean; unshift?: boolean; indexOf?: boolean; lastIndexOf?: boolean; every?: boolean; some?: boolean; forEach?: boolean; map?: boolean; filter?: boolean; reduce?: boolean; reduceRight?: boolean; find?: boolean; findIndex?: boolean; fill?: boolean; copyWithin?: boolean; entries?: boolean; keys?: boolean; values?: boolean; includes?: boolean; flatMap?: boolean; flat?: boolean; [Symbol.iterator]?: boolean; readonly [Symbol.unscopables]?: boolean; }; } +>tgt2 = src2 : { [x: number]: number; toString: () => string; toLocaleString: () => string; pop: () => number; push: (...items: number[]) => number; concat: { (...items: ConcatArray[]): number[]; (...items: (number | ConcatArray)[]): number[]; }; join: (separator?: string) => string; reverse: () => number[]; shift: () => number; slice: (start?: number, end?: number) => number[]; sort: (compareFn?: (a: number, b: number) => number) => number[]; splice: { (start: number, deleteCount?: number): number[]; (start: number, deleteCount: number, ...items: number[]): number[]; }; unshift: (...items: number[]) => number; indexOf: (searchElement: number, fromIndex?: number) => number; lastIndexOf: (searchElement: number, fromIndex?: number) => number; 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; }; some: (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any) => boolean; forEach: (callbackfn: (value: number, index: number, array: number[]) => void, thisArg?: any) => void; map: (callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[]; filter: { (predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): S[]; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): number[]; }; reduce: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; reduceRight: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; find: { (predicate: (value: number, index: number, obj: number[]) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any): number; }; findIndex: (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any) => number; fill: (value: number, start?: number, end?: number) => number[]; copyWithin: (target: number, start: number, end?: number) => number[]; entries: () => IterableIterator<[number, number]>; keys: () => IterableIterator; values: () => IterableIterator; includes: (searchElement: number, fromIndex?: number) => boolean; flatMap: (callback: (this: This, value: number, index: number, array: number[]) => U | readonly U[], thisArg?: This) => U[]; flat: (this: A, depth?: D) => FlatArray[]; [Symbol.iterator]: () => IterableIterator; readonly [Symbol.unscopables]: { [x: number]: boolean; length?: boolean; toString?: boolean; toLocaleString?: boolean; pop?: boolean; push?: boolean; concat?: boolean; join?: boolean; reverse?: boolean; shift?: boolean; slice?: boolean; sort?: boolean; splice?: boolean; unshift?: boolean; indexOf?: boolean; lastIndexOf?: boolean; every?: boolean; some?: boolean; forEach?: boolean; map?: boolean; filter?: boolean; reduce?: boolean; reduceRight?: boolean; find?: boolean; findIndex?: boolean; fill?: boolean; copyWithin?: boolean; entries?: boolean; keys?: boolean; values?: boolean; includes?: boolean; flatMap?: boolean; flat?: boolean; [Symbol.iterator]?: boolean; readonly [Symbol.unscopables]?: boolean; }; } >tgt2 : number[] ->src2 : { [x: number]: number; toString: () => string; toLocaleString: () => string; pop: () => number; push: (...items: number[]) => number; concat: { (...items: ConcatArray[]): number[]; (...items: (number | ConcatArray)[]): number[]; }; join: (separator?: string) => string; reverse: () => number[]; shift: () => number; slice: (start?: number, end?: number) => number[]; sort: (compareFn?: (a: number, b: number) => number) => number[]; splice: { (start: number, deleteCount?: number): number[]; (start: number, deleteCount: number, ...items: number[]): number[]; }; unshift: (...items: number[]) => number; indexOf: (searchElement: number, fromIndex?: number) => number; lastIndexOf: (searchElement: number, fromIndex?: number) => number; 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; }; some: (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any) => boolean; forEach: (callbackfn: (value: number, index: number, array: number[]) => void, thisArg?: any) => void; map: (callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[]; filter: { (predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): number[]; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): number[]; }; reduce: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; reduceRight: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; find: { (predicate: (value: number, index: number, obj: number[]) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any): number; }; findIndex: (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any) => number; fill: (value: number, start?: number, end?: number) => number[]; copyWithin: (target: number, start: number, end?: number) => number[]; entries: () => IterableIterator<[number, number]>; keys: () => IterableIterator; values: () => IterableIterator; includes: (searchElement: number, fromIndex?: number) => boolean; flatMap: (callback: (this: This, value: number, index: number, array: number[]) => U | readonly U[], thisArg?: This) => U[]; flat: (this: A, depth?: D) => FlatArray[]; [Symbol.iterator]: () => IterableIterator; readonly [Symbol.unscopables]: { [x: number]: boolean; length?: boolean; toString?: boolean; toLocaleString?: boolean; pop?: boolean; push?: boolean; concat?: boolean; join?: boolean; reverse?: boolean; shift?: boolean; slice?: boolean; sort?: boolean; splice?: boolean; unshift?: boolean; indexOf?: boolean; lastIndexOf?: boolean; every?: boolean; some?: boolean; forEach?: boolean; map?: boolean; filter?: boolean; reduce?: boolean; reduceRight?: boolean; find?: boolean; findIndex?: boolean; fill?: boolean; copyWithin?: boolean; entries?: boolean; keys?: boolean; values?: boolean; includes?: boolean; flatMap?: boolean; flat?: boolean; [Symbol.iterator]?: boolean; readonly [Symbol.unscopables]?: boolean; }; } +>src2 : { [x: number]: number; toString: () => string; toLocaleString: () => string; pop: () => number; push: (...items: number[]) => number; concat: { (...items: ConcatArray[]): number[]; (...items: (number | ConcatArray)[]): number[]; }; join: (separator?: string) => string; reverse: () => number[]; shift: () => number; slice: (start?: number, end?: number) => number[]; sort: (compareFn?: (a: number, b: number) => number) => number[]; splice: { (start: number, deleteCount?: number): number[]; (start: number, deleteCount: number, ...items: number[]): number[]; }; unshift: (...items: number[]) => number; indexOf: (searchElement: number, fromIndex?: number) => number; lastIndexOf: (searchElement: number, fromIndex?: number) => number; 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; }; some: (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any) => boolean; forEach: (callbackfn: (value: number, index: number, array: number[]) => void, thisArg?: any) => void; map: (callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[]; filter: { (predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): S[]; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): number[]; }; reduce: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; reduceRight: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; find: { (predicate: (value: number, index: number, obj: number[]) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any): number; }; findIndex: (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any) => number; fill: (value: number, start?: number, end?: number) => number[]; copyWithin: (target: number, start: number, end?: number) => number[]; entries: () => IterableIterator<[number, number]>; keys: () => IterableIterator; values: () => IterableIterator; includes: (searchElement: number, fromIndex?: number) => boolean; flatMap: (callback: (this: This, value: number, index: number, array: number[]) => U | readonly U[], thisArg?: This) => U[]; flat: (this: A, depth?: D) => FlatArray[]; [Symbol.iterator]: () => IterableIterator; readonly [Symbol.unscopables]: { [x: number]: boolean; length?: boolean; toString?: boolean; toLocaleString?: boolean; pop?: boolean; push?: boolean; concat?: boolean; join?: boolean; reverse?: boolean; shift?: boolean; slice?: boolean; sort?: boolean; splice?: boolean; unshift?: boolean; indexOf?: boolean; lastIndexOf?: boolean; every?: boolean; some?: boolean; forEach?: boolean; map?: boolean; filter?: boolean; reduce?: boolean; reduceRight?: boolean; find?: boolean; findIndex?: boolean; fill?: boolean; copyWithin?: boolean; entries?: boolean; keys?: boolean; values?: boolean; includes?: boolean; flatMap?: boolean; flat?: boolean; [Symbol.iterator]?: boolean; readonly [Symbol.unscopables]?: boolean; }; } diff --git a/tests/baselines/reference/mappedTypeWithAsClauseAndLateBoundProperty2.js b/tests/baselines/reference/mappedTypeWithAsClauseAndLateBoundProperty2.js index 9f7005de7a32b..9bfc37222f9a8 100644 --- a/tests/baselines/reference/mappedTypeWithAsClauseAndLateBoundProperty2.js +++ b/tests/baselines/reference/mappedTypeWithAsClauseAndLateBoundProperty2.js @@ -40,7 +40,6 @@ export declare const thing: { map: (callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[]; filter: { (predicate: (value: number, index: number, array: number[]) => value is S_1, thisArg?: any): S_1[]; - (predicate: BooleanConstructor, thisArg?: any): number[]; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): number[]; }; reduce: { @@ -147,7 +146,6 @@ mappedTypeWithAsClauseAndLateBoundProperty2.d.ts(24,118): error TS2526: A 'this' map: (callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[]; filter: { (predicate: (value: number, index: number, array: number[]) => value is S_1, thisArg?: any): S_1[]; - (predicate: BooleanConstructor, thisArg?: any): number[]; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): number[]; }; reduce: { diff --git a/tests/baselines/reference/mappedTypeWithAsClauseAndLateBoundProperty2.types b/tests/baselines/reference/mappedTypeWithAsClauseAndLateBoundProperty2.types index 2b153b738d39a..242454d5d1543 100644 --- a/tests/baselines/reference/mappedTypeWithAsClauseAndLateBoundProperty2.types +++ b/tests/baselines/reference/mappedTypeWithAsClauseAndLateBoundProperty2.types @@ -2,8 +2,8 @@ === mappedTypeWithAsClauseAndLateBoundProperty2.ts === export const thing = (null as any as { [K in keyof number[] as Exclude]: (number[])[K] }); ->thing : { [x: number]: number; toString: () => string; toLocaleString: () => string; pop: () => number; push: (...items: number[]) => number; concat: { (...items: ConcatArray[]): number[]; (...items: (number | ConcatArray)[]): number[]; }; join: (separator?: string) => string; reverse: () => number[]; shift: () => number; slice: (start?: number, end?: number) => number[]; sort: (compareFn?: (a: number, b: number) => number) => number[]; splice: { (start: number, deleteCount?: number): number[]; (start: number, deleteCount: number, ...items: number[]): number[]; }; unshift: (...items: number[]) => number; indexOf: (searchElement: number, fromIndex?: number) => number; lastIndexOf: (searchElement: number, fromIndex?: number) => number; 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; }; some: (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any) => boolean; forEach: (callbackfn: (value: number, index: number, array: number[]) => void, thisArg?: any) => void; map: (callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[]; filter: { (predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): number[]; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): number[]; }; reduce: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; reduceRight: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; find: { (predicate: (value: number, index: number, obj: number[]) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any): number; }; findIndex: (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any) => number; fill: (value: number, start?: number, end?: number) => number[]; copyWithin: (target: number, start: number, end?: number) => number[]; entries: () => IterableIterator<[number, number]>; keys: () => IterableIterator; values: () => IterableIterator; includes: (searchElement: number, fromIndex?: number) => boolean; flatMap: (callback: (this: This, value: number, index: number, array: number[]) => U | readonly U[], thisArg?: This) => U[]; flat: (this: A, depth?: D) => FlatArray[]; [Symbol.iterator]: () => IterableIterator; readonly [Symbol.unscopables]: { [x: number]: boolean; length?: boolean; toString?: boolean; toLocaleString?: boolean; pop?: boolean; push?: boolean; concat?: boolean; join?: boolean; reverse?: boolean; shift?: boolean; slice?: boolean; sort?: boolean; splice?: boolean; unshift?: boolean; indexOf?: boolean; lastIndexOf?: boolean; every?: boolean; some?: boolean; forEach?: boolean; map?: boolean; filter?: boolean; reduce?: boolean; reduceRight?: boolean; find?: boolean; findIndex?: boolean; fill?: boolean; copyWithin?: boolean; entries?: boolean; keys?: boolean; values?: boolean; includes?: boolean; flatMap?: boolean; flat?: boolean; [Symbol.iterator]?: boolean; readonly [Symbol.unscopables]?: boolean; }; } ->(null as any as { [K in keyof number[] as Exclude]: (number[])[K] }) : { [x: number]: number; toString: () => string; toLocaleString: () => string; pop: () => number; push: (...items: number[]) => number; concat: { (...items: ConcatArray[]): number[]; (...items: (number | ConcatArray)[]): number[]; }; join: (separator?: string) => string; reverse: () => number[]; shift: () => number; slice: (start?: number, end?: number) => number[]; sort: (compareFn?: (a: number, b: number) => number) => number[]; splice: { (start: number, deleteCount?: number): number[]; (start: number, deleteCount: number, ...items: number[]): number[]; }; unshift: (...items: number[]) => number; indexOf: (searchElement: number, fromIndex?: number) => number; lastIndexOf: (searchElement: number, fromIndex?: number) => number; 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; }; some: (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any) => boolean; forEach: (callbackfn: (value: number, index: number, array: number[]) => void, thisArg?: any) => void; map: (callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[]; filter: { (predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): number[]; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): number[]; }; reduce: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; reduceRight: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; find: { (predicate: (value: number, index: number, obj: number[]) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any): number; }; findIndex: (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any) => number; fill: (value: number, start?: number, end?: number) => number[]; copyWithin: (target: number, start: number, end?: number) => number[]; entries: () => IterableIterator<[number, number]>; keys: () => IterableIterator; values: () => IterableIterator; includes: (searchElement: number, fromIndex?: number) => boolean; flatMap: (callback: (this: This, value: number, index: number, array: number[]) => U | readonly U[], thisArg?: This) => U[]; flat: (this: A, depth?: D) => FlatArray[]; [Symbol.iterator]: () => IterableIterator; readonly [Symbol.unscopables]: { [x: number]: boolean; length?: boolean; toString?: boolean; toLocaleString?: boolean; pop?: boolean; push?: boolean; concat?: boolean; join?: boolean; reverse?: boolean; shift?: boolean; slice?: boolean; sort?: boolean; splice?: boolean; unshift?: boolean; indexOf?: boolean; lastIndexOf?: boolean; every?: boolean; some?: boolean; forEach?: boolean; map?: boolean; filter?: boolean; reduce?: boolean; reduceRight?: boolean; find?: boolean; findIndex?: boolean; fill?: boolean; copyWithin?: boolean; entries?: boolean; keys?: boolean; values?: boolean; includes?: boolean; flatMap?: boolean; flat?: boolean; [Symbol.iterator]?: boolean; readonly [Symbol.unscopables]?: boolean; }; } ->null as any as { [K in keyof number[] as Exclude]: (number[])[K] } : { [x: number]: number; toString: () => string; toLocaleString: () => string; pop: () => number; push: (...items: number[]) => number; concat: { (...items: ConcatArray[]): number[]; (...items: (number | ConcatArray)[]): number[]; }; join: (separator?: string) => string; reverse: () => number[]; shift: () => number; slice: (start?: number, end?: number) => number[]; sort: (compareFn?: (a: number, b: number) => number) => number[]; splice: { (start: number, deleteCount?: number): number[]; (start: number, deleteCount: number, ...items: number[]): number[]; }; unshift: (...items: number[]) => number; indexOf: (searchElement: number, fromIndex?: number) => number; lastIndexOf: (searchElement: number, fromIndex?: number) => number; 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; }; some: (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any) => boolean; forEach: (callbackfn: (value: number, index: number, array: number[]) => void, thisArg?: any) => void; map: (callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[]; filter: { (predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): number[]; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): number[]; }; reduce: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; reduceRight: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; find: { (predicate: (value: number, index: number, obj: number[]) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any): number; }; findIndex: (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any) => number; fill: (value: number, start?: number, end?: number) => number[]; copyWithin: (target: number, start: number, end?: number) => number[]; entries: () => IterableIterator<[number, number]>; keys: () => IterableIterator; values: () => IterableIterator; includes: (searchElement: number, fromIndex?: number) => boolean; flatMap: (callback: (this: This, value: number, index: number, array: number[]) => U | readonly U[], thisArg?: This) => U[]; flat: (this: A, depth?: D) => FlatArray[]; [Symbol.iterator]: () => IterableIterator; readonly [Symbol.unscopables]: { [x: number]: boolean; length?: boolean; toString?: boolean; toLocaleString?: boolean; pop?: boolean; push?: boolean; concat?: boolean; join?: boolean; reverse?: boolean; shift?: boolean; slice?: boolean; sort?: boolean; splice?: boolean; unshift?: boolean; indexOf?: boolean; lastIndexOf?: boolean; every?: boolean; some?: boolean; forEach?: boolean; map?: boolean; filter?: boolean; reduce?: boolean; reduceRight?: boolean; find?: boolean; findIndex?: boolean; fill?: boolean; copyWithin?: boolean; entries?: boolean; keys?: boolean; values?: boolean; includes?: boolean; flatMap?: boolean; flat?: boolean; [Symbol.iterator]?: boolean; readonly [Symbol.unscopables]?: boolean; }; } +>thing : { [x: number]: number; toString: () => string; toLocaleString: () => string; pop: () => number; push: (...items: number[]) => number; concat: { (...items: ConcatArray[]): number[]; (...items: (number | ConcatArray)[]): number[]; }; join: (separator?: string) => string; reverse: () => number[]; shift: () => number; slice: (start?: number, end?: number) => number[]; sort: (compareFn?: (a: number, b: number) => number) => number[]; splice: { (start: number, deleteCount?: number): number[]; (start: number, deleteCount: number, ...items: number[]): number[]; }; unshift: (...items: number[]) => number; indexOf: (searchElement: number, fromIndex?: number) => number; lastIndexOf: (searchElement: number, fromIndex?: number) => number; 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; }; some: (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any) => boolean; forEach: (callbackfn: (value: number, index: number, array: number[]) => void, thisArg?: any) => void; map: (callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[]; filter: { (predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): S[]; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): number[]; }; reduce: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; reduceRight: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; find: { (predicate: (value: number, index: number, obj: number[]) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any): number; }; findIndex: (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any) => number; fill: (value: number, start?: number, end?: number) => number[]; copyWithin: (target: number, start: number, end?: number) => number[]; entries: () => IterableIterator<[number, number]>; keys: () => IterableIterator; values: () => IterableIterator; includes: (searchElement: number, fromIndex?: number) => boolean; flatMap: (callback: (this: This, value: number, index: number, array: number[]) => U | readonly U[], thisArg?: This) => U[]; flat: (this: A, depth?: D) => FlatArray[]; [Symbol.iterator]: () => IterableIterator; readonly [Symbol.unscopables]: { [x: number]: boolean; length?: boolean; toString?: boolean; toLocaleString?: boolean; pop?: boolean; push?: boolean; concat?: boolean; join?: boolean; reverse?: boolean; shift?: boolean; slice?: boolean; sort?: boolean; splice?: boolean; unshift?: boolean; indexOf?: boolean; lastIndexOf?: boolean; every?: boolean; some?: boolean; forEach?: boolean; map?: boolean; filter?: boolean; reduce?: boolean; reduceRight?: boolean; find?: boolean; findIndex?: boolean; fill?: boolean; copyWithin?: boolean; entries?: boolean; keys?: boolean; values?: boolean; includes?: boolean; flatMap?: boolean; flat?: boolean; [Symbol.iterator]?: boolean; readonly [Symbol.unscopables]?: boolean; }; } +>(null as any as { [K in keyof number[] as Exclude]: (number[])[K] }) : { [x: number]: number; toString: () => string; toLocaleString: () => string; pop: () => number; push: (...items: number[]) => number; concat: { (...items: ConcatArray[]): number[]; (...items: (number | ConcatArray)[]): number[]; }; join: (separator?: string) => string; reverse: () => number[]; shift: () => number; slice: (start?: number, end?: number) => number[]; sort: (compareFn?: (a: number, b: number) => number) => number[]; splice: { (start: number, deleteCount?: number): number[]; (start: number, deleteCount: number, ...items: number[]): number[]; }; unshift: (...items: number[]) => number; indexOf: (searchElement: number, fromIndex?: number) => number; lastIndexOf: (searchElement: number, fromIndex?: number) => number; 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; }; some: (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any) => boolean; forEach: (callbackfn: (value: number, index: number, array: number[]) => void, thisArg?: any) => void; map: (callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[]; filter: { (predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): S[]; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): number[]; }; reduce: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; reduceRight: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; find: { (predicate: (value: number, index: number, obj: number[]) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any): number; }; findIndex: (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any) => number; fill: (value: number, start?: number, end?: number) => number[]; copyWithin: (target: number, start: number, end?: number) => number[]; entries: () => IterableIterator<[number, number]>; keys: () => IterableIterator; values: () => IterableIterator; includes: (searchElement: number, fromIndex?: number) => boolean; flatMap: (callback: (this: This, value: number, index: number, array: number[]) => U | readonly U[], thisArg?: This) => U[]; flat: (this: A, depth?: D) => FlatArray[]; [Symbol.iterator]: () => IterableIterator; readonly [Symbol.unscopables]: { [x: number]: boolean; length?: boolean; toString?: boolean; toLocaleString?: boolean; pop?: boolean; push?: boolean; concat?: boolean; join?: boolean; reverse?: boolean; shift?: boolean; slice?: boolean; sort?: boolean; splice?: boolean; unshift?: boolean; indexOf?: boolean; lastIndexOf?: boolean; every?: boolean; some?: boolean; forEach?: boolean; map?: boolean; filter?: boolean; reduce?: boolean; reduceRight?: boolean; find?: boolean; findIndex?: boolean; fill?: boolean; copyWithin?: boolean; entries?: boolean; keys?: boolean; values?: boolean; includes?: boolean; flatMap?: boolean; flat?: boolean; [Symbol.iterator]?: boolean; readonly [Symbol.unscopables]?: boolean; }; } +>null as any as { [K in keyof number[] as Exclude]: (number[])[K] } : { [x: number]: number; toString: () => string; toLocaleString: () => string; pop: () => number; push: (...items: number[]) => number; concat: { (...items: ConcatArray[]): number[]; (...items: (number | ConcatArray)[]): number[]; }; join: (separator?: string) => string; reverse: () => number[]; shift: () => number; slice: (start?: number, end?: number) => number[]; sort: (compareFn?: (a: number, b: number) => number) => number[]; splice: { (start: number, deleteCount?: number): number[]; (start: number, deleteCount: number, ...items: number[]): number[]; }; unshift: (...items: number[]) => number; indexOf: (searchElement: number, fromIndex?: number) => number; lastIndexOf: (searchElement: number, fromIndex?: number) => number; 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; }; some: (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any) => boolean; forEach: (callbackfn: (value: number, index: number, array: number[]) => void, thisArg?: any) => void; map: (callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[]; filter: { (predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): S[]; (predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): number[]; }; reduce: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; reduceRight: { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; }; find: { (predicate: (value: number, index: number, obj: number[]) => value is S, thisArg?: any): S; (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any): number; }; findIndex: (predicate: (value: number, index: number, obj: number[]) => unknown, thisArg?: any) => number; fill: (value: number, start?: number, end?: number) => number[]; copyWithin: (target: number, start: number, end?: number) => number[]; entries: () => IterableIterator<[number, number]>; keys: () => IterableIterator; values: () => IterableIterator; includes: (searchElement: number, fromIndex?: number) => boolean; flatMap: (callback: (this: This, value: number, index: number, array: number[]) => U | readonly U[], thisArg?: This) => U[]; flat: (this: A, depth?: D) => FlatArray[]; [Symbol.iterator]: () => IterableIterator; readonly [Symbol.unscopables]: { [x: number]: boolean; length?: boolean; toString?: boolean; toLocaleString?: boolean; pop?: boolean; push?: boolean; concat?: boolean; join?: boolean; reverse?: boolean; shift?: boolean; slice?: boolean; sort?: boolean; splice?: boolean; unshift?: boolean; indexOf?: boolean; lastIndexOf?: boolean; every?: boolean; some?: boolean; forEach?: boolean; map?: boolean; filter?: boolean; reduce?: boolean; reduceRight?: boolean; find?: boolean; findIndex?: boolean; fill?: boolean; copyWithin?: boolean; entries?: boolean; keys?: boolean; values?: boolean; includes?: boolean; flatMap?: boolean; flat?: boolean; [Symbol.iterator]?: boolean; readonly [Symbol.unscopables]?: boolean; }; } >null as any : any diff --git a/tests/baselines/reference/nonInferrableTypePropagation3.symbols b/tests/baselines/reference/nonInferrableTypePropagation3.symbols index 6e798a6436e69..9af23efbb4fd0 100644 --- a/tests/baselines/reference/nonInferrableTypePropagation3.symbols +++ b/tests/baselines/reference/nonInferrableTypePropagation3.symbols @@ -41,9 +41,9 @@ const usersOverAge = make((age: number) => data => { >data : Symbol(data, Decl(nonInferrableTypePropagation3.ts, 7, 42)) return data.filter(user => user.age >= age); ->data.filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>data.filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >data : Symbol(data, Decl(nonInferrableTypePropagation3.ts, 7, 42)) ->filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >user : Symbol(user, Decl(nonInferrableTypePropagation3.ts, 8, 23)) >user.age : Symbol(age, Decl(nonInferrableTypePropagation3.ts, 5, 33)) >user : Symbol(user, Decl(nonInferrableTypePropagation3.ts, 8, 23)) diff --git a/tests/baselines/reference/nonInferrableTypePropagation3.types b/tests/baselines/reference/nonInferrableTypePropagation3.types index b2f6e1e9c1f46..caf79f6cb062b 100644 --- a/tests/baselines/reference/nonInferrableTypePropagation3.types +++ b/tests/baselines/reference/nonInferrableTypePropagation3.types @@ -31,9 +31,9 @@ const usersOverAge = make((age: number) => data => { return data.filter(user => user.age >= age); >data.filter(user => user.age >= age) : { id: string; age: number; }[] ->data.filter : { (predicate: (value: { id: string; age: number; }, index: number, array: { id: string; age: number; }[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): { id: string; age: number; }[]; (predicate: (value: { id: string; age: number; }, index: number, array: { id: string; age: number; }[]) => unknown, thisArg?: any): { id: string; age: number; }[]; } +>data.filter : { (predicate: (value: { id: string; age: number; }, index: number, array: { id: string; age: number; }[]) => value is S, thisArg?: any): S[]; (predicate: (value: { id: string; age: number; }, index: number, array: { id: string; age: number; }[]) => unknown, thisArg?: any): { id: string; age: number; }[]; } >data : { id: string; age: number; }[] ->filter : { (predicate: (value: { id: string; age: number; }, index: number, array: { id: string; age: number; }[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): { id: string; age: number; }[]; (predicate: (value: { id: string; age: number; }, index: number, array: { id: string; age: number; }[]) => unknown, thisArg?: any): { id: string; age: number; }[]; } +>filter : { (predicate: (value: { id: string; age: number; }, index: number, array: { id: string; age: number; }[]) => value is S, thisArg?: any): S[]; (predicate: (value: { id: string; age: number; }, index: number, array: { id: string; age: number; }[]) => unknown, thisArg?: any): { id: string; age: number; }[]; } >user => user.age >= age : (user: { id: string; age: number; }) => boolean >user : { id: string; age: number; } >user.age >= age : boolean diff --git a/tests/baselines/reference/objectInstantiationFromUnionSpread.symbols b/tests/baselines/reference/objectInstantiationFromUnionSpread.symbols index 92947386fc0b8..2f20d24ea412b 100644 --- a/tests/baselines/reference/objectInstantiationFromUnionSpread.symbols +++ b/tests/baselines/reference/objectInstantiationFromUnionSpread.symbols @@ -28,13 +28,13 @@ function f1(a: Item[]) { >Item : Symbol(Item, Decl(objectInstantiationFromUnionSpread.ts, 8, 1)) a.map(item => ({ ...item })).filter(value => {}); ->a.map(item => ({ ...item })).filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>a.map(item => ({ ...item })).filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >a.map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --)) >a : Symbol(a, Decl(objectInstantiationFromUnionSpread.ts, 12, 12)) >map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --)) >item : Symbol(item, Decl(objectInstantiationFromUnionSpread.ts, 13, 8)) >item : Symbol(item, Decl(objectInstantiationFromUnionSpread.ts, 13, 8)) ->filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >value : Symbol(value, Decl(objectInstantiationFromUnionSpread.ts, 13, 38)) } @@ -45,13 +45,13 @@ function f2(a: Item[]) { >Item : Symbol(Item, Decl(objectInstantiationFromUnionSpread.ts, 8, 1)) a.map(item => ({ ...item })).filter(value => {}); ->a.map(item => ({ ...item })).filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>a.map(item => ({ ...item })).filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >a.map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --)) >a : Symbol(a, Decl(objectInstantiationFromUnionSpread.ts, 16, 15)) >map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --)) >item : Symbol(item, Decl(objectInstantiationFromUnionSpread.ts, 17, 8)) >item : Symbol(item, Decl(objectInstantiationFromUnionSpread.ts, 17, 8)) ->filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >value : Symbol(value, Decl(objectInstantiationFromUnionSpread.ts, 17, 38)) } diff --git a/tests/baselines/reference/objectInstantiationFromUnionSpread.types b/tests/baselines/reference/objectInstantiationFromUnionSpread.types index ce246c03f5830..fc15cd9ed6ff3 100644 --- a/tests/baselines/reference/objectInstantiationFromUnionSpread.types +++ b/tests/baselines/reference/objectInstantiationFromUnionSpread.types @@ -24,7 +24,7 @@ function f1(a: Item[]) { a.map(item => ({ ...item })).filter(value => {}); >a.map(item => ({ ...item })).filter(value => {}) : ({ isSuccess: true; } | { isSuccess: false; })[] ->a.map(item => ({ ...item })).filter : { (predicate: (value: { isSuccess: true; } | { isSuccess: false; }, index: number, array: ({ isSuccess: true; } | { isSuccess: false; })[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): ({ isSuccess: true; } | { isSuccess: false; })[]; (predicate: (value: { isSuccess: true; } | { isSuccess: false; }, index: number, array: ({ isSuccess: true; } | { isSuccess: false; })[]) => unknown, thisArg?: any): ({ isSuccess: true; } | { isSuccess: false; })[]; } +>a.map(item => ({ ...item })).filter : { (predicate: (value: { isSuccess: true; } | { isSuccess: false; }, index: number, array: ({ isSuccess: true; } | { isSuccess: false; })[]) => value is S, thisArg?: any): S[]; (predicate: (value: { isSuccess: true; } | { isSuccess: false; }, index: number, array: ({ isSuccess: true; } | { isSuccess: false; })[]) => unknown, thisArg?: any): ({ isSuccess: true; } | { isSuccess: false; })[]; } >a.map(item => ({ ...item })) : ({ isSuccess: true; } | { isSuccess: false; })[] >a.map : (callbackfn: (value: Item, index: number, array: Item[]) => U, thisArg?: any) => U[] >a : Item[] @@ -34,7 +34,7 @@ function f1(a: Item[]) { >({ ...item }) : { isSuccess: true; } | { isSuccess: false; } >{ ...item } : { isSuccess: true; } | { isSuccess: false; } >item : Item ->filter : { (predicate: (value: { isSuccess: true; } | { isSuccess: false; }, index: number, array: ({ isSuccess: true; } | { isSuccess: false; })[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): ({ isSuccess: true; } | { isSuccess: false; })[]; (predicate: (value: { isSuccess: true; } | { isSuccess: false; }, index: number, array: ({ isSuccess: true; } | { isSuccess: false; })[]) => unknown, thisArg?: any): ({ isSuccess: true; } | { isSuccess: false; })[]; } +>filter : { (predicate: (value: { isSuccess: true; } | { isSuccess: false; }, index: number, array: ({ isSuccess: true; } | { isSuccess: false; })[]) => value is S, thisArg?: any): S[]; (predicate: (value: { isSuccess: true; } | { isSuccess: false; }, index: number, array: ({ isSuccess: true; } | { isSuccess: false; })[]) => unknown, thisArg?: any): ({ isSuccess: true; } | { isSuccess: false; })[]; } >value => {} : (value: { isSuccess: true; } | { isSuccess: false; }) => void >value : { isSuccess: true; } | { isSuccess: false; } } @@ -45,7 +45,7 @@ function f2(a: Item[]) { a.map(item => ({ ...item })).filter(value => {}); >a.map(item => ({ ...item })).filter(value => {}) : ({ isSuccess: true; } | { isSuccess: false; })[] ->a.map(item => ({ ...item })).filter : { (predicate: (value: { isSuccess: true; } | { isSuccess: false; }, index: number, array: ({ isSuccess: true; } | { isSuccess: false; })[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): ({ isSuccess: true; } | { isSuccess: false; })[]; (predicate: (value: { isSuccess: true; } | { isSuccess: false; }, index: number, array: ({ isSuccess: true; } | { isSuccess: false; })[]) => unknown, thisArg?: any): ({ isSuccess: true; } | { isSuccess: false; })[]; } +>a.map(item => ({ ...item })).filter : { (predicate: (value: { isSuccess: true; } | { isSuccess: false; }, index: number, array: ({ isSuccess: true; } | { isSuccess: false; })[]) => value is S, thisArg?: any): S[]; (predicate: (value: { isSuccess: true; } | { isSuccess: false; }, index: number, array: ({ isSuccess: true; } | { isSuccess: false; })[]) => unknown, thisArg?: any): ({ isSuccess: true; } | { isSuccess: false; })[]; } >a.map(item => ({ ...item })) : ({ isSuccess: true; } | { isSuccess: false; })[] >a.map : (callbackfn: (value: Item, index: number, array: Item[]) => U, thisArg?: any) => U[] >a : Item[] @@ -55,7 +55,7 @@ function f2(a: Item[]) { >({ ...item }) : { isSuccess: true; } | { isSuccess: false; } >{ ...item } : { isSuccess: true; } | { isSuccess: false; } >item : Item ->filter : { (predicate: (value: { isSuccess: true; } | { isSuccess: false; }, index: number, array: ({ isSuccess: true; } | { isSuccess: false; })[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): ({ isSuccess: true; } | { isSuccess: false; })[]; (predicate: (value: { isSuccess: true; } | { isSuccess: false; }, index: number, array: ({ isSuccess: true; } | { isSuccess: false; })[]) => unknown, thisArg?: any): ({ isSuccess: true; } | { isSuccess: false; })[]; } +>filter : { (predicate: (value: { isSuccess: true; } | { isSuccess: false; }, index: number, array: ({ isSuccess: true; } | { isSuccess: false; })[]) => value is S, thisArg?: any): S[]; (predicate: (value: { isSuccess: true; } | { isSuccess: false; }, index: number, array: ({ isSuccess: true; } | { isSuccess: false; })[]) => unknown, thisArg?: any): ({ isSuccess: true; } | { isSuccess: false; })[]; } >value => {} : (value: { isSuccess: true; } | { isSuccess: false; }) => void >value : { isSuccess: true; } | { isSuccess: false; } } diff --git a/tests/baselines/reference/restElementWithNumberPropertyName.types b/tests/baselines/reference/restElementWithNumberPropertyName.types index 3ca9b5bc777df..81077fcdc7512 100644 --- a/tests/baselines/reference/restElementWithNumberPropertyName.types +++ b/tests/baselines/reference/restElementWithNumberPropertyName.types @@ -3,7 +3,7 @@ === restElementWithNumberPropertyName.ts === const { 0: a, ...b } = [0, 1, 2]; >a : number ->b : { [n: number]: number; 0: number; 1: number; 2: number; length: 3; toString(): string; toLocaleString(): string; pop(): number; push(...items: number[]): number; concat(...items: ConcatArray[]): number[]; concat(...items: (number | ConcatArray)[]): number[]; join(separator?: string): string; reverse(): number[]; shift(): number; slice(start?: number, end?: number): number[]; sort(compareFn?: (a: number, b: number) => number): [number, number, number]; splice(start: number, deleteCount?: number): number[]; splice(start: number, deleteCount: number, ...items: number[]): number[]; unshift(...items: number[]): number; indexOf(searchElement: number, fromIndex?: number): number; lastIndexOf(searchElement: number, fromIndex?: number): number; every(predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): this is S[]; every(predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): boolean; some(predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): boolean; forEach(callbackfn: (value: number, index: number, array: number[]) => void, thisArg?: any): void; map(callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any): U[]; filter(predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): S[]; filter(predicate: BooleanConstructor, thisArg?: any): number[]; filter(predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): number[]; reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; } +>b : { [n: number]: number; 0: number; 1: number; 2: number; length: 3; toString(): string; toLocaleString(): string; pop(): number; push(...items: number[]): number; concat(...items: ConcatArray[]): number[]; concat(...items: (number | ConcatArray)[]): number[]; join(separator?: string): string; reverse(): number[]; shift(): number; slice(start?: number, end?: number): number[]; sort(compareFn?: (a: number, b: number) => number): [number, number, number]; splice(start: number, deleteCount?: number): number[]; splice(start: number, deleteCount: number, ...items: number[]): number[]; unshift(...items: number[]): number; indexOf(searchElement: number, fromIndex?: number): number; lastIndexOf(searchElement: number, fromIndex?: number): number; every(predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): this is S[]; every(predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): boolean; some(predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): boolean; forEach(callbackfn: (value: number, index: number, array: number[]) => void, thisArg?: any): void; map(callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any): U[]; filter(predicate: (value: number, index: number, array: number[]) => value is S, thisArg?: any): S[]; filter(predicate: (value: number, index: number, array: number[]) => unknown, thisArg?: any): number[]; reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; } >[0, 1, 2] : [number, number, number] >0 : 0 >1 : 1 diff --git a/tests/baselines/reference/restInvalidArgumentType.types b/tests/baselines/reference/restInvalidArgumentType.types index 948d3beeae559..a97d40bee9cf6 100644 --- a/tests/baselines/reference/restInvalidArgumentType.types +++ b/tests/baselines/reference/restInvalidArgumentType.types @@ -72,7 +72,7 @@ function f(p1: T, p2: T[]) { >p1 : T var {...r2} = p2; // OK ->r2 : { [n: number]: T; length: number; toString(): string; toLocaleString(): string; pop(): T; push(...items: T[]): number; concat(...items: ConcatArray[]): T[]; concat(...items: (T | ConcatArray)[]): T[]; join(separator?: string): string; reverse(): T[]; shift(): T; slice(start?: number, end?: number): T[]; sort(compareFn?: (a: T, b: T) => number): T[]; splice(start: number, deleteCount?: number): T[]; splice(start: number, deleteCount: number, ...items: T[]): T[]; unshift(...items: T[]): number; indexOf(searchElement: T, fromIndex?: number): number; lastIndexOf(searchElement: T, fromIndex?: number): number; every(predicate: (value: T, index: number, array: T[]) => value is S, thisArg?: any): this is S[]; every(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): boolean; some(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): boolean; forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; map(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; filter(predicate: (value: T, index: number, array: T[]) => value is S, thisArg?: any): S[]; filter(predicate: BooleanConstructor, thisArg?: any): (T extends false | "" | 0 | 0n ? never : T)[]; filter(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): T[]; reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T; reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T; reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T; reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T; reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; } +>r2 : { [n: number]: T; length: number; toString(): string; toLocaleString(): string; pop(): T; push(...items: T[]): number; concat(...items: ConcatArray[]): T[]; concat(...items: (T | ConcatArray)[]): T[]; join(separator?: string): string; reverse(): T[]; shift(): T; slice(start?: number, end?: number): T[]; sort(compareFn?: (a: T, b: T) => number): T[]; splice(start: number, deleteCount?: number): T[]; splice(start: number, deleteCount: number, ...items: T[]): T[]; unshift(...items: T[]): number; indexOf(searchElement: T, fromIndex?: number): number; lastIndexOf(searchElement: T, fromIndex?: number): number; every(predicate: (value: T, index: number, array: T[]) => value is S, thisArg?: any): this is S[]; every(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): boolean; some(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): boolean; forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; map(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; filter(predicate: (value: T, index: number, array: T[]) => value is S, thisArg?: any): S[]; filter(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): T[]; reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T; reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T; reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T; reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T; reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; } >p2 : T[] var {...r3} = t; // Error, generic type paramter diff --git a/tests/baselines/reference/restParameterWithBindingPattern3.types b/tests/baselines/reference/restParameterWithBindingPattern3.types index d97b4cb864cf2..4104e8619875c 100644 --- a/tests/baselines/reference/restParameterWithBindingPattern3.types +++ b/tests/baselines/reference/restParameterWithBindingPattern3.types @@ -33,5 +33,5 @@ function e(...{0: a = 1, 1: b = true, ...rest: rest}: [boolean, string, number]) >b : string >true : true >rest : any ->rest : { [n: number]: string | number | boolean; 0: boolean; 1: string; 2: number; length: 3; toString(): string; toLocaleString(): string; pop(): string | number | boolean; push(...items: (string | number | boolean)[]): number; concat(...items: ConcatArray[]): (string | number | boolean)[]; concat(...items: (string | number | boolean | ConcatArray)[]): (string | number | boolean)[]; join(separator?: string): string; reverse(): (string | number | boolean)[]; shift(): string | number | boolean; slice(start?: number, end?: number): (string | number | boolean)[]; sort(compareFn?: (a: string | number | boolean, b: string | number | boolean) => number): [boolean, string, number]; splice(start: number, deleteCount?: number): (string | number | boolean)[]; splice(start: number, deleteCount: number, ...items: (string | number | boolean)[]): (string | number | boolean)[]; unshift(...items: (string | number | boolean)[]): number; indexOf(searchElement: string | number | boolean, fromIndex?: number): number; lastIndexOf(searchElement: string | number | boolean, fromIndex?: number): number; every(predicate: (value: string | number | boolean, index: number, array: (string | number | boolean)[]) => value is S, thisArg?: any): this is S[]; every(predicate: (value: string | number | boolean, index: number, array: (string | number | boolean)[]) => unknown, thisArg?: any): boolean; some(predicate: (value: string | number | boolean, index: number, array: (string | number | boolean)[]) => unknown, thisArg?: any): boolean; forEach(callbackfn: (value: string | number | boolean, index: number, array: (string | number | boolean)[]) => void, thisArg?: any): void; map(callbackfn: (value: string | number | boolean, index: number, array: (string | number | boolean)[]) => U, thisArg?: any): U[]; filter(predicate: (value: string | number | boolean, index: number, array: (string | number | boolean)[]) => value is S, thisArg?: any): S[]; filter(predicate: BooleanConstructor, thisArg?: any): (string | number | true)[]; filter(predicate: (value: string | number | boolean, index: number, array: (string | number | boolean)[]) => unknown, thisArg?: any): (string | number | boolean)[]; reduce(callbackfn: (previousValue: string | number | boolean, currentValue: string | number | boolean, currentIndex: number, array: (string | number | boolean)[]) => string | number | boolean): string | number | boolean; reduce(callbackfn: (previousValue: string | number | boolean, currentValue: string | number | boolean, currentIndex: number, array: (string | number | boolean)[]) => string | number | boolean, initialValue: string | number | boolean): string | number | boolean; reduce(callbackfn: (previousValue: U, currentValue: string | number | boolean, currentIndex: number, array: (string | number | boolean)[]) => U, initialValue: U): U; reduceRight(callbackfn: (previousValue: string | number | boolean, currentValue: string | number | boolean, currentIndex: number, array: (string | number | boolean)[]) => string | number | boolean): string | number | boolean; reduceRight(callbackfn: (previousValue: string | number | boolean, currentValue: string | number | boolean, currentIndex: number, array: (string | number | boolean)[]) => string | number | boolean, initialValue: string | number | boolean): string | number | boolean; reduceRight(callbackfn: (previousValue: U, currentValue: string | number | boolean, currentIndex: number, array: (string | number | boolean)[]) => U, initialValue: U): U; } +>rest : { [n: number]: string | number | boolean; 0: boolean; 1: string; 2: number; length: 3; toString(): string; toLocaleString(): string; pop(): string | number | boolean; push(...items: (string | number | boolean)[]): number; concat(...items: ConcatArray[]): (string | number | boolean)[]; concat(...items: (string | number | boolean | ConcatArray)[]): (string | number | boolean)[]; join(separator?: string): string; reverse(): (string | number | boolean)[]; shift(): string | number | boolean; slice(start?: number, end?: number): (string | number | boolean)[]; sort(compareFn?: (a: string | number | boolean, b: string | number | boolean) => number): [boolean, string, number]; splice(start: number, deleteCount?: number): (string | number | boolean)[]; splice(start: number, deleteCount: number, ...items: (string | number | boolean)[]): (string | number | boolean)[]; unshift(...items: (string | number | boolean)[]): number; indexOf(searchElement: string | number | boolean, fromIndex?: number): number; lastIndexOf(searchElement: string | number | boolean, fromIndex?: number): number; every(predicate: (value: string | number | boolean, index: number, array: (string | number | boolean)[]) => value is S, thisArg?: any): this is S[]; every(predicate: (value: string | number | boolean, index: number, array: (string | number | boolean)[]) => unknown, thisArg?: any): boolean; some(predicate: (value: string | number | boolean, index: number, array: (string | number | boolean)[]) => unknown, thisArg?: any): boolean; forEach(callbackfn: (value: string | number | boolean, index: number, array: (string | number | boolean)[]) => void, thisArg?: any): void; map(callbackfn: (value: string | number | boolean, index: number, array: (string | number | boolean)[]) => U, thisArg?: any): U[]; filter(predicate: (value: string | number | boolean, index: number, array: (string | number | boolean)[]) => value is S, thisArg?: any): S[]; filter(predicate: (value: string | number | boolean, index: number, array: (string | number | boolean)[]) => unknown, thisArg?: any): (string | number | boolean)[]; reduce(callbackfn: (previousValue: string | number | boolean, currentValue: string | number | boolean, currentIndex: number, array: (string | number | boolean)[]) => string | number | boolean): string | number | boolean; reduce(callbackfn: (previousValue: string | number | boolean, currentValue: string | number | boolean, currentIndex: number, array: (string | number | boolean)[]) => string | number | boolean, initialValue: string | number | boolean): string | number | boolean; reduce(callbackfn: (previousValue: U, currentValue: string | number | boolean, currentIndex: number, array: (string | number | boolean)[]) => U, initialValue: U): U; reduceRight(callbackfn: (previousValue: string | number | boolean, currentValue: string | number | boolean, currentIndex: number, array: (string | number | boolean)[]) => string | number | boolean): string | number | boolean; reduceRight(callbackfn: (previousValue: string | number | boolean, currentValue: string | number | boolean, currentIndex: number, array: (string | number | boolean)[]) => string | number | boolean, initialValue: string | number | boolean): string | number | boolean; reduceRight(callbackfn: (previousValue: U, currentValue: string | number | boolean, currentIndex: number, array: (string | number | boolean)[]) => U, initialValue: U): U; } diff --git a/tests/baselines/reference/restPropertyWithBindingPattern.types b/tests/baselines/reference/restPropertyWithBindingPattern.types index 101a8d3c19681..970654185dbdb 100644 --- a/tests/baselines/reference/restPropertyWithBindingPattern.types +++ b/tests/baselines/reference/restPropertyWithBindingPattern.types @@ -19,14 +19,14 @@ ({...[]} = {}); >({...[]} = {}) : {} >{...[]} = {} : {} ->{...[]} : { [n: number]: never; length: 0; toString(): string; toLocaleString(): string; pop(): never; push(...items: never[]): number; concat(...items: ConcatArray[]): never[]; concat(...items: ConcatArray[]): never[]; join(separator?: string): string; reverse(): never[]; shift(): never; slice(start?: number, end?: number): never[]; sort(compareFn?: (a: never, b: never) => number): []; splice(start: number, deleteCount?: number): never[]; splice(start: number, deleteCount: number, ...items: never[]): never[]; unshift(...items: never[]): number; indexOf(searchElement: never, fromIndex?: number): number; lastIndexOf(searchElement: never, fromIndex?: number): number; every(predicate: (value: never, index: number, array: never[]) => value is S, thisArg?: any): this is S[]; every(predicate: (value: never, index: number, array: never[]) => unknown, thisArg?: any): boolean; some(predicate: (value: never, index: number, array: never[]) => unknown, thisArg?: any): boolean; forEach(callbackfn: (value: never, index: number, array: never[]) => void, thisArg?: any): void; map(callbackfn: (value: never, index: number, array: never[]) => U, thisArg?: any): U[]; filter(predicate: (value: never, index: number, array: never[]) => value is S, thisArg?: any): S[]; filter(predicate: BooleanConstructor, thisArg?: any): never[]; filter(predicate: (value: never, index: number, array: never[]) => unknown, thisArg?: any): never[]; reduce(callbackfn: (previousValue: never, currentValue: never, currentIndex: number, array: never[]) => never): never; reduce(callbackfn: (previousValue: never, currentValue: never, currentIndex: number, array: never[]) => never, initialValue: never): never; reduce(callbackfn: (previousValue: U, currentValue: never, currentIndex: number, array: never[]) => U, initialValue: U): U; reduceRight(callbackfn: (previousValue: never, currentValue: never, currentIndex: number, array: never[]) => never): never; reduceRight(callbackfn: (previousValue: never, currentValue: never, currentIndex: number, array: never[]) => never, initialValue: never): never; reduceRight(callbackfn: (previousValue: U, currentValue: never, currentIndex: number, array: never[]) => U, initialValue: U): U; } +>{...[]} : { [n: number]: never; length: 0; toString(): string; toLocaleString(): string; pop(): never; push(...items: never[]): number; concat(...items: ConcatArray[]): never[]; concat(...items: ConcatArray[]): never[]; join(separator?: string): string; reverse(): never[]; shift(): never; slice(start?: number, end?: number): never[]; sort(compareFn?: (a: never, b: never) => number): []; splice(start: number, deleteCount?: number): never[]; splice(start: number, deleteCount: number, ...items: never[]): never[]; unshift(...items: never[]): number; indexOf(searchElement: never, fromIndex?: number): number; lastIndexOf(searchElement: never, fromIndex?: number): number; every(predicate: (value: never, index: number, array: never[]) => value is S, thisArg?: any): this is S[]; every(predicate: (value: never, index: number, array: never[]) => unknown, thisArg?: any): boolean; some(predicate: (value: never, index: number, array: never[]) => unknown, thisArg?: any): boolean; forEach(callbackfn: (value: never, index: number, array: never[]) => void, thisArg?: any): void; map(callbackfn: (value: never, index: number, array: never[]) => U, thisArg?: any): U[]; filter(predicate: (value: never, index: number, array: never[]) => value is S, thisArg?: any): S[]; filter(predicate: (value: never, index: number, array: never[]) => unknown, thisArg?: any): never[]; reduce(callbackfn: (previousValue: never, currentValue: never, currentIndex: number, array: never[]) => never): never; reduce(callbackfn: (previousValue: never, currentValue: never, currentIndex: number, array: never[]) => never, initialValue: never): never; reduce(callbackfn: (previousValue: U, currentValue: never, currentIndex: number, array: never[]) => U, initialValue: U): U; reduceRight(callbackfn: (previousValue: never, currentValue: never, currentIndex: number, array: never[]) => never): never; reduceRight(callbackfn: (previousValue: never, currentValue: never, currentIndex: number, array: never[]) => never, initialValue: never): never; reduceRight(callbackfn: (previousValue: U, currentValue: never, currentIndex: number, array: never[]) => U, initialValue: U): U; } >[] : [] >{} : {} ({...([])} = {}); >({...([])} = {}) : {} >{...([])} = {} : {} ->{...([])} : { [n: number]: never; length: 0; toString(): string; toLocaleString(): string; pop(): never; push(...items: never[]): number; concat(...items: ConcatArray[]): never[]; concat(...items: ConcatArray[]): never[]; join(separator?: string): string; reverse(): never[]; shift(): never; slice(start?: number, end?: number): never[]; sort(compareFn?: (a: never, b: never) => number): []; splice(start: number, deleteCount?: number): never[]; splice(start: number, deleteCount: number, ...items: never[]): never[]; unshift(...items: never[]): number; indexOf(searchElement: never, fromIndex?: number): number; lastIndexOf(searchElement: never, fromIndex?: number): number; every(predicate: (value: never, index: number, array: never[]) => value is S, thisArg?: any): this is S[]; every(predicate: (value: never, index: number, array: never[]) => unknown, thisArg?: any): boolean; some(predicate: (value: never, index: number, array: never[]) => unknown, thisArg?: any): boolean; forEach(callbackfn: (value: never, index: number, array: never[]) => void, thisArg?: any): void; map(callbackfn: (value: never, index: number, array: never[]) => U, thisArg?: any): U[]; filter(predicate: (value: never, index: number, array: never[]) => value is S, thisArg?: any): S[]; filter(predicate: BooleanConstructor, thisArg?: any): never[]; filter(predicate: (value: never, index: number, array: never[]) => unknown, thisArg?: any): never[]; reduce(callbackfn: (previousValue: never, currentValue: never, currentIndex: number, array: never[]) => never): never; reduce(callbackfn: (previousValue: never, currentValue: never, currentIndex: number, array: never[]) => never, initialValue: never): never; reduce(callbackfn: (previousValue: U, currentValue: never, currentIndex: number, array: never[]) => U, initialValue: U): U; reduceRight(callbackfn: (previousValue: never, currentValue: never, currentIndex: number, array: never[]) => never): never; reduceRight(callbackfn: (previousValue: never, currentValue: never, currentIndex: number, array: never[]) => never, initialValue: never): never; reduceRight(callbackfn: (previousValue: U, currentValue: never, currentIndex: number, array: never[]) => U, initialValue: U): U; } +>{...([])} : { [n: number]: never; length: 0; toString(): string; toLocaleString(): string; pop(): never; push(...items: never[]): number; concat(...items: ConcatArray[]): never[]; concat(...items: ConcatArray[]): never[]; join(separator?: string): string; reverse(): never[]; shift(): never; slice(start?: number, end?: number): never[]; sort(compareFn?: (a: never, b: never) => number): []; splice(start: number, deleteCount?: number): never[]; splice(start: number, deleteCount: number, ...items: never[]): never[]; unshift(...items: never[]): number; indexOf(searchElement: never, fromIndex?: number): number; lastIndexOf(searchElement: never, fromIndex?: number): number; every(predicate: (value: never, index: number, array: never[]) => value is S, thisArg?: any): this is S[]; every(predicate: (value: never, index: number, array: never[]) => unknown, thisArg?: any): boolean; some(predicate: (value: never, index: number, array: never[]) => unknown, thisArg?: any): boolean; forEach(callbackfn: (value: never, index: number, array: never[]) => void, thisArg?: any): void; map(callbackfn: (value: never, index: number, array: never[]) => U, thisArg?: any): U[]; filter(predicate: (value: never, index: number, array: never[]) => value is S, thisArg?: any): S[]; filter(predicate: (value: never, index: number, array: never[]) => unknown, thisArg?: any): never[]; reduce(callbackfn: (previousValue: never, currentValue: never, currentIndex: number, array: never[]) => never): never; reduce(callbackfn: (previousValue: never, currentValue: never, currentIndex: number, array: never[]) => never, initialValue: never): never; reduce(callbackfn: (previousValue: U, currentValue: never, currentIndex: number, array: never[]) => U, initialValue: U): U; reduceRight(callbackfn: (previousValue: never, currentValue: never, currentIndex: number, array: never[]) => never): never; reduceRight(callbackfn: (previousValue: never, currentValue: never, currentIndex: number, array: never[]) => never, initialValue: never): never; reduceRight(callbackfn: (previousValue: U, currentValue: never, currentIndex: number, array: never[]) => U, initialValue: U): U; } >([]) : [] >[] : [] >{} : {} diff --git a/tests/baselines/reference/signatureHelpJSMissingPropertyAccess.baseline b/tests/baselines/reference/signatureHelpJSMissingPropertyAccess.baseline index 551c97a536d22..dd9150bd45aee 100644 --- a/tests/baselines/reference/signatureHelpJSMissingPropertyAccess.baseline +++ b/tests/baselines/reference/signatureHelpJSMissingPropertyAccess.baseline @@ -325,273 +325,6 @@ } ] }, - { - "isVariadic": false, - "prefixDisplayParts": [ - { - "text": "ReadonlyArray", - "kind": "interfaceName" - }, - { - "text": ".", - "kind": "punctuation" - }, - { - "text": "filter", - "kind": "methodName" - }, - { - "text": "(", - "kind": "punctuation" - } - ], - "suffixDisplayParts": [ - { - "text": ")", - "kind": "punctuation" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "(", - "kind": "punctuation" - }, - { - "text": "T", - "kind": "typeParameterName" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "extends", - "kind": "keyword" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "false", - "kind": "keyword" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "|", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "\"\"", - "kind": "stringLiteral" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "|", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "0", - "kind": "stringLiteral" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "|", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "0n", - "kind": "stringLiteral" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "?", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "never", - "kind": "keyword" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "T", - "kind": "typeParameterName" - }, - { - "text": ")", - "kind": "punctuation" - }, - { - "text": "[", - "kind": "punctuation" - }, - { - "text": "]", - "kind": "punctuation" - } - ], - "separatorDisplayParts": [ - { - "text": ",", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - } - ], - "parameters": [ - { - "name": "predicate", - "documentation": [ - { - "text": "Must be exactly \"Boolean\"", - "kind": "text" - } - ], - "displayParts": [ - { - "text": "predicate", - "kind": "parameterName" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "BooleanConstructor", - "kind": "interfaceName" - } - ], - "isOptional": false, - "isRest": false - }, - { - "name": "thisArg", - "documentation": [ - { - "text": "An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.", - "kind": "text" - } - ], - "displayParts": [ - { - "text": "thisArg", - "kind": "parameterName" - }, - { - "text": "?", - "kind": "punctuation" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "any", - "kind": "keyword" - } - ], - "isOptional": true, - "isRest": false - } - ], - "documentation": [ - { - "text": "Returns the non-Falsy elements of an array", - "kind": "text" - } - ], - "tags": [ - { - "name": "param", - "text": [ - { - "text": "predicate", - "kind": "parameterName" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "Must be exactly \"Boolean\"", - "kind": "text" - } - ] - }, - { - "name": "param", - "text": [ - { - "text": "thisArg", - "kind": "parameterName" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.", - "kind": "text" - } - ] - } - ] - }, { "isVariadic": false, "prefixDisplayParts": [ diff --git a/tests/baselines/reference/spreadInvalidArgumentType.types b/tests/baselines/reference/spreadInvalidArgumentType.types index eedd052af5aab..b4166b2678c48 100644 --- a/tests/baselines/reference/spreadInvalidArgumentType.types +++ b/tests/baselines/reference/spreadInvalidArgumentType.types @@ -74,8 +74,8 @@ function f(p1: T, p2: T[]) { >p1 : T var o2 = { ...p2 }; // OK ->o2 : { [x: number]: T; length: number; toString(): string; toLocaleString(): string; pop(): T; push(...items: T[]): number; concat(...items: ConcatArray[]): T[]; concat(...items: (T | ConcatArray)[]): T[]; join(separator?: string): string; reverse(): T[]; shift(): T; slice(start?: number, end?: number): T[]; sort(compareFn?: (a: T, b: T) => number): T[]; splice(start: number, deleteCount?: number): T[]; splice(start: number, deleteCount: number, ...items: T[]): T[]; unshift(...items: T[]): number; indexOf(searchElement: T, fromIndex?: number): number; lastIndexOf(searchElement: T, fromIndex?: number): number; every(predicate: (value: T, index: number, array: T[]) => value is S, thisArg?: any): this is S[]; every(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): boolean; some(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): boolean; forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; map(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; filter(predicate: (value: T, index: number, array: T[]) => value is S, thisArg?: any): S[]; filter(predicate: BooleanConstructor, thisArg?: any): (T extends false | "" | 0 | 0n ? never : T)[]; filter(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): T[]; reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T; reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T; reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T; reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T; reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; } ->{ ...p2 } : { [n: number]: T; length: number; toString(): string; toLocaleString(): string; pop(): T; push(...items: T[]): number; concat(...items: ConcatArray[]): T[]; concat(...items: (T | ConcatArray)[]): T[]; join(separator?: string): string; reverse(): T[]; shift(): T; slice(start?: number, end?: number): T[]; sort(compareFn?: (a: T, b: T) => number): T[]; splice(start: number, deleteCount?: number): T[]; splice(start: number, deleteCount: number, ...items: T[]): T[]; unshift(...items: T[]): number; indexOf(searchElement: T, fromIndex?: number): number; lastIndexOf(searchElement: T, fromIndex?: number): number; every(predicate: (value: T, index: number, array: T[]) => value is S, thisArg?: any): this is S[]; every(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): boolean; some(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): boolean; forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; map(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; filter(predicate: (value: T, index: number, array: T[]) => value is S, thisArg?: any): S[]; filter(predicate: BooleanConstructor, thisArg?: any): (T extends false | "" | 0 | 0n ? never : T)[]; filter(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): T[]; reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T; reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T; reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T; reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T; reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; } +>o2 : { [x: number]: T; length: number; toString(): string; toLocaleString(): string; pop(): T; push(...items: T[]): number; concat(...items: ConcatArray[]): T[]; concat(...items: (T | ConcatArray)[]): T[]; join(separator?: string): string; reverse(): T[]; shift(): T; slice(start?: number, end?: number): T[]; sort(compareFn?: (a: T, b: T) => number): T[]; splice(start: number, deleteCount?: number): T[]; splice(start: number, deleteCount: number, ...items: T[]): T[]; unshift(...items: T[]): number; indexOf(searchElement: T, fromIndex?: number): number; lastIndexOf(searchElement: T, fromIndex?: number): number; every(predicate: (value: T, index: number, array: T[]) => value is S, thisArg?: any): this is S[]; every(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): boolean; some(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): boolean; forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; map(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; filter(predicate: (value: T, index: number, array: T[]) => value is S, thisArg?: any): S[]; filter(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): T[]; reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T; reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T; reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T; reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T; reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; } +>{ ...p2 } : { [n: number]: T; length: number; toString(): string; toLocaleString(): string; pop(): T; push(...items: T[]): number; concat(...items: ConcatArray[]): T[]; concat(...items: (T | ConcatArray)[]): T[]; join(separator?: string): string; reverse(): T[]; shift(): T; slice(start?: number, end?: number): T[]; sort(compareFn?: (a: T, b: T) => number): T[]; splice(start: number, deleteCount?: number): T[]; splice(start: number, deleteCount: number, ...items: T[]): T[]; unshift(...items: T[]): number; indexOf(searchElement: T, fromIndex?: number): number; lastIndexOf(searchElement: T, fromIndex?: number): number; every(predicate: (value: T, index: number, array: T[]) => value is S, thisArg?: any): this is S[]; every(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): boolean; some(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): boolean; forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; map(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; filter(predicate: (value: T, index: number, array: T[]) => value is S, thisArg?: any): S[]; filter(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): T[]; reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T; reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T; reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T; reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T; reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; } >p2 : T[] var o3 = { ...t }; // OK, generic type paramter diff --git a/tests/baselines/reference/typeFromJSInitializer.symbols b/tests/baselines/reference/typeFromJSInitializer.symbols index 2d8f1f33c15e1..bb7f62c3c16ee 100644 --- a/tests/baselines/reference/typeFromJSInitializer.symbols +++ b/tests/baselines/reference/typeFromJSInitializer.symbols @@ -191,8 +191,8 @@ const e = [1, undefined]; // should be undefined[] const g = e.filter(isUndef); >g : Symbol(g, Decl(a.js, 59, 5)) ->e.filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>e.filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >e : Symbol(e, Decl(a.js, 56, 5)) ->filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >isUndef : Symbol(isUndef, Decl(a.js, 55, 5)) diff --git a/tests/baselines/reference/typeFromJSInitializer.types b/tests/baselines/reference/typeFromJSInitializer.types index 053135db1a549..43288f0e68de3 100644 --- a/tests/baselines/reference/typeFromJSInitializer.types +++ b/tests/baselines/reference/typeFromJSInitializer.types @@ -257,8 +257,8 @@ const e = [1, undefined]; const g = e.filter(isUndef); >g : undefined[] >e.filter(isUndef) : undefined[] ->e.filter : { (predicate: (value: number | undefined, index: number, array: (number | undefined)[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): number[]; (predicate: (value: number | undefined, index: number, array: (number | undefined)[]) => unknown, thisArg?: any): (number | undefined)[]; } +>e.filter : { (predicate: (value: number | undefined, index: number, array: (number | undefined)[]) => value is S, thisArg?: any): S[]; (predicate: (value: number | undefined, index: number, array: (number | undefined)[]) => unknown, thisArg?: any): (number | undefined)[]; } >e : (number | undefined)[] ->filter : { (predicate: (value: number | undefined, index: number, array: (number | undefined)[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): number[]; (predicate: (value: number | undefined, index: number, array: (number | undefined)[]) => unknown, thisArg?: any): (number | undefined)[]; } +>filter : { (predicate: (value: number | undefined, index: number, array: (number | undefined)[]) => value is S, thisArg?: any): S[]; (predicate: (value: number | undefined, index: number, array: (number | undefined)[]) => unknown, thisArg?: any): (number | undefined)[]; } >isUndef : (v: unknown) => v is undefined diff --git a/tests/baselines/reference/typeInferenceTypePredicate2.symbols b/tests/baselines/reference/typeInferenceTypePredicate2.symbols index 3d7212f1816d0..ac7d559654411 100644 --- a/tests/baselines/reference/typeInferenceTypePredicate2.symbols +++ b/tests/baselines/reference/typeInferenceTypePredicate2.symbols @@ -3,10 +3,10 @@ === typeInferenceTypePredicate2.ts === [true, true, false, null] >[true, true, false, null] .filter((thing): thing is boolean => thing !== null) .map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --)) ->[true, true, false, null] .filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>[true, true, false, null] .filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) .filter((thing): thing is boolean => thing !== null) ->filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >thing : Symbol(thing, Decl(typeInferenceTypePredicate2.ts, 1, 13)) >thing : Symbol(thing, Decl(typeInferenceTypePredicate2.ts, 1, 13)) >thing : Symbol(thing, Decl(typeInferenceTypePredicate2.ts, 1, 13)) diff --git a/tests/baselines/reference/typeInferenceTypePredicate2.types b/tests/baselines/reference/typeInferenceTypePredicate2.types index 47008a7be0d9c..a019bb6b863d8 100644 --- a/tests/baselines/reference/typeInferenceTypePredicate2.types +++ b/tests/baselines/reference/typeInferenceTypePredicate2.types @@ -5,14 +5,14 @@ >[true, true, false, null] .filter((thing): thing is boolean => thing !== null) .map(thing => thing.toString()) : string[] >[true, true, false, null] .filter((thing): thing is boolean => thing !== null) .map : (callbackfn: (value: boolean, index: number, array: boolean[]) => U, thisArg?: any) => U[] >[true, true, false, null] .filter((thing): thing is boolean => thing !== null) : boolean[] ->[true, true, false, null] .filter : { (predicate: (value: boolean, index: number, array: boolean[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): true[]; (predicate: (value: boolean, index: number, array: boolean[]) => unknown, thisArg?: any): boolean[]; } +>[true, true, false, null] .filter : { (predicate: (value: boolean, index: number, array: boolean[]) => value is S, thisArg?: any): S[]; (predicate: (value: boolean, index: number, array: boolean[]) => unknown, thisArg?: any): boolean[]; } >[true, true, false, null] : boolean[] >true : true >true : true >false : false .filter((thing): thing is boolean => thing !== null) ->filter : { (predicate: (value: boolean, index: number, array: boolean[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): true[]; (predicate: (value: boolean, index: number, array: boolean[]) => unknown, thisArg?: any): boolean[]; } +>filter : { (predicate: (value: boolean, index: number, array: boolean[]) => value is S, thisArg?: any): S[]; (predicate: (value: boolean, index: number, array: boolean[]) => unknown, thisArg?: any): boolean[]; } >(thing): thing is boolean => thing !== null : (thing: boolean) => thing is boolean >thing : boolean >thing !== null : boolean diff --git a/tests/baselines/reference/typePredicateFreshLiteralWidening.symbols b/tests/baselines/reference/typePredicateFreshLiteralWidening.symbols index 8db6960bdcce7..c4464e5d4bd39 100644 --- a/tests/baselines/reference/typePredicateFreshLiteralWidening.symbols +++ b/tests/baselines/reference/typePredicateFreshLiteralWidening.symbols @@ -75,9 +75,9 @@ const values2: Array<"1" | "2" | null> = ["1", "2", null]; const filteredValues2 = values2.filter(isNotNull); >filteredValues2 : Symbol(filteredValues2, Decl(typePredicateFreshLiteralWidening.ts, 22, 5)) ->values2.filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>values2.filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >values2 : Symbol(values2, Decl(typePredicateFreshLiteralWidening.ts, 21, 5)) ->filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >isNotNull : Symbol(isNotNull, Decl(typePredicateFreshLiteralWidening.ts, 13, 5)) const values1 = [item1, item2, item3].map(item => item.value); @@ -94,8 +94,8 @@ const values1 = [item1, item2, item3].map(item => item.value); const filteredValues1 = values1.filter(isNotNull); >filteredValues1 : Symbol(filteredValues1, Decl(typePredicateFreshLiteralWidening.ts, 25, 5)) ->values1.filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>values1.filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >values1 : Symbol(values1, Decl(typePredicateFreshLiteralWidening.ts, 24, 5)) ->filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >isNotNull : Symbol(isNotNull, Decl(typePredicateFreshLiteralWidening.ts, 13, 5)) diff --git a/tests/baselines/reference/typePredicateFreshLiteralWidening.types b/tests/baselines/reference/typePredicateFreshLiteralWidening.types index 916cbec512c8a..23038d9bcfa55 100644 --- a/tests/baselines/reference/typePredicateFreshLiteralWidening.types +++ b/tests/baselines/reference/typePredicateFreshLiteralWidening.types @@ -71,9 +71,9 @@ const values2: Array<"1" | "2" | null> = ["1", "2", null]; const filteredValues2 = values2.filter(isNotNull); >filteredValues2 : ("1" | "2")[] >values2.filter(isNotNull) : ("1" | "2")[] ->values2.filter : { (predicate: (value: "1" | "2" | null, index: number, array: ("1" | "2" | null)[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): ("1" | "2")[]; (predicate: (value: "1" | "2" | null, index: number, array: ("1" | "2" | null)[]) => unknown, thisArg?: any): ("1" | "2" | null)[]; } +>values2.filter : { (predicate: (value: "1" | "2" | null, index: number, array: ("1" | "2" | null)[]) => value is S, thisArg?: any): S[]; (predicate: (value: "1" | "2" | null, index: number, array: ("1" | "2" | null)[]) => unknown, thisArg?: any): ("1" | "2" | null)[]; } >values2 : ("1" | "2" | null)[] ->filter : { (predicate: (value: "1" | "2" | null, index: number, array: ("1" | "2" | null)[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): ("1" | "2")[]; (predicate: (value: "1" | "2" | null, index: number, array: ("1" | "2" | null)[]) => unknown, thisArg?: any): ("1" | "2" | null)[]; } +>filter : { (predicate: (value: "1" | "2" | null, index: number, array: ("1" | "2" | null)[]) => value is S, thisArg?: any): S[]; (predicate: (value: "1" | "2" | null, index: number, array: ("1" | "2" | null)[]) => unknown, thisArg?: any): ("1" | "2" | null)[]; } >isNotNull : (value: T | null) => value is T const values1 = [item1, item2, item3].map(item => item.value); @@ -94,8 +94,8 @@ const values1 = [item1, item2, item3].map(item => item.value); const filteredValues1 = values1.filter(isNotNull); >filteredValues1 : ("1" | "2")[] >values1.filter(isNotNull) : ("1" | "2")[] ->values1.filter : { (predicate: (value: "1" | "2" | null, index: number, array: ("1" | "2" | null)[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): ("1" | "2")[]; (predicate: (value: "1" | "2" | null, index: number, array: ("1" | "2" | null)[]) => unknown, thisArg?: any): ("1" | "2" | null)[]; } +>values1.filter : { (predicate: (value: "1" | "2" | null, index: number, array: ("1" | "2" | null)[]) => value is S, thisArg?: any): S[]; (predicate: (value: "1" | "2" | null, index: number, array: ("1" | "2" | null)[]) => unknown, thisArg?: any): ("1" | "2" | null)[]; } >values1 : ("1" | "2" | null)[] ->filter : { (predicate: (value: "1" | "2" | null, index: number, array: ("1" | "2" | null)[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): ("1" | "2")[]; (predicate: (value: "1" | "2" | null, index: number, array: ("1" | "2" | null)[]) => unknown, thisArg?: any): ("1" | "2" | null)[]; } +>filter : { (predicate: (value: "1" | "2" | null, index: number, array: ("1" | "2" | null)[]) => value is S, thisArg?: any): S[]; (predicate: (value: "1" | "2" | null, index: number, array: ("1" | "2" | null)[]) => unknown, thisArg?: any): ("1" | "2" | null)[]; } >isNotNull : (value: T | null) => value is T diff --git a/tests/baselines/reference/typePredicateTopLevelTypeParameter.symbols b/tests/baselines/reference/typePredicateTopLevelTypeParameter.symbols index ffe4bf8c97e79..4d0445cd364dd 100644 --- a/tests/baselines/reference/typePredicateTopLevelTypeParameter.symbols +++ b/tests/baselines/reference/typePredicateTopLevelTypeParameter.symbols @@ -37,8 +37,8 @@ function isDefined(a: T | undefined): a is T { const foundAdmins = admins.filter(isDefined); // "admin"[] >foundAdmins : Symbol(foundAdmins, Decl(typePredicateTopLevelTypeParameter.ts, 13, 5)) ->admins.filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>admins.filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >admins : Symbol(admins, Decl(typePredicateTopLevelTypeParameter.ts, 7, 5)) ->filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >isDefined : Symbol(isDefined, Decl(typePredicateTopLevelTypeParameter.ts, 7, 59)) diff --git a/tests/baselines/reference/typePredicateTopLevelTypeParameter.types b/tests/baselines/reference/typePredicateTopLevelTypeParameter.types index 7ad94de850b7f..c9a39845cff5a 100644 --- a/tests/baselines/reference/typePredicateTopLevelTypeParameter.types +++ b/tests/baselines/reference/typePredicateTopLevelTypeParameter.types @@ -44,8 +44,8 @@ function isDefined(a: T | undefined): a is T { const foundAdmins = admins.filter(isDefined); // "admin"[] >foundAdmins : "admin"[] >admins.filter(isDefined) : "admin"[] ->admins.filter : { (predicate: (value: "admin" | undefined, index: number, array: ("admin" | undefined)[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): "admin"[]; (predicate: (value: "admin" | undefined, index: number, array: ("admin" | undefined)[]) => unknown, thisArg?: any): ("admin" | undefined)[]; } +>admins.filter : { (predicate: (value: "admin" | undefined, index: number, array: ("admin" | undefined)[]) => value is S, thisArg?: any): S[]; (predicate: (value: "admin" | undefined, index: number, array: ("admin" | undefined)[]) => unknown, thisArg?: any): ("admin" | undefined)[]; } >admins : ("admin" | undefined)[] ->filter : { (predicate: (value: "admin" | undefined, index: number, array: ("admin" | undefined)[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): "admin"[]; (predicate: (value: "admin" | undefined, index: number, array: ("admin" | undefined)[]) => unknown, thisArg?: any): ("admin" | undefined)[]; } +>filter : { (predicate: (value: "admin" | undefined, index: number, array: ("admin" | undefined)[]) => value is S, thisArg?: any): S[]; (predicate: (value: "admin" | undefined, index: number, array: ("admin" | undefined)[]) => unknown, thisArg?: any): ("admin" | undefined)[]; } >isDefined : (a: T | undefined) => a is T diff --git a/tests/baselines/reference/unionOfArraysBooleanFilterCall.symbols b/tests/baselines/reference/unionOfArraysBooleanFilterCall.symbols index eb6191581c831..ca3964dc74977 100644 --- a/tests/baselines/reference/unionOfArraysBooleanFilterCall.symbols +++ b/tests/baselines/reference/unionOfArraysBooleanFilterCall.symbols @@ -24,30 +24,30 @@ type Falsey = "" | 0 | false | null | undefined; ([] as (Fizz|Falsey)[] | (Buzz|Falsey)[]).filter(Boolean); // expect type (Fizz|Buzz)[] ->([] as (Fizz|Falsey)[] | (Buzz|Falsey)[]).filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) +>([] as (Fizz|Falsey)[] | (Buzz|Falsey)[]).filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >Fizz : Symbol(Fizz, Decl(unionOfArraysBooleanFilterCall.ts, 0, 0)) >Falsey : Symbol(Falsey, Decl(unionOfArraysBooleanFilterCall.ts, 7, 1)) >Buzz : Symbol(Buzz, Decl(unionOfArraysBooleanFilterCall.ts, 3, 1)) >Falsey : Symbol(Falsey, Decl(unionOfArraysBooleanFilterCall.ts, 7, 1)) ->filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) +>filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >Boolean : Symbol(Boolean, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ([] as (Fizz|Falsey)[] | readonly (Buzz|Falsey)[]).filter(Boolean); // expect type (Fizz|Buzz)[] ->([] as (Fizz|Falsey)[] | readonly (Buzz|Falsey)[]).filter : Symbol(filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) +>([] as (Fizz|Falsey)[] | readonly (Buzz|Falsey)[]).filter : Symbol(filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >Fizz : Symbol(Fizz, Decl(unionOfArraysBooleanFilterCall.ts, 0, 0)) >Falsey : Symbol(Falsey, Decl(unionOfArraysBooleanFilterCall.ts, 7, 1)) >Buzz : Symbol(Buzz, Decl(unionOfArraysBooleanFilterCall.ts, 3, 1)) >Falsey : Symbol(Falsey, Decl(unionOfArraysBooleanFilterCall.ts, 7, 1)) ->filter : Symbol(filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) +>filter : Symbol(filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >Boolean : Symbol(Boolean, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ([] as [Fizz|Falsey] | readonly [(Buzz|Falsey)?]).filter(Boolean); // expect type (Fizz|Buzz)[] ->([] as [Fizz|Falsey] | readonly [(Buzz|Falsey)?]).filter : Symbol(filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) +>([] as [Fizz|Falsey] | readonly [(Buzz|Falsey)?]).filter : Symbol(filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >Fizz : Symbol(Fizz, Decl(unionOfArraysBooleanFilterCall.ts, 0, 0)) >Falsey : Symbol(Falsey, Decl(unionOfArraysBooleanFilterCall.ts, 7, 1)) >Buzz : Symbol(Buzz, Decl(unionOfArraysBooleanFilterCall.ts, 3, 1)) >Falsey : Symbol(Falsey, Decl(unionOfArraysBooleanFilterCall.ts, 7, 1)) ->filter : Symbol(filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) +>filter : Symbol(filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >Boolean : Symbol(Boolean, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) // confirm that the other filter signatures are still available and working @@ -59,12 +59,12 @@ declare function isFizz(x: unknown): x is Fizz; >Fizz : Symbol(Fizz, Decl(unionOfArraysBooleanFilterCall.ts, 0, 0)) ([] as (Fizz|Falsey)[] | (Buzz|Falsey)[]).filter(isFizz); // expect type Fizz[] ->([] as (Fizz|Falsey)[] | (Buzz|Falsey)[]).filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) +>([] as (Fizz|Falsey)[] | (Buzz|Falsey)[]).filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >Fizz : Symbol(Fizz, Decl(unionOfArraysBooleanFilterCall.ts, 0, 0)) >Falsey : Symbol(Falsey, Decl(unionOfArraysBooleanFilterCall.ts, 7, 1)) >Buzz : Symbol(Buzz, Decl(unionOfArraysBooleanFilterCall.ts, 3, 1)) >Falsey : Symbol(Falsey, Decl(unionOfArraysBooleanFilterCall.ts, 7, 1)) ->filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) +>filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >isFizz : Symbol(isFizz, Decl(unionOfArraysBooleanFilterCall.ts, 15, 66)) declare function isBuzz(x: unknown): x is Buzz; @@ -74,21 +74,21 @@ declare function isBuzz(x: unknown): x is Buzz; >Buzz : Symbol(Buzz, Decl(unionOfArraysBooleanFilterCall.ts, 3, 1)) ([] as (Fizz|Falsey)[] | (Buzz|Falsey)[]).filter(isBuzz); // expect type Buzz[] ->([] as (Fizz|Falsey)[] | (Buzz|Falsey)[]).filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) +>([] as (Fizz|Falsey)[] | (Buzz|Falsey)[]).filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >Fizz : Symbol(Fizz, Decl(unionOfArraysBooleanFilterCall.ts, 0, 0)) >Falsey : Symbol(Falsey, Decl(unionOfArraysBooleanFilterCall.ts, 7, 1)) >Buzz : Symbol(Buzz, Decl(unionOfArraysBooleanFilterCall.ts, 3, 1)) >Falsey : Symbol(Falsey, Decl(unionOfArraysBooleanFilterCall.ts, 7, 1)) ->filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) +>filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >isBuzz : Symbol(isBuzz, Decl(unionOfArraysBooleanFilterCall.ts, 20, 57)) ([] as (Fizz|Falsey)[] | (Buzz|Falsey)[]).filter(x => x && typeof x.member === "number"); // expect type (Fizz|Buzz|Falsey)[] ->([] as (Fizz|Falsey)[] | (Buzz|Falsey)[]).filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) +>([] as (Fizz|Falsey)[] | (Buzz|Falsey)[]).filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >Fizz : Symbol(Fizz, Decl(unionOfArraysBooleanFilterCall.ts, 0, 0)) >Falsey : Symbol(Falsey, Decl(unionOfArraysBooleanFilterCall.ts, 7, 1)) >Buzz : Symbol(Buzz, Decl(unionOfArraysBooleanFilterCall.ts, 3, 1)) >Falsey : Symbol(Falsey, Decl(unionOfArraysBooleanFilterCall.ts, 7, 1)) ->filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) +>filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >x : Symbol(x, Decl(unionOfArraysBooleanFilterCall.ts, 25, 49)) >x : Symbol(x, Decl(unionOfArraysBooleanFilterCall.ts, 25, 49)) >x.member : Symbol(member, Decl(unionOfArraysBooleanFilterCall.ts, 1, 15), Decl(unionOfArraysBooleanFilterCall.ts, 5, 15)) diff --git a/tests/baselines/reference/unionOfArraysBooleanFilterCall.types b/tests/baselines/reference/unionOfArraysBooleanFilterCall.types index dc253290e7747..5d02091fb14fc 100644 --- a/tests/baselines/reference/unionOfArraysBooleanFilterCall.types +++ b/tests/baselines/reference/unionOfArraysBooleanFilterCall.types @@ -21,30 +21,30 @@ type Falsey = "" | 0 | false | null | undefined; ([] as (Fizz|Falsey)[] | (Buzz|Falsey)[]).filter(Boolean); // expect type (Fizz|Buzz)[] ->([] as (Fizz|Falsey)[] | (Buzz|Falsey)[]).filter(Boolean) : Fizz[] | Buzz[] ->([] as (Fizz|Falsey)[] | (Buzz|Falsey)[]).filter : { (predicate: (value: Fizz | Falsey, index: number, array: (Fizz | Falsey)[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): Fizz[]; (predicate: (value: Fizz | Falsey, index: number, array: (Fizz | Falsey)[]) => unknown, thisArg?: any): (Fizz | Falsey)[]; } | { (predicate: (value: Buzz | Falsey, index: number, array: (Buzz | Falsey)[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): Buzz[]; (predicate: (value: Buzz | Falsey, index: number, array: (Buzz | Falsey)[]) => unknown, thisArg?: any): (Buzz | Falsey)[]; } +>([] as (Fizz|Falsey)[] | (Buzz|Falsey)[]).filter(Boolean) : (Fizz | Buzz | Falsey)[] +>([] as (Fizz|Falsey)[] | (Buzz|Falsey)[]).filter : { (predicate: (value: Fizz | Falsey, index: number, array: (Fizz | Falsey)[]) => value is S, thisArg?: any): S[]; (predicate: (value: Fizz | Falsey, index: number, array: (Fizz | Falsey)[]) => unknown, thisArg?: any): (Fizz | Falsey)[]; } | { (predicate: (value: Buzz | Falsey, index: number, array: (Buzz | Falsey)[]) => value is S, thisArg?: any): S[]; (predicate: (value: Buzz | Falsey, index: number, array: (Buzz | Falsey)[]) => unknown, thisArg?: any): (Buzz | Falsey)[]; } >([] as (Fizz|Falsey)[] | (Buzz|Falsey)[]) : (Fizz | Falsey)[] | (Buzz | Falsey)[] >[] as (Fizz|Falsey)[] | (Buzz|Falsey)[] : (Fizz | Falsey)[] | (Buzz | Falsey)[] >[] : undefined[] ->filter : { (predicate: (value: Fizz | Falsey, index: number, array: (Fizz | Falsey)[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): Fizz[]; (predicate: (value: Fizz | Falsey, index: number, array: (Fizz | Falsey)[]) => unknown, thisArg?: any): (Fizz | Falsey)[]; } | { (predicate: (value: Buzz | Falsey, index: number, array: (Buzz | Falsey)[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): Buzz[]; (predicate: (value: Buzz | Falsey, index: number, array: (Buzz | Falsey)[]) => unknown, thisArg?: any): (Buzz | Falsey)[]; } +>filter : { (predicate: (value: Fizz | Falsey, index: number, array: (Fizz | Falsey)[]) => value is S, thisArg?: any): S[]; (predicate: (value: Fizz | Falsey, index: number, array: (Fizz | Falsey)[]) => unknown, thisArg?: any): (Fizz | Falsey)[]; } | { (predicate: (value: Buzz | Falsey, index: number, array: (Buzz | Falsey)[]) => value is S, thisArg?: any): S[]; (predicate: (value: Buzz | Falsey, index: number, array: (Buzz | Falsey)[]) => unknown, thisArg?: any): (Buzz | Falsey)[]; } >Boolean : BooleanConstructor ([] as (Fizz|Falsey)[] | readonly (Buzz|Falsey)[]).filter(Boolean); // expect type (Fizz|Buzz)[] ->([] as (Fizz|Falsey)[] | readonly (Buzz|Falsey)[]).filter(Boolean) : Fizz[] | Buzz[] ->([] as (Fizz|Falsey)[] | readonly (Buzz|Falsey)[]).filter : { (predicate: (value: Fizz | Falsey, index: number, array: (Fizz | Falsey)[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): Fizz[]; (predicate: (value: Fizz | Falsey, index: number, array: (Fizz | Falsey)[]) => unknown, thisArg?: any): (Fizz | Falsey)[]; } | { (predicate: (value: Buzz | Falsey, index: number, array: readonly (Buzz | Falsey)[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): Buzz[]; (predicate: (value: Buzz | Falsey, index: number, array: readonly (Buzz | Falsey)[]) => unknown, thisArg?: any): (Buzz | Falsey)[]; } +>([] as (Fizz|Falsey)[] | readonly (Buzz|Falsey)[]).filter(Boolean) : (Fizz | Buzz | Falsey)[] +>([] as (Fizz|Falsey)[] | readonly (Buzz|Falsey)[]).filter : { (predicate: (value: Fizz | Falsey, index: number, array: (Fizz | Falsey)[]) => value is S, thisArg?: any): S[]; (predicate: (value: Fizz | Falsey, index: number, array: (Fizz | Falsey)[]) => unknown, thisArg?: any): (Fizz | Falsey)[]; } | { (predicate: (value: Buzz | Falsey, index: number, array: readonly (Buzz | Falsey)[]) => value is S, thisArg?: any): S[]; (predicate: (value: Buzz | Falsey, index: number, array: readonly (Buzz | Falsey)[]) => unknown, thisArg?: any): (Buzz | Falsey)[]; } >([] as (Fizz|Falsey)[] | readonly (Buzz|Falsey)[]) : (Fizz | Falsey)[] | readonly (Buzz | Falsey)[] >[] as (Fizz|Falsey)[] | readonly (Buzz|Falsey)[] : (Fizz | Falsey)[] | readonly (Buzz | Falsey)[] >[] : undefined[] ->filter : { (predicate: (value: Fizz | Falsey, index: number, array: (Fizz | Falsey)[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): Fizz[]; (predicate: (value: Fizz | Falsey, index: number, array: (Fizz | Falsey)[]) => unknown, thisArg?: any): (Fizz | Falsey)[]; } | { (predicate: (value: Buzz | Falsey, index: number, array: readonly (Buzz | Falsey)[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): Buzz[]; (predicate: (value: Buzz | Falsey, index: number, array: readonly (Buzz | Falsey)[]) => unknown, thisArg?: any): (Buzz | Falsey)[]; } +>filter : { (predicate: (value: Fizz | Falsey, index: number, array: (Fizz | Falsey)[]) => value is S, thisArg?: any): S[]; (predicate: (value: Fizz | Falsey, index: number, array: (Fizz | Falsey)[]) => unknown, thisArg?: any): (Fizz | Falsey)[]; } | { (predicate: (value: Buzz | Falsey, index: number, array: readonly (Buzz | Falsey)[]) => value is S, thisArg?: any): S[]; (predicate: (value: Buzz | Falsey, index: number, array: readonly (Buzz | Falsey)[]) => unknown, thisArg?: any): (Buzz | Falsey)[]; } >Boolean : BooleanConstructor ([] as [Fizz|Falsey] | readonly [(Buzz|Falsey)?]).filter(Boolean); // expect type (Fizz|Buzz)[] ->([] as [Fizz|Falsey] | readonly [(Buzz|Falsey)?]).filter(Boolean) : Fizz[] | Buzz[] ->([] as [Fizz|Falsey] | readonly [(Buzz|Falsey)?]).filter : { (predicate: (value: Fizz | Falsey, index: number, array: (Fizz | Falsey)[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): Fizz[]; (predicate: (value: Fizz | Falsey, index: number, array: (Fizz | Falsey)[]) => unknown, thisArg?: any): (Fizz | Falsey)[]; } | { (predicate: (value: Buzz | Falsey, index: number, array: readonly (Buzz | Falsey)[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): Buzz[]; (predicate: (value: Buzz | Falsey, index: number, array: readonly (Buzz | Falsey)[]) => unknown, thisArg?: any): (Buzz | Falsey)[]; } +>([] as [Fizz|Falsey] | readonly [(Buzz|Falsey)?]).filter(Boolean) : (Fizz | Buzz | Falsey)[] +>([] as [Fizz|Falsey] | readonly [(Buzz|Falsey)?]).filter : { (predicate: (value: Fizz | Falsey, index: number, array: (Fizz | Falsey)[]) => value is S, thisArg?: any): S[]; (predicate: (value: Fizz | Falsey, index: number, array: (Fizz | Falsey)[]) => unknown, thisArg?: any): (Fizz | Falsey)[]; } | { (predicate: (value: Buzz | Falsey, index: number, array: readonly (Buzz | Falsey)[]) => value is S, thisArg?: any): S[]; (predicate: (value: Buzz | Falsey, index: number, array: readonly (Buzz | Falsey)[]) => unknown, thisArg?: any): (Buzz | Falsey)[]; } >([] as [Fizz|Falsey] | readonly [(Buzz|Falsey)?]) : [Fizz | Falsey] | readonly [(Buzz | Falsey)?] >[] as [Fizz|Falsey] | readonly [(Buzz|Falsey)?] : [Fizz | Falsey] | readonly [(Buzz | Falsey)?] >[] : [] ->filter : { (predicate: (value: Fizz | Falsey, index: number, array: (Fizz | Falsey)[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): Fizz[]; (predicate: (value: Fizz | Falsey, index: number, array: (Fizz | Falsey)[]) => unknown, thisArg?: any): (Fizz | Falsey)[]; } | { (predicate: (value: Buzz | Falsey, index: number, array: readonly (Buzz | Falsey)[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): Buzz[]; (predicate: (value: Buzz | Falsey, index: number, array: readonly (Buzz | Falsey)[]) => unknown, thisArg?: any): (Buzz | Falsey)[]; } +>filter : { (predicate: (value: Fizz | Falsey, index: number, array: (Fizz | Falsey)[]) => value is S, thisArg?: any): S[]; (predicate: (value: Fizz | Falsey, index: number, array: (Fizz | Falsey)[]) => unknown, thisArg?: any): (Fizz | Falsey)[]; } | { (predicate: (value: Buzz | Falsey, index: number, array: readonly (Buzz | Falsey)[]) => value is S, thisArg?: any): S[]; (predicate: (value: Buzz | Falsey, index: number, array: readonly (Buzz | Falsey)[]) => unknown, thisArg?: any): (Buzz | Falsey)[]; } >Boolean : BooleanConstructor // confirm that the other filter signatures are still available and working @@ -55,11 +55,11 @@ declare function isFizz(x: unknown): x is Fizz; ([] as (Fizz|Falsey)[] | (Buzz|Falsey)[]).filter(isFizz); // expect type Fizz[] >([] as (Fizz|Falsey)[] | (Buzz|Falsey)[]).filter(isFizz) : Fizz[] ->([] as (Fizz|Falsey)[] | (Buzz|Falsey)[]).filter : { (predicate: (value: Fizz | Falsey, index: number, array: (Fizz | Falsey)[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): Fizz[]; (predicate: (value: Fizz | Falsey, index: number, array: (Fizz | Falsey)[]) => unknown, thisArg?: any): (Fizz | Falsey)[]; } | { (predicate: (value: Buzz | Falsey, index: number, array: (Buzz | Falsey)[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): Buzz[]; (predicate: (value: Buzz | Falsey, index: number, array: (Buzz | Falsey)[]) => unknown, thisArg?: any): (Buzz | Falsey)[]; } +>([] as (Fizz|Falsey)[] | (Buzz|Falsey)[]).filter : { (predicate: (value: Fizz | Falsey, index: number, array: (Fizz | Falsey)[]) => value is S, thisArg?: any): S[]; (predicate: (value: Fizz | Falsey, index: number, array: (Fizz | Falsey)[]) => unknown, thisArg?: any): (Fizz | Falsey)[]; } | { (predicate: (value: Buzz | Falsey, index: number, array: (Buzz | Falsey)[]) => value is S, thisArg?: any): S[]; (predicate: (value: Buzz | Falsey, index: number, array: (Buzz | Falsey)[]) => unknown, thisArg?: any): (Buzz | Falsey)[]; } >([] as (Fizz|Falsey)[] | (Buzz|Falsey)[]) : (Fizz | Falsey)[] | (Buzz | Falsey)[] >[] as (Fizz|Falsey)[] | (Buzz|Falsey)[] : (Fizz | Falsey)[] | (Buzz | Falsey)[] >[] : undefined[] ->filter : { (predicate: (value: Fizz | Falsey, index: number, array: (Fizz | Falsey)[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): Fizz[]; (predicate: (value: Fizz | Falsey, index: number, array: (Fizz | Falsey)[]) => unknown, thisArg?: any): (Fizz | Falsey)[]; } | { (predicate: (value: Buzz | Falsey, index: number, array: (Buzz | Falsey)[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): Buzz[]; (predicate: (value: Buzz | Falsey, index: number, array: (Buzz | Falsey)[]) => unknown, thisArg?: any): (Buzz | Falsey)[]; } +>filter : { (predicate: (value: Fizz | Falsey, index: number, array: (Fizz | Falsey)[]) => value is S, thisArg?: any): S[]; (predicate: (value: Fizz | Falsey, index: number, array: (Fizz | Falsey)[]) => unknown, thisArg?: any): (Fizz | Falsey)[]; } | { (predicate: (value: Buzz | Falsey, index: number, array: (Buzz | Falsey)[]) => value is S, thisArg?: any): S[]; (predicate: (value: Buzz | Falsey, index: number, array: (Buzz | Falsey)[]) => unknown, thisArg?: any): (Buzz | Falsey)[]; } >isFizz : (x: unknown) => x is Fizz declare function isBuzz(x: unknown): x is Buzz; @@ -68,20 +68,20 @@ declare function isBuzz(x: unknown): x is Buzz; ([] as (Fizz|Falsey)[] | (Buzz|Falsey)[]).filter(isBuzz); // expect type Buzz[] >([] as (Fizz|Falsey)[] | (Buzz|Falsey)[]).filter(isBuzz) : Buzz[] ->([] as (Fizz|Falsey)[] | (Buzz|Falsey)[]).filter : { (predicate: (value: Fizz | Falsey, index: number, array: (Fizz | Falsey)[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): Fizz[]; (predicate: (value: Fizz | Falsey, index: number, array: (Fizz | Falsey)[]) => unknown, thisArg?: any): (Fizz | Falsey)[]; } | { (predicate: (value: Buzz | Falsey, index: number, array: (Buzz | Falsey)[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): Buzz[]; (predicate: (value: Buzz | Falsey, index: number, array: (Buzz | Falsey)[]) => unknown, thisArg?: any): (Buzz | Falsey)[]; } +>([] as (Fizz|Falsey)[] | (Buzz|Falsey)[]).filter : { (predicate: (value: Fizz | Falsey, index: number, array: (Fizz | Falsey)[]) => value is S, thisArg?: any): S[]; (predicate: (value: Fizz | Falsey, index: number, array: (Fizz | Falsey)[]) => unknown, thisArg?: any): (Fizz | Falsey)[]; } | { (predicate: (value: Buzz | Falsey, index: number, array: (Buzz | Falsey)[]) => value is S, thisArg?: any): S[]; (predicate: (value: Buzz | Falsey, index: number, array: (Buzz | Falsey)[]) => unknown, thisArg?: any): (Buzz | Falsey)[]; } >([] as (Fizz|Falsey)[] | (Buzz|Falsey)[]) : (Fizz | Falsey)[] | (Buzz | Falsey)[] >[] as (Fizz|Falsey)[] | (Buzz|Falsey)[] : (Fizz | Falsey)[] | (Buzz | Falsey)[] >[] : undefined[] ->filter : { (predicate: (value: Fizz | Falsey, index: number, array: (Fizz | Falsey)[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): Fizz[]; (predicate: (value: Fizz | Falsey, index: number, array: (Fizz | Falsey)[]) => unknown, thisArg?: any): (Fizz | Falsey)[]; } | { (predicate: (value: Buzz | Falsey, index: number, array: (Buzz | Falsey)[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): Buzz[]; (predicate: (value: Buzz | Falsey, index: number, array: (Buzz | Falsey)[]) => unknown, thisArg?: any): (Buzz | Falsey)[]; } +>filter : { (predicate: (value: Fizz | Falsey, index: number, array: (Fizz | Falsey)[]) => value is S, thisArg?: any): S[]; (predicate: (value: Fizz | Falsey, index: number, array: (Fizz | Falsey)[]) => unknown, thisArg?: any): (Fizz | Falsey)[]; } | { (predicate: (value: Buzz | Falsey, index: number, array: (Buzz | Falsey)[]) => value is S, thisArg?: any): S[]; (predicate: (value: Buzz | Falsey, index: number, array: (Buzz | Falsey)[]) => unknown, thisArg?: any): (Buzz | Falsey)[]; } >isBuzz : (x: unknown) => x is Buzz ([] as (Fizz|Falsey)[] | (Buzz|Falsey)[]).filter(x => x && typeof x.member === "number"); // expect type (Fizz|Buzz|Falsey)[] ->([] as (Fizz|Falsey)[] | (Buzz|Falsey)[]).filter(x => x && typeof x.member === "number") : (Fizz | Falsey)[] | (Buzz | Falsey)[] ->([] as (Fizz|Falsey)[] | (Buzz|Falsey)[]).filter : { (predicate: (value: Fizz | Falsey, index: number, array: (Fizz | Falsey)[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): Fizz[]; (predicate: (value: Fizz | Falsey, index: number, array: (Fizz | Falsey)[]) => unknown, thisArg?: any): (Fizz | Falsey)[]; } | { (predicate: (value: Buzz | Falsey, index: number, array: (Buzz | Falsey)[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): Buzz[]; (predicate: (value: Buzz | Falsey, index: number, array: (Buzz | Falsey)[]) => unknown, thisArg?: any): (Buzz | Falsey)[]; } +>([] as (Fizz|Falsey)[] | (Buzz|Falsey)[]).filter(x => x && typeof x.member === "number") : (Fizz | Buzz | Falsey)[] +>([] as (Fizz|Falsey)[] | (Buzz|Falsey)[]).filter : { (predicate: (value: Fizz | Falsey, index: number, array: (Fizz | Falsey)[]) => value is S, thisArg?: any): S[]; (predicate: (value: Fizz | Falsey, index: number, array: (Fizz | Falsey)[]) => unknown, thisArg?: any): (Fizz | Falsey)[]; } | { (predicate: (value: Buzz | Falsey, index: number, array: (Buzz | Falsey)[]) => value is S, thisArg?: any): S[]; (predicate: (value: Buzz | Falsey, index: number, array: (Buzz | Falsey)[]) => unknown, thisArg?: any): (Buzz | Falsey)[]; } >([] as (Fizz|Falsey)[] | (Buzz|Falsey)[]) : (Fizz | Falsey)[] | (Buzz | Falsey)[] >[] as (Fizz|Falsey)[] | (Buzz|Falsey)[] : (Fizz | Falsey)[] | (Buzz | Falsey)[] >[] : undefined[] ->filter : { (predicate: (value: Fizz | Falsey, index: number, array: (Fizz | Falsey)[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): Fizz[]; (predicate: (value: Fizz | Falsey, index: number, array: (Fizz | Falsey)[]) => unknown, thisArg?: any): (Fizz | Falsey)[]; } | { (predicate: (value: Buzz | Falsey, index: number, array: (Buzz | Falsey)[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): Buzz[]; (predicate: (value: Buzz | Falsey, index: number, array: (Buzz | Falsey)[]) => unknown, thisArg?: any): (Buzz | Falsey)[]; } +>filter : { (predicate: (value: Fizz | Falsey, index: number, array: (Fizz | Falsey)[]) => value is S, thisArg?: any): S[]; (predicate: (value: Fizz | Falsey, index: number, array: (Fizz | Falsey)[]) => unknown, thisArg?: any): (Fizz | Falsey)[]; } | { (predicate: (value: Buzz | Falsey, index: number, array: (Buzz | Falsey)[]) => value is S, thisArg?: any): S[]; (predicate: (value: Buzz | Falsey, index: number, array: (Buzz | Falsey)[]) => unknown, thisArg?: any): (Buzz | Falsey)[]; } >x => x && typeof x.member === "number" : (x: Fizz | Buzz | Falsey) => boolean >x : Fizz | Buzz | Falsey >x && typeof x.member === "number" : boolean diff --git a/tests/baselines/reference/unionOfArraysFilterCall.symbols b/tests/baselines/reference/unionOfArraysFilterCall.symbols index 85859f4fe0cf6..cc4d8805737a7 100644 --- a/tests/baselines/reference/unionOfArraysFilterCall.symbols +++ b/tests/baselines/reference/unionOfArraysFilterCall.symbols @@ -22,20 +22,20 @@ interface Buzz { } ([] as Fizz[] | Buzz[]).filter(item => item.id < 5); ->([] as Fizz[] | Buzz[]).filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) +>([] as Fizz[] | Buzz[]).filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >Fizz : Symbol(Fizz, Decl(unionOfArraysFilterCall.ts, 0, 0)) >Buzz : Symbol(Buzz, Decl(unionOfArraysFilterCall.ts, 3, 1)) ->filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) +>filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >item : Symbol(item, Decl(unionOfArraysFilterCall.ts, 10, 31)) >item.id : Symbol(id, Decl(unionOfArraysFilterCall.ts, 0, 16), Decl(unionOfArraysFilterCall.ts, 5, 16)) >item : Symbol(item, Decl(unionOfArraysFilterCall.ts, 10, 31)) >id : Symbol(id, Decl(unionOfArraysFilterCall.ts, 0, 16), Decl(unionOfArraysFilterCall.ts, 5, 16)) ([] as Fizz[] | readonly Buzz[]).filter(item => item.id < 5); ->([] as Fizz[] | readonly Buzz[]).filter : Symbol(filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) +>([] as Fizz[] | readonly Buzz[]).filter : Symbol(filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >Fizz : Symbol(Fizz, Decl(unionOfArraysFilterCall.ts, 0, 0)) >Buzz : Symbol(Buzz, Decl(unionOfArraysFilterCall.ts, 3, 1)) ->filter : Symbol(filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) +>filter : Symbol(filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >item : Symbol(item, Decl(unionOfArraysFilterCall.ts, 11, 40)) >item.id : Symbol(id, Decl(unionOfArraysFilterCall.ts, 0, 16), Decl(unionOfArraysFilterCall.ts, 5, 16)) >item : Symbol(item, Decl(unionOfArraysFilterCall.ts, 11, 40)) @@ -95,10 +95,10 @@ declare function isBuzz(x: unknown): x is Buzz; ([] as [Fizz] | readonly [Buzz?]).filter(item => item?.id < 5); ->([] as [Fizz] | readonly [Buzz?]).filter : Symbol(filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) +>([] as [Fizz] | readonly [Buzz?]).filter : Symbol(filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >Fizz : Symbol(Fizz, Decl(unionOfArraysFilterCall.ts, 0, 0)) >Buzz : Symbol(Buzz, Decl(unionOfArraysFilterCall.ts, 3, 1)) ->filter : Symbol(filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --) ... and 1 more) +>filter : Symbol(filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >item : Symbol(item, Decl(unionOfArraysFilterCall.ts, 24, 41)) >item?.id : Symbol(id, Decl(unionOfArraysFilterCall.ts, 0, 16), Decl(unionOfArraysFilterCall.ts, 5, 16)) >item : Symbol(item, Decl(unionOfArraysFilterCall.ts, 24, 41)) diff --git a/tests/baselines/reference/unionOfArraysFilterCall.types b/tests/baselines/reference/unionOfArraysFilterCall.types index 2af823e557c65..6ed4be099fd78 100644 --- a/tests/baselines/reference/unionOfArraysFilterCall.types +++ b/tests/baselines/reference/unionOfArraysFilterCall.types @@ -18,12 +18,12 @@ interface Buzz { } ([] as Fizz[] | Buzz[]).filter(item => item.id < 5); ->([] as Fizz[] | Buzz[]).filter(item => item.id < 5) : Fizz[] | Buzz[] ->([] as Fizz[] | Buzz[]).filter : { (predicate: (value: Fizz, index: number, array: Fizz[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): Fizz[]; (predicate: (value: Fizz, index: number, array: Fizz[]) => unknown, thisArg?: any): Fizz[]; } | { (predicate: (value: Buzz, index: number, array: Buzz[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): Buzz[]; (predicate: (value: Buzz, index: number, array: Buzz[]) => unknown, thisArg?: any): Buzz[]; } +>([] as Fizz[] | Buzz[]).filter(item => item.id < 5) : (Fizz | Buzz)[] +>([] as Fizz[] | Buzz[]).filter : { (predicate: (value: Fizz, index: number, array: Fizz[]) => value is S, thisArg?: any): S[]; (predicate: (value: Fizz, index: number, array: Fizz[]) => unknown, thisArg?: any): Fizz[]; } | { (predicate: (value: Buzz, index: number, array: Buzz[]) => value is S, thisArg?: any): S[]; (predicate: (value: Buzz, index: number, array: Buzz[]) => unknown, thisArg?: any): Buzz[]; } >([] as Fizz[] | Buzz[]) : Fizz[] | Buzz[] >[] as Fizz[] | Buzz[] : Fizz[] | Buzz[] >[] : undefined[] ->filter : { (predicate: (value: Fizz, index: number, array: Fizz[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): Fizz[]; (predicate: (value: Fizz, index: number, array: Fizz[]) => unknown, thisArg?: any): Fizz[]; } | { (predicate: (value: Buzz, index: number, array: Buzz[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): Buzz[]; (predicate: (value: Buzz, index: number, array: Buzz[]) => unknown, thisArg?: any): Buzz[]; } +>filter : { (predicate: (value: Fizz, index: number, array: Fizz[]) => value is S, thisArg?: any): S[]; (predicate: (value: Fizz, index: number, array: Fizz[]) => unknown, thisArg?: any): Fizz[]; } | { (predicate: (value: Buzz, index: number, array: Buzz[]) => value is S, thisArg?: any): S[]; (predicate: (value: Buzz, index: number, array: Buzz[]) => unknown, thisArg?: any): Buzz[]; } >item => item.id < 5 : (item: Fizz | Buzz) => boolean >item : Fizz | Buzz >item.id < 5 : boolean @@ -33,12 +33,12 @@ interface Buzz { >5 : 5 ([] as Fizz[] | readonly Buzz[]).filter(item => item.id < 5); ->([] as Fizz[] | readonly Buzz[]).filter(item => item.id < 5) : Fizz[] | Buzz[] ->([] as Fizz[] | readonly Buzz[]).filter : { (predicate: (value: Fizz, index: number, array: Fizz[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): Fizz[]; (predicate: (value: Fizz, index: number, array: Fizz[]) => unknown, thisArg?: any): Fizz[]; } | { (predicate: (value: Buzz, index: number, array: readonly Buzz[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): Buzz[]; (predicate: (value: Buzz, index: number, array: readonly Buzz[]) => unknown, thisArg?: any): Buzz[]; } +>([] as Fizz[] | readonly Buzz[]).filter(item => item.id < 5) : (Fizz | Buzz)[] +>([] as Fizz[] | readonly Buzz[]).filter : { (predicate: (value: Fizz, index: number, array: Fizz[]) => value is S, thisArg?: any): S[]; (predicate: (value: Fizz, index: number, array: Fizz[]) => unknown, thisArg?: any): Fizz[]; } | { (predicate: (value: Buzz, index: number, array: readonly Buzz[]) => value is S, thisArg?: any): S[]; (predicate: (value: Buzz, index: number, array: readonly Buzz[]) => unknown, thisArg?: any): Buzz[]; } >([] as Fizz[] | readonly Buzz[]) : Fizz[] | readonly Buzz[] >[] as Fizz[] | readonly Buzz[] : Fizz[] | readonly Buzz[] >[] : undefined[] ->filter : { (predicate: (value: Fizz, index: number, array: Fizz[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): Fizz[]; (predicate: (value: Fizz, index: number, array: Fizz[]) => unknown, thisArg?: any): Fizz[]; } | { (predicate: (value: Buzz, index: number, array: readonly Buzz[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): Buzz[]; (predicate: (value: Buzz, index: number, array: readonly Buzz[]) => unknown, thisArg?: any): Buzz[]; } +>filter : { (predicate: (value: Fizz, index: number, array: Fizz[]) => value is S, thisArg?: any): S[]; (predicate: (value: Fizz, index: number, array: Fizz[]) => unknown, thisArg?: any): Fizz[]; } | { (predicate: (value: Buzz, index: number, array: readonly Buzz[]) => value is S, thisArg?: any): S[]; (predicate: (value: Buzz, index: number, array: readonly Buzz[]) => unknown, thisArg?: any): Buzz[]; } >item => item.id < 5 : (item: Fizz | Buzz) => boolean >item : Fizz | Buzz >item.id < 5 : boolean @@ -49,11 +49,11 @@ interface Buzz { ([] as Fizz[] | Buzz[]).find(item => item); >([] as Fizz[] | Buzz[]).find(item => item) : Fizz | Buzz ->([] as Fizz[] | Buzz[]).find : { (predicate: (value: Buzz, index: number, obj: Buzz[]) => value is S, thisArg?: any): S; (predicate: (value: Buzz, index: number, obj: Buzz[]) => unknown, thisArg?: any): Buzz; } | { (predicate: (value: Fizz, index: number, obj: Fizz[]) => value is S, thisArg?: any): S; (predicate: (value: Fizz, index: number, obj: Fizz[]) => unknown, thisArg?: any): Fizz; } +>([] as Fizz[] | Buzz[]).find : { (predicate: (value: Fizz, index: number, obj: Fizz[]) => value is S, thisArg?: any): S; (predicate: (value: Fizz, index: number, obj: Fizz[]) => unknown, thisArg?: any): Fizz; } | { (predicate: (value: Buzz, index: number, obj: Buzz[]) => value is S, thisArg?: any): S; (predicate: (value: Buzz, index: number, obj: Buzz[]) => unknown, thisArg?: any): Buzz; } >([] as Fizz[] | Buzz[]) : Fizz[] | Buzz[] >[] as Fizz[] | Buzz[] : Fizz[] | Buzz[] >[] : undefined[] ->find : { (predicate: (value: Buzz, index: number, obj: Buzz[]) => value is S, thisArg?: any): S; (predicate: (value: Buzz, index: number, obj: Buzz[]) => unknown, thisArg?: any): Buzz; } | { (predicate: (value: Fizz, index: number, obj: Fizz[]) => value is S, thisArg?: any): S; (predicate: (value: Fizz, index: number, obj: Fizz[]) => unknown, thisArg?: any): Fizz; } +>find : { (predicate: (value: Fizz, index: number, obj: Fizz[]) => value is S, thisArg?: any): S; (predicate: (value: Fizz, index: number, obj: Fizz[]) => unknown, thisArg?: any): Fizz; } | { (predicate: (value: Buzz, index: number, obj: Buzz[]) => value is S, thisArg?: any): S; (predicate: (value: Buzz, index: number, obj: Buzz[]) => unknown, thisArg?: any): Buzz; } >item => item : (item: Fizz | Buzz) => Fizz | Buzz >item : Fizz | Buzz >item : Fizz | Buzz @@ -64,11 +64,11 @@ declare function isFizz(x: unknown): x is Fizz; ([] as Fizz[] | Buzz[]).find(isFizz); >([] as Fizz[] | Buzz[]).find(isFizz) : Fizz ->([] as Fizz[] | Buzz[]).find : { (predicate: (value: Buzz, index: number, obj: Buzz[]) => value is S, thisArg?: any): S; (predicate: (value: Buzz, index: number, obj: Buzz[]) => unknown, thisArg?: any): Buzz; } | { (predicate: (value: Fizz, index: number, obj: Fizz[]) => value is S, thisArg?: any): S; (predicate: (value: Fizz, index: number, obj: Fizz[]) => unknown, thisArg?: any): Fizz; } +>([] as Fizz[] | Buzz[]).find : { (predicate: (value: Fizz, index: number, obj: Fizz[]) => value is S, thisArg?: any): S; (predicate: (value: Fizz, index: number, obj: Fizz[]) => unknown, thisArg?: any): Fizz; } | { (predicate: (value: Buzz, index: number, obj: Buzz[]) => value is S, thisArg?: any): S; (predicate: (value: Buzz, index: number, obj: Buzz[]) => unknown, thisArg?: any): Buzz; } >([] as Fizz[] | Buzz[]) : Fizz[] | Buzz[] >[] as Fizz[] | Buzz[] : Fizz[] | Buzz[] >[] : undefined[] ->find : { (predicate: (value: Buzz, index: number, obj: Buzz[]) => value is S, thisArg?: any): S; (predicate: (value: Buzz, index: number, obj: Buzz[]) => unknown, thisArg?: any): Buzz; } | { (predicate: (value: Fizz, index: number, obj: Fizz[]) => value is S, thisArg?: any): S; (predicate: (value: Fizz, index: number, obj: Fizz[]) => unknown, thisArg?: any): Fizz; } +>find : { (predicate: (value: Fizz, index: number, obj: Fizz[]) => value is S, thisArg?: any): S; (predicate: (value: Fizz, index: number, obj: Fizz[]) => unknown, thisArg?: any): Fizz; } | { (predicate: (value: Buzz, index: number, obj: Buzz[]) => value is S, thisArg?: any): S; (predicate: (value: Buzz, index: number, obj: Buzz[]) => unknown, thisArg?: any): Buzz; } >isFizz : (x: unknown) => x is Fizz declare function isBuzz(x: unknown): x is Buzz; @@ -77,20 +77,20 @@ declare function isBuzz(x: unknown): x is Buzz; ([] as Fizz[] | Buzz[]).find(isBuzz); >([] as Fizz[] | Buzz[]).find(isBuzz) : Buzz ->([] as Fizz[] | Buzz[]).find : { (predicate: (value: Buzz, index: number, obj: Buzz[]) => value is S, thisArg?: any): S; (predicate: (value: Buzz, index: number, obj: Buzz[]) => unknown, thisArg?: any): Buzz; } | { (predicate: (value: Fizz, index: number, obj: Fizz[]) => value is S, thisArg?: any): S; (predicate: (value: Fizz, index: number, obj: Fizz[]) => unknown, thisArg?: any): Fizz; } +>([] as Fizz[] | Buzz[]).find : { (predicate: (value: Fizz, index: number, obj: Fizz[]) => value is S, thisArg?: any): S; (predicate: (value: Fizz, index: number, obj: Fizz[]) => unknown, thisArg?: any): Fizz; } | { (predicate: (value: Buzz, index: number, obj: Buzz[]) => value is S, thisArg?: any): S; (predicate: (value: Buzz, index: number, obj: Buzz[]) => unknown, thisArg?: any): Buzz; } >([] as Fizz[] | Buzz[]) : Fizz[] | Buzz[] >[] as Fizz[] | Buzz[] : Fizz[] | Buzz[] >[] : undefined[] ->find : { (predicate: (value: Buzz, index: number, obj: Buzz[]) => value is S, thisArg?: any): S; (predicate: (value: Buzz, index: number, obj: Buzz[]) => unknown, thisArg?: any): Buzz; } | { (predicate: (value: Fizz, index: number, obj: Fizz[]) => value is S, thisArg?: any): S; (predicate: (value: Fizz, index: number, obj: Fizz[]) => unknown, thisArg?: any): Fizz; } +>find : { (predicate: (value: Fizz, index: number, obj: Fizz[]) => value is S, thisArg?: any): S; (predicate: (value: Fizz, index: number, obj: Fizz[]) => unknown, thisArg?: any): Fizz; } | { (predicate: (value: Buzz, index: number, obj: Buzz[]) => value is S, thisArg?: any): S; (predicate: (value: Buzz, index: number, obj: Buzz[]) => unknown, thisArg?: any): Buzz; } >isBuzz : (x: unknown) => x is Buzz ([] as Fizz[] | Buzz[]).every(item => item.id < 5); >([] as Fizz[] | Buzz[]).every(item => item.id < 5) : boolean ->([] as Fizz[] | Buzz[]).every : { (predicate: (value: Buzz, index: number, array: Buzz[]) => value is S, thisArg?: any): this is S[]; (predicate: (value: Buzz, index: number, array: Buzz[]) => unknown, thisArg?: any): boolean; } | { (predicate: (value: Fizz, index: number, array: Fizz[]) => value is S, thisArg?: any): this is S[]; (predicate: (value: Fizz, index: number, array: Fizz[]) => unknown, thisArg?: any): boolean; } +>([] as Fizz[] | Buzz[]).every : { (predicate: (value: Fizz, index: number, array: Fizz[]) => value is S, thisArg?: any): this is S[]; (predicate: (value: Fizz, index: number, array: Fizz[]) => unknown, thisArg?: any): boolean; } | { (predicate: (value: Buzz, index: number, array: Buzz[]) => value is S, thisArg?: any): this is S[]; (predicate: (value: Buzz, index: number, array: Buzz[]) => unknown, thisArg?: any): boolean; } >([] as Fizz[] | Buzz[]) : Fizz[] | Buzz[] >[] as Fizz[] | Buzz[] : Fizz[] | Buzz[] >[] : undefined[] ->every : { (predicate: (value: Buzz, index: number, array: Buzz[]) => value is S, thisArg?: any): this is S[]; (predicate: (value: Buzz, index: number, array: Buzz[]) => unknown, thisArg?: any): boolean; } | { (predicate: (value: Fizz, index: number, array: Fizz[]) => value is S, thisArg?: any): this is S[]; (predicate: (value: Fizz, index: number, array: Fizz[]) => unknown, thisArg?: any): boolean; } +>every : { (predicate: (value: Fizz, index: number, array: Fizz[]) => value is S, thisArg?: any): this is S[]; (predicate: (value: Fizz, index: number, array: Fizz[]) => unknown, thisArg?: any): boolean; } | { (predicate: (value: Buzz, index: number, array: Buzz[]) => value is S, thisArg?: any): this is S[]; (predicate: (value: Buzz, index: number, array: Buzz[]) => unknown, thisArg?: any): boolean; } >item => item.id < 5 : (item: Fizz | Buzz) => boolean >item : Fizz | Buzz >item.id < 5 : boolean @@ -101,23 +101,23 @@ declare function isBuzz(x: unknown): x is Buzz; ([] as Fizz[] | Buzz[]).reduce(item => item); >([] as Fizz[] | Buzz[]).reduce(item => item) : Fizz | Buzz ->([] as Fizz[] | Buzz[]).reduce : { (callbackfn: (previousValue: Buzz, currentValue: Buzz, currentIndex: number, array: Buzz[]) => Buzz): Buzz; (callbackfn: (previousValue: Buzz, currentValue: Buzz, currentIndex: number, array: Buzz[]) => Buzz, initialValue: Buzz): Buzz; (callbackfn: (previousValue: U, currentValue: Buzz, currentIndex: number, array: Buzz[]) => U, initialValue: U): U; } | { (callbackfn: (previousValue: Fizz, currentValue: Fizz, currentIndex: number, array: Fizz[]) => Fizz): Fizz; (callbackfn: (previousValue: Fizz, currentValue: Fizz, currentIndex: number, array: Fizz[]) => Fizz, initialValue: Fizz): Fizz; (callbackfn: (previousValue: U, currentValue: Fizz, currentIndex: number, array: Fizz[]) => U, initialValue: U): U; } +>([] as Fizz[] | Buzz[]).reduce : { (callbackfn: (previousValue: Fizz, currentValue: Fizz, currentIndex: number, array: Fizz[]) => Fizz): Fizz; (callbackfn: (previousValue: Fizz, currentValue: Fizz, currentIndex: number, array: Fizz[]) => Fizz, initialValue: Fizz): Fizz; (callbackfn: (previousValue: U, currentValue: Fizz, currentIndex: number, array: Fizz[]) => U, initialValue: U): U; } | { (callbackfn: (previousValue: Buzz, currentValue: Buzz, currentIndex: number, array: Buzz[]) => Buzz): Buzz; (callbackfn: (previousValue: Buzz, currentValue: Buzz, currentIndex: number, array: Buzz[]) => Buzz, initialValue: Buzz): Buzz; (callbackfn: (previousValue: U, currentValue: Buzz, currentIndex: number, array: Buzz[]) => U, initialValue: U): U; } >([] as Fizz[] | Buzz[]) : Fizz[] | Buzz[] >[] as Fizz[] | Buzz[] : Fizz[] | Buzz[] >[] : undefined[] ->reduce : { (callbackfn: (previousValue: Buzz, currentValue: Buzz, currentIndex: number, array: Buzz[]) => Buzz): Buzz; (callbackfn: (previousValue: Buzz, currentValue: Buzz, currentIndex: number, array: Buzz[]) => Buzz, initialValue: Buzz): Buzz; (callbackfn: (previousValue: U, currentValue: Buzz, currentIndex: number, array: Buzz[]) => U, initialValue: U): U; } | { (callbackfn: (previousValue: Fizz, currentValue: Fizz, currentIndex: number, array: Fizz[]) => Fizz): Fizz; (callbackfn: (previousValue: Fizz, currentValue: Fizz, currentIndex: number, array: Fizz[]) => Fizz, initialValue: Fizz): Fizz; (callbackfn: (previousValue: U, currentValue: Fizz, currentIndex: number, array: Fizz[]) => U, initialValue: U): U; } +>reduce : { (callbackfn: (previousValue: Fizz, currentValue: Fizz, currentIndex: number, array: Fizz[]) => Fizz): Fizz; (callbackfn: (previousValue: Fizz, currentValue: Fizz, currentIndex: number, array: Fizz[]) => Fizz, initialValue: Fizz): Fizz; (callbackfn: (previousValue: U, currentValue: Fizz, currentIndex: number, array: Fizz[]) => U, initialValue: U): U; } | { (callbackfn: (previousValue: Buzz, currentValue: Buzz, currentIndex: number, array: Buzz[]) => Buzz): Buzz; (callbackfn: (previousValue: Buzz, currentValue: Buzz, currentIndex: number, array: Buzz[]) => Buzz, initialValue: Buzz): Buzz; (callbackfn: (previousValue: U, currentValue: Buzz, currentIndex: number, array: Buzz[]) => U, initialValue: U): U; } >item => item : (item: Fizz | Buzz) => Fizz | Buzz >item : Fizz | Buzz >item : Fizz | Buzz ([] as [Fizz] | readonly [Buzz?]).filter(item => item?.id < 5); ->([] as [Fizz] | readonly [Buzz?]).filter(item => item?.id < 5) : Fizz[] | Buzz[] ->([] as [Fizz] | readonly [Buzz?]).filter : { (predicate: (value: Fizz, index: number, array: Fizz[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): Fizz[]; (predicate: (value: Fizz, index: number, array: Fizz[]) => unknown, thisArg?: any): Fizz[]; } | { (predicate: (value: Buzz, index: number, array: readonly Buzz[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): Buzz[]; (predicate: (value: Buzz, index: number, array: readonly Buzz[]) => unknown, thisArg?: any): Buzz[]; } +>([] as [Fizz] | readonly [Buzz?]).filter(item => item?.id < 5) : (Fizz | Buzz)[] +>([] as [Fizz] | readonly [Buzz?]).filter : { (predicate: (value: Fizz, index: number, array: Fizz[]) => value is S, thisArg?: any): S[]; (predicate: (value: Fizz, index: number, array: Fizz[]) => unknown, thisArg?: any): Fizz[]; } | { (predicate: (value: Buzz, index: number, array: readonly Buzz[]) => value is S, thisArg?: any): S[]; (predicate: (value: Buzz, index: number, array: readonly Buzz[]) => unknown, thisArg?: any): Buzz[]; } >([] as [Fizz] | readonly [Buzz?]) : [Fizz] | readonly [Buzz?] >[] as [Fizz] | readonly [Buzz?] : [Fizz] | readonly [Buzz?] >[] : [] ->filter : { (predicate: (value: Fizz, index: number, array: Fizz[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): Fizz[]; (predicate: (value: Fizz, index: number, array: Fizz[]) => unknown, thisArg?: any): Fizz[]; } | { (predicate: (value: Buzz, index: number, array: readonly Buzz[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): Buzz[]; (predicate: (value: Buzz, index: number, array: readonly Buzz[]) => unknown, thisArg?: any): Buzz[]; } +>filter : { (predicate: (value: Fizz, index: number, array: Fizz[]) => value is S, thisArg?: any): S[]; (predicate: (value: Fizz, index: number, array: Fizz[]) => unknown, thisArg?: any): Fizz[]; } | { (predicate: (value: Buzz, index: number, array: readonly Buzz[]) => value is S, thisArg?: any): S[]; (predicate: (value: Buzz, index: number, array: readonly Buzz[]) => unknown, thisArg?: any): Buzz[]; } >item => item?.id < 5 : (item: Fizz | Buzz) => boolean >item : Fizz | Buzz >item?.id < 5 : boolean diff --git a/tests/baselines/reference/unknownSymbolOffContextualType1.symbols b/tests/baselines/reference/unknownSymbolOffContextualType1.symbols index 934857a00764b..0d190f79a9d62 100644 --- a/tests/baselines/reference/unknownSymbolOffContextualType1.symbols +++ b/tests/baselines/reference/unknownSymbolOffContextualType1.symbols @@ -39,9 +39,9 @@ function getMaxWidth(elementNames: string[]) { }); var enabled = elements.filter(function (e) { >enabled : Symbol(enabled, Decl(unknownSymbolOffContextualType1.ts, 11, 7)) ->elements.filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>elements.filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >elements : Symbol(elements, Decl(unknownSymbolOffContextualType1.ts, 8, 7)) ->filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) >e : Symbol(e, Decl(unknownSymbolOffContextualType1.ts, 11, 44)) return !e.isDisabled; diff --git a/tests/baselines/reference/unknownSymbolOffContextualType1.types b/tests/baselines/reference/unknownSymbolOffContextualType1.types index a1c7696e16479..d7bfc027579eb 100644 --- a/tests/baselines/reference/unknownSymbolOffContextualType1.types +++ b/tests/baselines/reference/unknownSymbolOffContextualType1.types @@ -37,9 +37,9 @@ function getMaxWidth(elementNames: string[]) { var enabled = elements.filter(function (e) { >enabled : HTMLElement[] >elements.filter(function (e) { return !e.isDisabled; }) : HTMLElement[] ->elements.filter : { (predicate: (value: HTMLElement, index: number, array: HTMLElement[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): HTMLElement[]; (predicate: (value: HTMLElement, index: number, array: HTMLElement[]) => unknown, thisArg?: any): HTMLElement[]; } +>elements.filter : { (predicate: (value: HTMLElement, index: number, array: HTMLElement[]) => value is S, thisArg?: any): S[]; (predicate: (value: HTMLElement, index: number, array: HTMLElement[]) => unknown, thisArg?: any): HTMLElement[]; } >elements : HTMLElement[] ->filter : { (predicate: (value: HTMLElement, index: number, array: HTMLElement[]) => value is S, thisArg?: any): S[]; (predicate: BooleanConstructor, thisArg?: any): HTMLElement[]; (predicate: (value: HTMLElement, index: number, array: HTMLElement[]) => unknown, thisArg?: any): HTMLElement[]; } +>filter : { (predicate: (value: HTMLElement, index: number, array: HTMLElement[]) => value is S, thisArg?: any): S[]; (predicate: (value: HTMLElement, index: number, array: HTMLElement[]) => unknown, thisArg?: any): HTMLElement[]; } >function (e) { return !e.isDisabled; } : (e: HTMLElement) => boolean >e : HTMLElement