Accept new baselines

This commit is contained in:
Anders Hejlsberg committed 2020-12-28 17:07:38 -10:00
1 parent 44231c80c3
commit 829285fdc2
13 files changed
+35 -35

No files matched your search

@@ -31,11 +31,11 @@ class FetchUser extends React.Component<IFetchUserProps, any> {
? 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<any>) | (((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<any>) | (((user: IUser) => JSX.Element) & (boolean | any[] | React.ReactChild)[])
>children : ((user: IUser) => JSX.Element) & React.ReactNode
>this.state.result : any
>this.state : any
>this : this
@@ -31,11 +31,11 @@ class FetchUser extends React.Component<IFetchUserProps, any> {
? 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<any>) | (((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<any>) | (((user: IUser) => JSX.Element) & (boolean | any[] | React.ReactChild)[])
>children : ((user: IUser) => JSX.Element) & React.ReactNode
>this.state.result : any
>this.state : any
>this : this
@@ -173,14 +173,14 @@ interface ActionsObjectOr<State> {
declare function App4<State, Actions extends ActionsObjectOr<State>>(props: Options<State, Actions>["actions"] & { state: State }): JSX.Element;
>App4 : <State, Actions extends ActionsObjectOr<State>>(props: Options<State, Actions>["actions"] & { state: State;}) => JSX.Element
>props : (string & { state: State; }) | (Actions & { state: State; })
>props : (string | Actions) & { state: State; }
>state : State
>JSX : any
const a = <App4 state={100} foo={s => s} />; // TODO: should be number => number, but JSX resolution is missing an inferential pass
>a : JSX.Element
><App4 state={100} foo={s => s} /> : JSX.Element
>App4 : <State, Actions extends ActionsObjectOr<State>>(props: (string & { state: State; }) | (Actions & { state: State; })) => JSX.Element
>App4 : <State, Actions extends ActionsObjectOr<State>>(props: (string | Actions) & { state: State; }) => JSX.Element
>state : number
>100 : 100
>foo : (s: number) => number
@@ -48,8 +48,8 @@ const TestComponent2: StatelessComponent<TestProps | {props2: {x: number}}> = (p
>TestComponent2 : StatelessComponent<TestProps | { props2: { x: number;}; }>
>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
@@ -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
}
}
@@ -48,20 +48,20 @@ type T1 = (string | number | undefined) & (string | null | undefined); // strin
function f3<T extends string | number | undefined>(x: T & (number | object | undefined)) {
>f3 : <T extends string | number | undefined>(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<T extends string | number>(x: T & (number | object)) {
>f4 : <T extends string | number>(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<T, U extends keyof T>(x: keyof T & U) {
@@ -39,8 +39,8 @@ export function createReactSingleSelect<
>React : any
return (props) => {
>(props) => { return ( <ReactSelectClass<ExtractValueType<WrappedProps>> {...props} multi={false} autosize={false} value={props.value} onChange={(value) => { if (props.onChange) { props.onChange(value === null ? undefined : value); } }} /> ); } : (props: Omit<Omit<WrappedProps, "multi">, (keyof Omit<WrappedProps, "multi"> & "value") | (keyof Omit<WrappedProps, "multi"> & "onChange")> & Props<ExtractValueType<WrappedProps>> & { children?: React.ReactNode; }) => JSX.Element
>props : Omit<Omit<WrappedProps, "multi">, (keyof Omit<WrappedProps, "multi"> & "value") | (keyof Omit<WrappedProps, "multi"> & "onChange")> & Props<ExtractValueType<WrappedProps>> & { children?: React.ReactNode; }
>(props) => { return ( <ReactSelectClass<ExtractValueType<WrappedProps>> {...props} multi={false} autosize={false} value={props.value} onChange={(value) => { if (props.onChange) { props.onChange(value === null ? undefined : value); } }} /> ); } : (props: Omit<Omit<WrappedProps, "multi">, keyof Omit<WrappedProps, "multi"> & ("value" | "onChange")> & Props<ExtractValueType<WrappedProps>> & { children?: React.ReactNode; }) => JSX.Element
>props : Omit<Omit<WrappedProps, "multi">, keyof Omit<WrappedProps, "multi"> & ("value" | "onChange")> & Props<ExtractValueType<WrappedProps>> & { children?: React.ReactNode; }
return (
>( <ReactSelectClass<ExtractValueType<WrappedProps>> {...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<Omit<WrappedProps, "multi">, (keyof Omit<WrappedProps, "multi"> & "value") | (keyof Omit<WrappedProps, "multi"> & "onChange")> & Props<ExtractValueType<WrappedProps>> & { children?: React.ReactNode; }
>props : Omit<Omit<WrappedProps, "multi">, keyof Omit<WrappedProps, "multi"> & ("value" | "onChange")> & Props<ExtractValueType<WrappedProps>> & { children?: React.ReactNode; }
multi={false}
>multi : false
@@ -63,7 +63,7 @@ export function createReactSingleSelect<
value={props.value}
>value : ExtractValueType<WrappedProps> | Option<ExtractValueType<WrappedProps>> | undefined
>props.value : ExtractValueType<WrappedProps> | Option<ExtractValueType<WrappedProps>> | undefined
>props : Omit<Omit<WrappedProps, "multi">, (keyof Omit<WrappedProps, "multi"> & "value") | (keyof Omit<WrappedProps, "multi"> & "onChange")> & Props<ExtractValueType<WrappedProps>> & { children?: React.ReactNode; }
>props : Omit<Omit<WrappedProps, "multi">, keyof Omit<WrappedProps, "multi"> & ("value" | "onChange")> & Props<ExtractValueType<WrappedProps>> & { children?: React.ReactNode; }
>value : ExtractValueType<WrappedProps> | Option<ExtractValueType<WrappedProps>> | undefined
onChange={(value) => {
@@ -73,13 +73,13 @@ export function createReactSingleSelect<
if (props.onChange) {
>props.onChange : ((value: Option<ExtractValueType<WrappedProps>> | undefined) => void) | undefined
>props : Omit<Omit<WrappedProps, "multi">, (keyof Omit<WrappedProps, "multi"> & "value") | (keyof Omit<WrappedProps, "multi"> & "onChange")> & Props<ExtractValueType<WrappedProps>> & { children?: React.ReactNode; }
>props : Omit<Omit<WrappedProps, "multi">, keyof Omit<WrappedProps, "multi"> & ("value" | "onChange")> & Props<ExtractValueType<WrappedProps>> & { children?: React.ReactNode; }
>onChange : ((value: Option<ExtractValueType<WrappedProps>> | undefined) => void) | undefined
props.onChange(value === null ? undefined : value);
>props.onChange(value === null ? undefined : value) : void
>props.onChange : (value: Option<ExtractValueType<WrappedProps>> | undefined) => void
>props : Omit<Omit<WrappedProps, "multi">, (keyof Omit<WrappedProps, "multi"> & "value") | (keyof Omit<WrappedProps, "multi"> & "onChange")> & Props<ExtractValueType<WrappedProps>> & { children?: React.ReactNode; }
>props : Omit<Omit<WrappedProps, "multi">, keyof Omit<WrappedProps, "multi"> & ("value" | "onChange")> & Props<ExtractValueType<WrappedProps>> & { children?: React.ReactNode; }
>onChange : (value: Option<ExtractValueType<WrappedProps>> | undefined) => void
>value === null ? undefined : value : Option<ExtractValueType<WrappedProps>> | Options<ExtractValueType<WrappedProps>> | undefined
>value === null : boolean
@@ -173,7 +173,7 @@ function testExtendsUnion<T extends Basic>(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<T extends Basic>(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<T extends Basic>(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"
@@ -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<MyAPI>
>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
@@ -1,4 +1,4 @@
tests/cases/conformance/jsx/file.tsx(13,10): error TS2322: Type '{ editable: true; }' is not assignable to type '(IntrinsicAttributes & IntrinsicClassAttributes<TextComponent> & { editable: false; } & { children?: ReactNode; }) | (IntrinsicAttributes & IntrinsicClassAttributes<TextComponent> & { 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<TextComponent> & (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 = <TextComponent editable={true} />
~~~~~~~~~~~~~
!!! error TS2322: Type '{ editable: true; }' is not assignable to type '(IntrinsicAttributes & IntrinsicClassAttributes<TextComponent> & { editable: false; } & { children?: ReactNode; }) | (IntrinsicAttributes & IntrinsicClassAttributes<TextComponent> & { editable: true; onEdit: (newText: string) => void; } & { children?: ReactNode; })'.
!!! error TS2322: Type '{ editable: true; }' is not assignable to type 'IntrinsicAttributes & (IntrinsicClassAttributes<TextComponent> & (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.
@@ -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 : <T extends Numeric>(array: (Primitive | T)[]) => [Primitive | T, Primitive | T] | [undefined, undefined]
>[new NumCoercible(10), 13, '12', true] : (string | number | true | NumCoercible)[]
>new NumCoercible(10) : NumCoercible
@@ -163,7 +163,7 @@ declare function withRouter<
C extends ComponentType<P>
>(
component: C & ComponentType<P>
>component : (C & FunctionComponent<P>) | (C & ComponentClass<P>)
>component : C & ComponentType<P>
): ComponentClass<Omit<P, keyof RouteComponentProps>>;
@@ -175,7 +175,7 @@ declare const MyComponent: ComponentType<Props>;
withRouter(MyComponent);
>withRouter(MyComponent) : ComponentClass<Pick<Props, "username">>
>withRouter : <P extends RouteComponentProps, C extends ComponentType<P>>(component: (C & FunctionComponent<P>) | (C & ComponentClass<P>)) => ComponentClass<Pick<P, Exclude<keyof P, "route">>>
>withRouter : <P extends RouteComponentProps, C extends ComponentType<P>>(component: C & ComponentType<P>) => ComponentClass<Pick<P, Exclude<keyof P, "route">>>
>MyComponent : ComponentType<Props>
// Repro from #33490
@@ -188,7 +188,7 @@ type AB<T> = { a: T } | { b: T };
// T & AB<U> normalizes to T & { a: U } | T & { b: U } below
declare function foo<T, U>(obj: T & AB<U>): [T, U];
>foo : <T, U>(obj: T & AB<U>) => [T, U]
>obj : (T & { a: U; }) | (T & { b: U; })
>obj : T & AB<U>
declare let ab: AB<string>;
>ab : AB<string>
@@ -196,6 +196,6 @@ declare let ab: AB<string>;
let z = foo(ab); // [AB<string>, string]
>z : [{ a: string; } | { b: string; }, string]
>foo(ab) : [{ a: string; } | { b: string; }, string]
>foo : <T, U>(obj: (T & { a: U; }) | (T & { b: U; })) => [T, U]
>foo : <T, U>(obj: T & AB<U>) => [T, U]
>ab : AB<string>
@@ -16,12 +16,12 @@ interface StrList {
export function foo<T extends NumList | StrList>(arr: T & (NumList | StrList)) {
>foo : <T extends NumList | StrList>(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<T extends number|TypedArray>(arr: T) {
arr[1];
>arr[1] : number
>arr : (T & Int32Array) | (T & Uint8Array)
>arr : T & (Int32Array | Uint8Array)
>1 : 1
}
}