From 1b2f3cba83ec03b829e81333d9923de92e7d0858 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Mon, 6 Apr 2020 13:59:09 -0700 Subject: [PATCH] Accept new baselines --- .../checkJsxChildrenCanBeTupleType.errors.txt | 26 +++++++------------ .../reference/checkJsxChildrenProperty3.types | 4 +-- .../checkJsxChildrenProperty4.errors.txt | 21 +++------------ .../reference/checkJsxChildrenProperty4.types | 4 +-- .../reference/controlFlowIfStatement.types | 2 +- .../reference/narrowingByTypeofInSwitch.types | 4 +-- tests/baselines/reference/objectSpread.types | 16 ++++++------ 7 files changed, 28 insertions(+), 49 deletions(-) diff --git a/tests/baselines/reference/checkJsxChildrenCanBeTupleType.errors.txt b/tests/baselines/reference/checkJsxChildrenCanBeTupleType.errors.txt index 0780f4e92c1..010cf8afdcb 100644 --- a/tests/baselines/reference/checkJsxChildrenCanBeTupleType.errors.txt +++ b/tests/baselines/reference/checkJsxChildrenCanBeTupleType.errors.txt @@ -1,12 +1,8 @@ -tests/cases/conformance/jsx/checkJsxChildrenCanBeTupleType.tsx(17,18): error TS2769: No overload matches this call. +tests/cases/conformance/jsx/checkJsxChildrenCanBeTupleType.tsx(20,3): error TS2769: No overload matches this call. Overload 1 of 2, '(props: Readonly): ResizablePanel', gave the following error. - Type '{ children: [Element, Element, Element]; }' is not assignable to type 'Readonly'. - The types of 'children.length' are incompatible between these types. - Type '3' is not assignable to type '2'. + Type 'Element' is not assignable to type 'undefined'. Overload 2 of 2, '(props: ResizablePanelProps, context?: any): ResizablePanel', gave the following error. - Type '{ children: [Element, Element, Element]; }' is not assignable to type 'Readonly'. - Types of property 'children' are incompatible. - Type '[Element, Element, Element]' is not assignable to type '[ReactNode, ReactNode]'. + Type 'Element' is not assignable to type 'undefined'. ==== tests/cases/conformance/jsx/checkJsxChildrenCanBeTupleType.tsx (1 errors) ==== @@ -27,17 +23,13 @@ tests/cases/conformance/jsx/checkJsxChildrenCanBeTupleType.tsx(17,18): error TS2 const testErr = - ~~~~~~~~~~~~~~ +
+
+
+ ~~~~~~~ !!! error TS2769: No overload matches this call. !!! error TS2769: Overload 1 of 2, '(props: Readonly): ResizablePanel', gave the following error. -!!! error TS2769: Type '{ children: [Element, Element, Element]; }' is not assignable to type 'Readonly'. -!!! error TS2769: The types of 'children.length' are incompatible between these types. -!!! error TS2769: Type '3' is not assignable to type '2'. +!!! error TS2769: Type 'Element' is not assignable to type 'undefined'. !!! error TS2769: Overload 2 of 2, '(props: ResizablePanelProps, context?: any): ResizablePanel', gave the following error. -!!! error TS2769: Type '{ children: [Element, Element, Element]; }' is not assignable to type 'Readonly'. -!!! error TS2769: Types of property 'children' are incompatible. -!!! error TS2769: Type '[Element, Element, Element]' is not assignable to type '[ReactNode, ReactNode]'. -
-
-
+!!! error TS2769: Type 'Element' is not assignable to type 'undefined'. \ No newline at end of file diff --git a/tests/baselines/reference/checkJsxChildrenProperty3.types b/tests/baselines/reference/checkJsxChildrenProperty3.types index f2ed3dc8fd0..0e8d75bed5f 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) & (string | number | boolean | any[] | React.ReactElement)[]) +>this.props.children : (user: IUser) => JSX.Element >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) & (string | number | boolean | any[] | React.ReactElement)[]) +>children : (user: IUser) => JSX.Element >this.state.result : any >this.state : any >this : this diff --git a/tests/baselines/reference/checkJsxChildrenProperty4.errors.txt b/tests/baselines/reference/checkJsxChildrenProperty4.errors.txt index 34bd2189964..9aed355713d 100644 --- a/tests/baselines/reference/checkJsxChildrenProperty4.errors.txt +++ b/tests/baselines/reference/checkJsxChildrenProperty4.errors.txt @@ -1,11 +1,8 @@ tests/cases/conformance/jsx/file.tsx(24,28): error TS2551: Property 'NAme' does not exist on type 'IUser'. Did you mean 'Name'? -tests/cases/conformance/jsx/file.tsx(36,15): error TS2322: Type '(user: IUser) => Element' is not assignable to type 'string | number | boolean | any[] | ReactElement'. - Type '(user: IUser) => Element' is missing the following properties from type 'ReactElement': type, props -tests/cases/conformance/jsx/file.tsx(39,15): error TS2322: Type '(user: IUser) => Element' is not assignable to type 'string | number | boolean | any[] | ReactElement'. - Type '(user: IUser) => Element' is missing the following properties from type 'ReactElement': type, props +tests/cases/conformance/jsx/file.tsx(32,10): error TS2746: This JSX tag's 'children' prop expects a single child of type '(user: IUser) => Element', but multiple children were provided. -==== tests/cases/conformance/jsx/file.tsx (3 errors) ==== +==== tests/cases/conformance/jsx/file.tsx (2 errors) ==== import React = require('react'); interface IUser { @@ -41,27 +38,17 @@ tests/cases/conformance/jsx/file.tsx(39,15): error TS2322: Type '(user: IUser) = function UserName1() { return ( + ~~~~~~~~~ +!!! error TS2746: This JSX tag's 'children' prop expects a single child of type '(user: IUser) => Element', but multiple children were provided. { user => ( - ~~~~~~~~~

{ user.Name }

- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ) } - ~~~~~~~~~~~~~ -!!! error TS2322: Type '(user: IUser) => Element' is not assignable to type 'string | number | boolean | any[] | ReactElement'. -!!! error TS2322: Type '(user: IUser) => Element' is missing the following properties from type 'ReactElement': type, props -!!! related TS6212 tests/cases/conformance/jsx/file.tsx:36:15: Did you mean to call this expression? { user => ( - ~~~~~~~~~

{ user.Name }

- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ) } - ~~~~~~~~~~~~~ -!!! error TS2322: Type '(user: IUser) => Element' is not assignable to type 'string | number | boolean | any[] | ReactElement'. -!!! error TS2322: Type '(user: IUser) => Element' is missing the following properties from type 'ReactElement': type, props -!!! related TS6212 tests/cases/conformance/jsx/file.tsx:39:15: Did you mean to call this expression?
); } \ No newline at end of file diff --git a/tests/baselines/reference/checkJsxChildrenProperty4.types b/tests/baselines/reference/checkJsxChildrenProperty4.types index 067e8f2611a..f9c0cb8252b 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) & (string | number | boolean | any[] | React.ReactElement)[]) +>this.props.children : (user: IUser) => JSX.Element >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) & (string | number | boolean | any[] | React.ReactElement)[]) +>children : (user: IUser) => JSX.Element >this.state.result : any >this.state : any >this : this diff --git a/tests/baselines/reference/controlFlowIfStatement.types b/tests/baselines/reference/controlFlowIfStatement.types index 85b04082504..fb971318dcc 100644 --- a/tests/baselines/reference/controlFlowIfStatement.types +++ b/tests/baselines/reference/controlFlowIfStatement.types @@ -104,7 +104,7 @@ function c(data: string | T): T { >JSON.parse : (text: string, reviver?: (this: any, key: string, value: any) => any) => any >JSON : JSON >parse : (text: string, reviver?: (this: any, key: string, value: any) => any) => any ->data : string | (T & string) +>data : string } else { return data; diff --git a/tests/baselines/reference/narrowingByTypeofInSwitch.types b/tests/baselines/reference/narrowingByTypeofInSwitch.types index 90126810527..e55f82c036a 100644 --- a/tests/baselines/reference/narrowingByTypeofInSwitch.types +++ b/tests/baselines/reference/narrowingByTypeofInSwitch.types @@ -484,9 +484,9 @@ function exhaustiveChecksGenerics(x: T): stri case 'number': return x.toString(2); >'number' : "number" >x.toString(2) : string ->x.toString : ((radix?: number | undefined) => string) | ((() => string) & ((radix?: number | undefined) => string)) | ((() => string) & ((radix?: number | undefined) => string)) | ((() => string) & ((radix?: number | undefined) => string)) +>x.toString : (radix?: number | undefined) => string >x : T & number ->toString : ((radix?: number | undefined) => string) | ((() => string) & ((radix?: number | undefined) => string)) | ((() => string) & ((radix?: number | undefined) => string)) | ((() => string) & ((radix?: number | undefined) => string)) +>toString : (radix?: number | undefined) => string >2 : 2 case 'string': return x; diff --git a/tests/baselines/reference/objectSpread.types b/tests/baselines/reference/objectSpread.types index 45c4c853faa..1a903948896 100644 --- a/tests/baselines/reference/objectSpread.types +++ b/tests/baselines/reference/objectSpread.types @@ -687,27 +687,27 @@ function genericSpread(t: T, u: U, v: T | U, w: T | { s: string }, obj: { >obj : { x: number; } let x15 = { ...t, ...v }; ->x15 : T | (T & U) ->{ ...t, ...v } : T | (T & U) +>x15 : T +>{ ...t, ...v } : T >t : T >v : T | U let x16 = { ...t, ...w }; ->x16 : T | (T & { s: string; }) ->{ ...t, ...w } : T | (T & { s: string; }) +>x16 : T +>{ ...t, ...w } : T >t : T >w : T | { s: string; } let x17 = { ...t, ...w, ...obj }; ->x17 : (T & { x: number; }) | (T & { x: number; s: string; }) ->{ ...t, ...w, ...obj } : (T & { x: number; }) | (T & { x: number; s: string; }) +>x17 : T & { x: number; } +>{ ...t, ...w, ...obj } : T & { x: number; } >t : T >w : T | { s: string; } >obj : { x: number; } let x18 = { ...t, ...v, ...w }; ->x18 : T | (T & U) | (T & { s: string; }) | (T & U & { s: string; }) ->{ ...t, ...v, ...w } : T | (T & U) | (T & { s: string; }) | (T & U & { s: string; }) +>x18 : T +>{ ...t, ...v, ...w } : T >t : T >v : T | U >w : T | { s: string; }