From 829285fdc2ed55cf574c3716a7b19fe68da2e063 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Mon, 28 Dec 2020 17:07:38 -1000 Subject: [PATCH] Accept new baselines --- .../reference/checkJsxChildrenProperty3.types | 4 ++-- .../reference/checkJsxChildrenProperty4.types | 4 ++-- .../contextualTypingOfOptionalMembers.types | 4 ++-- ...essPropertyCheckingWhenTargetIsIntersection.types | 4 ++-- .../reference/instanceOfAssignability.types | 4 ++-- .../reference/intersectionWithUnionConstraint.types | 8 ++++---- .../jsxComplexSignatureHasApplicabilityError.types | 12 ++++++------ .../reference/narrowingByTypeofInSwitch.types | 6 +++--- .../partialOfLargeAPIIsAbleToBeWorkedWith.types | 2 +- .../tsxSpreadAttributesResolution6.errors.txt | 4 ++-- .../reference/typeInferenceLiteralUnion.types | 4 ++-- .../reference/unionAndIntersectionInference3.types | 8 ++++---- .../reference/unionWithIndexSignature.types | 6 +++--- 13 files changed, 35 insertions(+), 35 deletions(-) diff --git a/tests/baselines/reference/checkJsxChildrenProperty3.types b/tests/baselines/reference/checkJsxChildrenProperty3.types index f6c917f6149..ceb2a1cf09f 100644 --- a/tests/baselines/reference/checkJsxChildrenProperty3.types +++ b/tests/baselines/reference/checkJsxChildrenProperty3.types @@ -31,11 +31,11 @@ class FetchUser extends React.Component { ? this.props.children(this.state.result) >this.props.children(this.state.result) : JSX.Element ->this.props.children : ((user: IUser) => JSX.Element) | (((user: IUser) => JSX.Element) & string) | (((user: IUser) => JSX.Element) & number) | (((user: IUser) => JSX.Element) & false) | (((user: IUser) => JSX.Element) & true) | (((user: IUser) => JSX.Element) & React.ReactElement) | (((user: IUser) => JSX.Element) & (boolean | any[] | React.ReactChild)[]) +>this.props.children : ((user: IUser) => JSX.Element) & React.ReactNode >this.props : IFetchUserProps & { children?: React.ReactNode; } >this : this >props : IFetchUserProps & { children?: React.ReactNode; } ->children : ((user: IUser) => JSX.Element) | (((user: IUser) => JSX.Element) & string) | (((user: IUser) => JSX.Element) & number) | (((user: IUser) => JSX.Element) & false) | (((user: IUser) => JSX.Element) & true) | (((user: IUser) => JSX.Element) & React.ReactElement) | (((user: IUser) => JSX.Element) & (boolean | any[] | React.ReactChild)[]) +>children : ((user: IUser) => JSX.Element) & React.ReactNode >this.state.result : any >this.state : any >this : this diff --git a/tests/baselines/reference/checkJsxChildrenProperty4.types b/tests/baselines/reference/checkJsxChildrenProperty4.types index c7819ca956e..a8828ed5520 100644 --- a/tests/baselines/reference/checkJsxChildrenProperty4.types +++ b/tests/baselines/reference/checkJsxChildrenProperty4.types @@ -31,11 +31,11 @@ class FetchUser extends React.Component { ? this.props.children(this.state.result) >this.props.children(this.state.result) : JSX.Element ->this.props.children : ((user: IUser) => JSX.Element) | (((user: IUser) => JSX.Element) & string) | (((user: IUser) => JSX.Element) & number) | (((user: IUser) => JSX.Element) & false) | (((user: IUser) => JSX.Element) & true) | (((user: IUser) => JSX.Element) & React.ReactElement) | (((user: IUser) => JSX.Element) & (boolean | any[] | React.ReactChild)[]) +>this.props.children : ((user: IUser) => JSX.Element) & React.ReactNode >this.props : IFetchUserProps & { children?: React.ReactNode; } >this : this >props : IFetchUserProps & { children?: React.ReactNode; } ->children : ((user: IUser) => JSX.Element) | (((user: IUser) => JSX.Element) & string) | (((user: IUser) => JSX.Element) & number) | (((user: IUser) => JSX.Element) & false) | (((user: IUser) => JSX.Element) & true) | (((user: IUser) => JSX.Element) & React.ReactElement) | (((user: IUser) => JSX.Element) & (boolean | any[] | React.ReactChild)[]) +>children : ((user: IUser) => JSX.Element) & React.ReactNode >this.state.result : any >this.state : any >this : this diff --git a/tests/baselines/reference/contextualTypingOfOptionalMembers.types b/tests/baselines/reference/contextualTypingOfOptionalMembers.types index b1d4190cb34..8f2d051149a 100644 --- a/tests/baselines/reference/contextualTypingOfOptionalMembers.types +++ b/tests/baselines/reference/contextualTypingOfOptionalMembers.types @@ -173,14 +173,14 @@ interface ActionsObjectOr { declare function App4>(props: Options["actions"] & { state: State }): JSX.Element; >App4 : >(props: Options["actions"] & { state: State;}) => JSX.Element ->props : (string & { state: State; }) | (Actions & { state: State; }) +>props : (string | Actions) & { state: State; } >state : State >JSX : any const a = s} />; // TODO: should be number => number, but JSX resolution is missing an inferential pass >a : JSX.Element > s} /> : JSX.Element ->App4 : >(props: (string & { state: State; }) | (Actions & { state: State; })) => JSX.Element +>App4 : >(props: (string | Actions) & { state: State; }) => JSX.Element >state : number >100 : 100 >foo : (s: number) => number diff --git a/tests/baselines/reference/deepExcessPropertyCheckingWhenTargetIsIntersection.types b/tests/baselines/reference/deepExcessPropertyCheckingWhenTargetIsIntersection.types index e00f87383c6..b8471ffedba 100644 --- a/tests/baselines/reference/deepExcessPropertyCheckingWhenTargetIsIntersection.types +++ b/tests/baselines/reference/deepExcessPropertyCheckingWhenTargetIsIntersection.types @@ -48,8 +48,8 @@ const TestComponent2: StatelessComponent = (p >TestComponent2 : StatelessComponent >props2 : { x: number; } >x : number ->(props) => { return null;} : (props: (TestProps & { children?: number; }) | ({ props2: { x: number;}; } & { children?: number; })) => any ->props : (TestProps & { children?: number; }) | ({ props2: { x: number; }; } & { children?: number; }) +>(props) => { return null;} : (props: (TestProps | { props2: { x: number;}; }) & { children?: number; }) => any +>props : (TestProps | { props2: { x: number; }; }) & { children?: number; } return null; >null : null diff --git a/tests/baselines/reference/instanceOfAssignability.types b/tests/baselines/reference/instanceOfAssignability.types index a927b3bc7d8..9c29abbe894 100644 --- a/tests/baselines/reference/instanceOfAssignability.types +++ b/tests/baselines/reference/instanceOfAssignability.types @@ -104,8 +104,8 @@ function fn4(x: Base|Derived2) { // 1.5: y: {} // Want: Derived1 let y = x; ->y : (Base & Derived1) | (Derived2 & Derived1) ->x : (Base & Derived1) | (Derived2 & Derived1) +>y : (Base | Derived2) & Derived1 +>x : (Base | Derived2) & Derived1 } } diff --git a/tests/baselines/reference/intersectionWithUnionConstraint.types b/tests/baselines/reference/intersectionWithUnionConstraint.types index b209913e75b..ba079e2bf81 100644 --- a/tests/baselines/reference/intersectionWithUnionConstraint.types +++ b/tests/baselines/reference/intersectionWithUnionConstraint.types @@ -48,20 +48,20 @@ type T1 = (string | number | undefined) & (string | null | undefined); // strin function f3(x: T & (number | object | undefined)) { >f3 : (x: T & (number | object | undefined)) => void ->x : (T & undefined) | (T & number) | (T & object) +>x : T & (number | object | undefined) const y: number | undefined = x; >y : number | undefined ->x : (T & undefined) | (T & number) | (T & object) +>x : T & (number | object | undefined) } function f4(x: T & (number | object)) { >f4 : (x: T & (number | object)) => void ->x : (T & number) | (T & object) +>x : T & (number | object) const y: number = x; >y : number ->x : (T & number) | (T & object) +>x : T & (number | object) } function f5(x: keyof T & U) { diff --git a/tests/baselines/reference/jsxComplexSignatureHasApplicabilityError.types b/tests/baselines/reference/jsxComplexSignatureHasApplicabilityError.types index 634a6922291..8bdf3e397db 100644 --- a/tests/baselines/reference/jsxComplexSignatureHasApplicabilityError.types +++ b/tests/baselines/reference/jsxComplexSignatureHasApplicabilityError.types @@ -39,8 +39,8 @@ export function createReactSingleSelect< >React : any return (props) => { ->(props) => { return ( > {...props} multi={false} autosize={false} value={props.value} onChange={(value) => { if (props.onChange) { props.onChange(value === null ? undefined : value); } }} /> ); } : (props: Omit, (keyof Omit & "value") | (keyof Omit & "onChange")> & Props> & { children?: React.ReactNode; }) => JSX.Element ->props : Omit, (keyof Omit & "value") | (keyof Omit & "onChange")> & Props> & { children?: React.ReactNode; } +>(props) => { return ( > {...props} multi={false} autosize={false} value={props.value} onChange={(value) => { if (props.onChange) { props.onChange(value === null ? undefined : value); } }} /> ); } : (props: Omit, keyof Omit & ("value" | "onChange")> & Props> & { children?: React.ReactNode; }) => JSX.Element +>props : Omit, keyof Omit & ("value" | "onChange")> & Props> & { children?: React.ReactNode; } return ( >( > {...props} multi={false} autosize={false} value={props.value} onChange={(value) => { if (props.onChange) { props.onChange(value === null ? undefined : value); } }} /> ) : JSX.Element @@ -50,7 +50,7 @@ export function createReactSingleSelect< >ReactSelectClass : typeof ReactSelectClass {...props} ->props : Omit, (keyof Omit & "value") | (keyof Omit & "onChange")> & Props> & { children?: React.ReactNode; } +>props : Omit, keyof Omit & ("value" | "onChange")> & Props> & { children?: React.ReactNode; } multi={false} >multi : false @@ -63,7 +63,7 @@ export function createReactSingleSelect< value={props.value} >value : ExtractValueType | Option> | undefined >props.value : ExtractValueType | Option> | undefined ->props : Omit, (keyof Omit & "value") | (keyof Omit & "onChange")> & Props> & { children?: React.ReactNode; } +>props : Omit, keyof Omit & ("value" | "onChange")> & Props> & { children?: React.ReactNode; } >value : ExtractValueType | Option> | undefined onChange={(value) => { @@ -73,13 +73,13 @@ export function createReactSingleSelect< if (props.onChange) { >props.onChange : ((value: Option> | undefined) => void) | undefined ->props : Omit, (keyof Omit & "value") | (keyof Omit & "onChange")> & Props> & { children?: React.ReactNode; } +>props : Omit, keyof Omit & ("value" | "onChange")> & Props> & { children?: React.ReactNode; } >onChange : ((value: Option> | undefined) => void) | undefined props.onChange(value === null ? undefined : value); >props.onChange(value === null ? undefined : value) : void >props.onChange : (value: Option> | undefined) => void ->props : Omit, (keyof Omit & "value") | (keyof Omit & "onChange")> & Props> & { children?: React.ReactNode; } +>props : Omit, keyof Omit & ("value" | "onChange")> & Props> & { children?: React.ReactNode; } >onChange : (value: Option> | undefined) => void >value === null ? undefined : value : Option> | Options> | undefined >value === null : boolean diff --git a/tests/baselines/reference/narrowingByTypeofInSwitch.types b/tests/baselines/reference/narrowingByTypeofInSwitch.types index 2a5fadb7b65..42078591ba1 100644 --- a/tests/baselines/reference/narrowingByTypeofInSwitch.types +++ b/tests/baselines/reference/narrowingByTypeofInSwitch.types @@ -173,7 +173,7 @@ function testExtendsUnion(x: T) { >'boolean' : "boolean" >assertBoolean(x) : boolean >assertBoolean : (x: boolean) => boolean ->x : (T & false) | (T & true) +>x : T & boolean case 'function': assertAll(x); return; >'function' : "function" @@ -370,7 +370,7 @@ function testExtendsExplicitDefault(x: T) { >'boolean' : "boolean" >assertBoolean(x) : boolean >assertBoolean : (x: boolean) => boolean ->x : (T & false) | (T & true) +>x : T & boolean case 'function': assertAll(x); return; >'function' : "function" @@ -410,7 +410,7 @@ function testExtendsImplicitDefault(x: T) { >'boolean' : "boolean" >assertBoolean(x) : boolean >assertBoolean : (x: boolean) => boolean ->x : (T & false) | (T & true) +>x : T & boolean case 'function': assertAll(x); return; >'function' : "function" diff --git a/tests/baselines/reference/partialOfLargeAPIIsAbleToBeWorkedWith.types b/tests/baselines/reference/partialOfLargeAPIIsAbleToBeWorkedWith.types index f3b7406a3dd..c1049846285 100644 --- a/tests/baselines/reference/partialOfLargeAPIIsAbleToBeWorkedWith.types +++ b/tests/baselines/reference/partialOfLargeAPIIsAbleToBeWorkedWith.types @@ -222,7 +222,7 @@ for (const k of keys) { obj[k] = () => "12"; // shouldn't cause a complexity error >obj[k] = () => "12" : () => string ->obj[k] : (((x: 0) => string) & ((x: 1) => string) & ((x: 2) => string) & ((x: 3) => string) & ((x: 4) => string) & ((x: 5) => string) & ((x: 6) => string) & ((x: 7) => string) & ((x: 8) => string) & ((x: 9) => string) & ((x: 10) => string) & ((x: 11) => string) & ((x: 12) => string) & ((x: 13) => string) & ((x: 14) => string) & ((x: 15) => string) & ((x: 16) => string) & ((x: 17) => string) & ((x: 18) => string) & ((x: 19) => string) & ((x: 20) => string) & ((x: 21) => string) & ((x: 22) => string) & ((x: 23) => string) & ((x: 24) => string) & ((x: 25) => string) & ((x: 26) => string) & ((x: 27) => string) & ((x: 28) => string) & ((x: 29) => string) & ((x: 30) => string) & ((x: 31) => string) & ((x: 32) => string) & ((x: 33) => string) & ((x: 34) => string) & ((x: 35) => string) & ((x: 36) => string) & ((x: 37) => string) & ((x: 38) => string) & ((x: 39) => string) & ((x: 40) => string) & ((x: 41) => string) & ((x: 42) => string) & ((x: 43) => string) & ((x: 44) => string) & ((x: 45) => string) & ((x: 46) => string) & ((x: 47) => string) & ((x: 48) => string) & ((x: 49) => string) & ((x: 50) => string) & ((x: 51) => string)) | undefined +>obj[k] : ((x: 0) => string) & ((x: 1) => string) & ((x: 2) => string) & ((x: 3) => string) & ((x: 4) => string) & ((x: 5) => string) & ((x: 6) => string) & ((x: 7) => string) & ((x: 8) => string) & ((x: 9) => string) & ((x: 10) => string) & ((x: 11) => string) & ((x: 12) => string) & ((x: 13) => string) & ((x: 14) => string) & ((x: 15) => string) & ((x: 16) => string) & ((x: 17) => string) & ((x: 18) => string) & ((x: 19) => string) & ((x: 20) => string) & ((x: 21) => string) & ((x: 22) => string) & ((x: 23) => string) & ((x: 24) => string) & ((x: 25) => string) & ((x: 26) => string) & ((x: 27) => string) & ((x: 28) => string) & ((x: 29) => string) & ((x: 30) => string) & ((x: 31) => string) & ((x: 32) => string) & ((x: 33) => string) & ((x: 34) => string) & ((x: 35) => string) & ((x: 36) => string) & ((x: 37) => string) & ((x: 38) => string) & ((x: 39) => string) & ((x: 40) => string) & ((x: 41) => string) & ((x: 42) => string) & ((x: 43) => string) & ((x: 44) => string) & ((x: 45) => string) & ((x: 46) => string) & ((x: 47) => string) & ((x: 48) => string) & ((x: 49) => string) & ((x: 50) => string) & ((x: 51) => string) >obj : Partial >k : 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 >() => "12" : () => string diff --git a/tests/baselines/reference/tsxSpreadAttributesResolution6.errors.txt b/tests/baselines/reference/tsxSpreadAttributesResolution6.errors.txt index 0027abe1092..360f8a72ada 100644 --- a/tests/baselines/reference/tsxSpreadAttributesResolution6.errors.txt +++ b/tests/baselines/reference/tsxSpreadAttributesResolution6.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/jsx/file.tsx(13,10): error TS2322: Type '{ editable: true; }' is not assignable to type '(IntrinsicAttributes & IntrinsicClassAttributes & { editable: false; } & { children?: ReactNode; }) | (IntrinsicAttributes & IntrinsicClassAttributes & { editable: true; onEdit: (newText: string) => void; } & { children?: ReactNode; })'. +tests/cases/conformance/jsx/file.tsx(13,10): error TS2322: Type '{ editable: true; }' is not assignable to type 'IntrinsicAttributes & (IntrinsicClassAttributes & (TextProps & { children?: ReactNode; }))'. Property 'onEdit' is missing in type '{ editable: true; }' but required in type '{ editable: true; onEdit: (newText: string) => void; }'. @@ -17,7 +17,7 @@ tests/cases/conformance/jsx/file.tsx(13,10): error TS2322: Type '{ editable: tru // Error let x = ~~~~~~~~~~~~~ -!!! error TS2322: Type '{ editable: true; }' is not assignable to type '(IntrinsicAttributes & IntrinsicClassAttributes & { editable: false; } & { children?: ReactNode; }) | (IntrinsicAttributes & IntrinsicClassAttributes & { editable: true; onEdit: (newText: string) => void; } & { children?: ReactNode; })'. +!!! error TS2322: Type '{ editable: true; }' is not assignable to type 'IntrinsicAttributes & (IntrinsicClassAttributes & (TextProps & { children?: ReactNode; }))'. !!! error TS2322: Property 'onEdit' is missing in type '{ editable: true; }' but required in type '{ editable: true; onEdit: (newText: string) => void; }'. !!! related TS2728 tests/cases/conformance/jsx/file.tsx:4:36: 'onEdit' is declared here. diff --git a/tests/baselines/reference/typeInferenceLiteralUnion.types b/tests/baselines/reference/typeInferenceLiteralUnion.types index 90f4a7635fb..c8718f7515e 100644 --- a/tests/baselines/reference/typeInferenceLiteralUnion.types +++ b/tests/baselines/reference/typeInferenceLiteralUnion.types @@ -59,9 +59,9 @@ let extentMixed: [Primitive | NumCoercible, Primitive | NumCoercible] | [undefin >extentMixed : [undefined, undefined] | [Primitive | NumCoercible, Primitive | NumCoercible] extentMixed = extent([new NumCoercible(10), 13, '12', true]); ->extentMixed = extent([new NumCoercible(10), 13, '12', true]) : [undefined, undefined] | [string | number | boolean | Date | NumCoercible, string | number | boolean | Date | NumCoercible] +>extentMixed = extent([new NumCoercible(10), 13, '12', true]) : [undefined, undefined] | [Primitive | NumCoercible, Primitive | NumCoercible] >extentMixed : [undefined, undefined] | [Primitive | NumCoercible, Primitive | NumCoercible] ->extent([new NumCoercible(10), 13, '12', true]) : [undefined, undefined] | [string | number | boolean | Date | NumCoercible, string | number | boolean | Date | NumCoercible] +>extent([new NumCoercible(10), 13, '12', true]) : [undefined, undefined] | [Primitive | NumCoercible, Primitive | NumCoercible] >extent : (array: (Primitive | T)[]) => [Primitive | T, Primitive | T] | [undefined, undefined] >[new NumCoercible(10), 13, '12', true] : (string | number | true | NumCoercible)[] >new NumCoercible(10) : NumCoercible diff --git a/tests/baselines/reference/unionAndIntersectionInference3.types b/tests/baselines/reference/unionAndIntersectionInference3.types index 481c7387ba1..1e67a3c7f53 100644 --- a/tests/baselines/reference/unionAndIntersectionInference3.types +++ b/tests/baselines/reference/unionAndIntersectionInference3.types @@ -163,7 +163,7 @@ declare function withRouter< C extends ComponentType

>( component: C & ComponentType

->component : (C & FunctionComponent

) | (C & ComponentClass

) +>component : C & ComponentType

): ComponentClass>; @@ -175,7 +175,7 @@ declare const MyComponent: ComponentType; withRouter(MyComponent); >withRouter(MyComponent) : ComponentClass> ->withRouter :

>(component: (C & FunctionComponent

) | (C & ComponentClass

)) => ComponentClass>> +>withRouter :

>(component: C & ComponentType

) => ComponentClass>> >MyComponent : ComponentType // Repro from #33490 @@ -188,7 +188,7 @@ type AB = { a: T } | { b: T }; // T & AB normalizes to T & { a: U } | T & { b: U } below declare function foo(obj: T & AB): [T, U]; >foo : (obj: T & AB) => [T, U] ->obj : (T & { a: U; }) | (T & { b: U; }) +>obj : T & AB declare let ab: AB; >ab : AB @@ -196,6 +196,6 @@ declare let ab: AB; let z = foo(ab); // [AB, string] >z : [{ a: string; } | { b: string; }, string] >foo(ab) : [{ a: string; } | { b: string; }, string] ->foo : (obj: (T & { a: U; }) | (T & { b: U; })) => [T, U] +>foo : (obj: T & AB) => [T, U] >ab : AB diff --git a/tests/baselines/reference/unionWithIndexSignature.types b/tests/baselines/reference/unionWithIndexSignature.types index 649a2074d5d..e3acdf81505 100644 --- a/tests/baselines/reference/unionWithIndexSignature.types +++ b/tests/baselines/reference/unionWithIndexSignature.types @@ -16,12 +16,12 @@ interface StrList { export function foo(arr: T & (NumList | StrList)) { >foo : (arr: T & (NumList | StrList)) => void ->arr : (T & NumList) | (T & StrList) +>arr : T & (NumList | StrList) let zz = arr[1]; // Error >zz : string | number >arr[1] : string | number ->arr : (T & NumList) | (T & StrList) +>arr : T & (NumList | StrList) >1 : 1 } @@ -55,7 +55,7 @@ export function flatten(arr: T) { arr[1]; >arr[1] : number ->arr : (T & Int32Array) | (T & Uint8Array) +>arr : T & (Int32Array | Uint8Array) >1 : 1 } }