Skip to content

Commit

Permalink
Accept new baselines
Browse files Browse the repository at this point in the history
  • Loading branch information
ahejlsberg committed Jan 8, 2021
1 parent 2c2d06d commit 4507270
Show file tree
Hide file tree
Showing 20 changed files with 89 additions and 81 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ export declare type TypeB = Merge<TypeA, {
b: string;
}>;
//// [index.d.ts]
import { TypeB } from './type-b';
export declare class Broken {
method(): import("./types").Merge<import("./type-a").TypeA, {
b: string;
}>;
method(): TypeB;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ export class Broken {
>Broken : Broken

method () {
>method : () => import("tests/cases/compiler/Uppercased_Dir/src/types").Merge<import("tests/cases/compiler/Uppercased_Dir/src/type-a").TypeA, { b: string; }>
>method : () => TypeB

return { } as TypeB;
>{ } as TypeB : import("tests/cases/compiler/Uppercased_Dir/src/types").Merge<import("tests/cases/compiler/Uppercased_Dir/src/type-a").TypeA, { b: string; }>
>{ } as TypeB : TypeB
>{ } : {}
}
}
Expand All @@ -21,7 +21,7 @@ import { TypeA } from './type-a';
>TypeA : any

export type TypeB = Merge<TypeA, {
>TypeB : Merge<TypeA, { b: string; }>
>TypeB : TypeB

b: string;
>b : string
Expand Down
6 changes: 3 additions & 3 deletions tests/baselines/reference/conditionalTypes1.types
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ type OptionsOfKind<K extends Options["k"]> = Extract<Options, { k: K }>;
>k : K

type T16 = OptionsOfKind<"a" | "b">; // { k: "a", a: number } | { k: "b", b: string }
>T16 : { k: "a"; a: number; } | { k: "b"; b: string; }
>T16 : T16

type Select<T, K extends keyof T, V extends T[K]> = Extract<T, { [P in K]: V }>;
>Select : Extract<T, { [P in K]: V; }>
Expand Down Expand Up @@ -971,13 +971,13 @@ type c2 = B2['c']; // 'c' | 'b'
// Repro from #21929

type NonFooKeys1<T extends object> = OldDiff<keyof T, 'foo'>;
>NonFooKeys1 : OldDiff<keyof T, "foo">
>NonFooKeys1 : NonFooKeys1<T>

type NonFooKeys2<T extends object> = Exclude<keyof T, 'foo'>;
>NonFooKeys2 : Exclude<keyof T, "foo">

type Test1 = NonFooKeys1<{foo: 1, bar: 2, baz: 3}>; // "bar" | "baz"
>Test1 : OldDiff<"foo" | "bar" | "baz", "foo">
>Test1 : Test1
>foo : 1
>bar : 2
>baz : 3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { Result } from "lib/result";
>Result : any

export type T<T> = Result<Error, T>;
>T : Result<Error, T>
>T : import("tests/cases/compiler/src/datastore_result").T<T>

=== tests/cases/compiler/src/conditional_directive_field.ts ===
import * as DatastoreResult from "src/datastore_result";
Expand Down
4 changes: 2 additions & 2 deletions tests/baselines/reference/deferredLookupTypeResolution.types
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ type StringContains<S extends string, L extends string> = (
)[L]

type ObjectHasKey<O, L extends string> = StringContains<Extract<keyof O, string>, L>
>ObjectHasKey : StringContains<Extract<keyof O, string>, L>
>ObjectHasKey : ObjectHasKey<O, L>

type First<T> = ObjectHasKey<T, '0'>; // Should be deferred
>First : StringContains<Extract<keyof T, string>, "0">
>First : First<T>

type T1 = ObjectHasKey<{ a: string }, 'a'>; // 'true'
>T1 : "true"
Expand Down
4 changes: 2 additions & 2 deletions tests/baselines/reference/deferredLookupTypeResolution2.types
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ type StringContains<S extends string, L extends string> = ({ [K in S]: 'true' }
>key : string

type ObjectHasKey<O, L extends string> = StringContains<Extract<keyof O, string>, L>;
>ObjectHasKey : StringContains<Extract<keyof O, string>, L>
>ObjectHasKey : ObjectHasKey<O, L>

type A<T> = ObjectHasKey<T, '0'>;
>A : StringContains<Extract<keyof T, string>, "0">
>A : A<T>

type B = ObjectHasKey<[string, number], '1'>; // "true"
>B : "true"
Expand Down
4 changes: 2 additions & 2 deletions tests/baselines/reference/indexingTypesWithNever.types
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ type P0 = {};
>P0 : P0

type P3Names = RequiredPropNames<P3>; // expect 'a' | 'b'
>P3Names : RequiredPropNames<P3>
>P3Names : P3Names

type P2Names = RequiredPropNames<P2>; // expect 'a'
>P2Names : "a"
Expand Down Expand Up @@ -214,7 +214,7 @@ type O0 = {};
>O0 : O0

type O3Names = OptionalPropNames<O3>; // expect 'a' | 'b'
>O3Names : OptionalPropNames<O3>
>O3Names : O3Names

type O2Names = OptionalPropNames<O2>; // expect 'a'
>O2Names : "a"
Expand Down
26 changes: 13 additions & 13 deletions tests/baselines/reference/intersectionTypeInference3.types
Original file line number Diff line number Diff line change
Expand Up @@ -13,37 +13,37 @@ type Nominal<Kind extends string, Type> = Type & {
};

type A = Nominal<'A', string>;
>A : Nominal<"A", string>
>A : A

declare const a: Set<A>;
>a : Set<Nominal<"A", string>>
>a : Set<A>

declare const b: Set<A>;
>b : Set<Nominal<"A", string>>
>b : Set<A>

const c1 = Array.from(a).concat(Array.from(b));
>c1 : Nominal<"A", string>[]
>Array.from(a).concat(Array.from(b)) : Nominal<"A", string>[]
>Array.from(a).concat : { (...items: ConcatArray<Nominal<"A", string>>[]): Nominal<"A", string>[]; (...items: (Nominal<"A", string> | ConcatArray<Nominal<"A", string>>)[]): Nominal<"A", string>[]; }
>Array.from(a) : Nominal<"A", string>[]
>c1 : A[]
>Array.from(a).concat(Array.from(b)) : A[]
>Array.from(a).concat : { (...items: ConcatArray<A>[]): A[]; (...items: (A | ConcatArray<A>)[]): A[]; }
>Array.from(a) : A[]
>Array.from : { <T>(arrayLike: ArrayLike<T>): T[]; <T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; <T>(iterable: Iterable<T> | ArrayLike<T>): T[]; <T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; }
>Array : ArrayConstructor
>from : { <T>(arrayLike: ArrayLike<T>): T[]; <T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; <T>(iterable: Iterable<T> | ArrayLike<T>): T[]; <T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; }
>a : Set<Nominal<"A", string>>
>concat : { (...items: ConcatArray<Nominal<"A", string>>[]): Nominal<"A", string>[]; (...items: (Nominal<"A", string> | ConcatArray<Nominal<"A", string>>)[]): Nominal<"A", string>[]; }
>Array.from(b) : Nominal<"A", string>[]
>a : Set<A>
>concat : { (...items: ConcatArray<A>[]): A[]; (...items: (A | ConcatArray<A>)[]): A[]; }
>Array.from(b) : A[]
>Array.from : { <T>(arrayLike: ArrayLike<T>): T[]; <T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; <T>(iterable: Iterable<T> | ArrayLike<T>): T[]; <T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; }
>Array : ArrayConstructor
>from : { <T>(arrayLike: ArrayLike<T>): T[]; <T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; <T>(iterable: Iterable<T> | ArrayLike<T>): T[]; <T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; }
>b : Set<Nominal<"A", string>>
>b : Set<A>

// Simpler repro

declare function from<T>(): T[];
>from : <T>() => T[]

const c2: ReadonlyArray<A> = from();
>c2 : readonly Nominal<"A", string>[]
>from() : Nominal<"A", string>[]
>c2 : readonly A[]
>from() : A[]
>from : <T>() => T[]

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ tests/cases/conformance/types/intersection/intersectionWithIndexSignatures.ts(17
Property 'y' is incompatible with index signature.
Property 'a' is missing in type 'B' but required in type 'A'.
tests/cases/conformance/types/intersection/intersectionWithIndexSignatures.ts(27,10): error TS2339: Property 'b' does not exist on type '{ a: string; }'.
tests/cases/conformance/types/intersection/intersectionWithIndexSignatures.ts(29,7): error TS2322: Type 'constr<{}, { [key: string]: { a: string; }; }>' is not assignable to type '{ [key: string]: { a: string; b: string; }; }'.
tests/cases/conformance/types/intersection/intersectionWithIndexSignatures.ts(29,7): error TS2322: Type 's' is not assignable to type '{ [key: string]: { a: string; b: string; }; }'.
Index signatures are incompatible.
Property 'b' is missing in type '{ a: string; }' but required in type '{ a: string; b: string; }'.
tests/cases/conformance/types/intersection/intersectionWithIndexSignatures.ts(35,1): error TS2322: Type '{ a: string; } & { b: number; }' is not assignable to type '{ [key: string]: string; }'.
Expand Down Expand Up @@ -48,7 +48,7 @@ tests/cases/conformance/types/intersection/intersectionWithIndexSignatures.ts(35

const d: { [key: string]: {a: string, b: string} } = q; // Error
~
!!! error TS2322: Type 'constr<{}, { [key: string]: { a: string; }; }>' is not assignable to type '{ [key: string]: { a: string; b: string; }; }'.
!!! error TS2322: Type 's' is not assignable to type '{ [key: string]: { a: string; b: string; }; }'.
!!! error TS2322: Index signatures are incompatible.
!!! error TS2322: Property 'b' is missing in type '{ a: string; }' but required in type '{ a: string; b: string; }'.
!!! related TS2728 tests/cases/conformance/types/intersection/intersectionWithIndexSignatures.ts:29:39: 'b' is declared here.
Expand Down
10 changes: 5 additions & 5 deletions tests/baselines/reference/intersectionWithIndexSignatures.types
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,19 @@ type constr<Source, Tgt> = { [K in keyof Source]: string } & Pick<Tgt, Exclude<k
>constr : constr<Source, Tgt>

type s = constr<{}, { [key: string]: { a: string } }>;
>s : constr<{}, { [key: string]: { a: string; }; }>
>s : s
>key : string
>a : string

declare const q: s;
>q : constr<{}, { [key: string]: { a: string; }; }>
>q : s

q["asd"].a.substr(1);
>q["asd"].a.substr(1) : string
>q["asd"].a.substr : (from: number, length?: number | undefined) => string
>q["asd"].a : string
>q["asd"] : { a: string; }
>q : constr<{}, { [key: string]: { a: string; }; }>
>q : s
>"asd" : "asd"
>a : string
>substr : (from: number, length?: number | undefined) => string
Expand All @@ -86,7 +86,7 @@ q["asd"].a.substr(1);
q["asd"].b; // Error
>q["asd"].b : any
>q["asd"] : { a: string; }
>q : constr<{}, { [key: string]: { a: string; }; }>
>q : s
>"asd" : "asd"
>b : any

Expand All @@ -95,7 +95,7 @@ const d: { [key: string]: {a: string, b: string} } = q; // Error
>key : string
>a : string
>b : string
>q : constr<{}, { [key: string]: { a: string; }; }>
>q : s

// Repro from #32484

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type ExtractValueType<T> = T extends ReactSelectProps<infer U> ? U : never;
>ExtractValueType : ExtractValueType<T>

export type ReactSingleSelectProps<
>ReactSingleSelectProps : Overwrite<Omit<WrappedProps, "multi">, Props<ExtractValueType<WrappedProps>>>
>ReactSingleSelectProps : ReactSingleSelectProps<WrappedProps>

WrappedProps extends ReactSelectProps<any>
> = Overwrite<
Expand Down Expand Up @@ -118,11 +118,11 @@ declare class ReactSelectClass<TValue = OptionValues> extends React.Component<Re
}

export type OptionComponentType<TValue = OptionValues> = React.ComponentType<OptionComponentProps<TValue>>;
>OptionComponentType : React.ComponentType<OptionComponentProps<TValue>>
>OptionComponentType : OptionComponentType<TValue>
>React : any

export type ValueComponentType<TValue = OptionValues> = React.ComponentType<ValueComponentProps<TValue>>;
>ValueComponentType : React.ComponentType<ValueComponentProps<TValue>>
>ValueComponentType : ValueComponentType<TValue>
>React : any

export type HandlerRendererResult = JSX.Element | null | false;
Expand Down Expand Up @@ -859,7 +859,7 @@ export interface ReactSelectProps<TValue = OptionValues> extends React.Props<Rea
* option component to render in dropdown
*/
optionComponent?: OptionComponentType<TValue>;
>optionComponent : React.ComponentType<OptionComponentProps<TValue>> | undefined
>optionComponent : OptionComponentType<TValue> | undefined

/**
* function which returns a custom way to render the options in the menu
Expand Down Expand Up @@ -973,7 +973,7 @@ export interface ReactSelectProps<TValue = OptionValues> extends React.Props<Rea
* value component to render
*/
valueComponent?: ValueComponentType<TValue>;
>valueComponent : React.ComponentType<ValueComponentProps<TValue>> | undefined
>valueComponent : ValueComponentType<TValue> | undefined

/**
* optional style to apply to the component wrapper
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/keyofDoesntContainSymbols.types
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,6 @@ type Values<T> = T[keyof T];
>Values : Values<T>

type ValuesOfObj = Values<typeof obj>;
>ValuesOfObj : Values<{ num: number; str: string; 0: 0; [sym]: symbol; }>
>ValuesOfObj : ValuesOfObj
>obj : { num: number; str: string; 0: 0; [sym]: symbol; }

10 changes: 5 additions & 5 deletions tests/baselines/reference/keyofIntersection.types
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,21 @@ type T04<T, U> = keyof (T & U); // keyof T | keyof U
>T04 : keyof T | keyof U

type T05 = T02<A>; // "a" | "b"
>T05 : "b" | "a"
>T05 : T05

type T06 = T03<B>; // "a" | "b"
>T06 : "b" | "a"
>T06 : T06

type T07 = T04<A, B>; // "a" | "b"
>T07 : "b" | "a"
>T07 : T07

// Repros from #22291

type Example1<T extends string, U extends string> = keyof (Record<T, any> & Record<U, any>);
>Example1 : T | U

type Result1 = Example1<'x', 'y'>; // "x" | "y"
>Result1 : "x" | "y"
>Result1 : Result1

type Result2 = keyof (Record<'x', any> & Record<'y', any>); // "x" | "y"
>Result2 : "x" | "y"
Expand All @@ -55,5 +55,5 @@ type Example5<T, U> = keyof (T & U);
>Example5 : keyof T | keyof U

type Result5 = Example5<Record<'x', any>, Record<'y', any>>; // "x" | "y"
>Result5 : "x" | "y"
>Result5 : Result5

4 changes: 2 additions & 2 deletions tests/baselines/reference/propTypeValidatorInference.types
Original file line number Diff line number Diff line change
Expand Up @@ -275,12 +275,12 @@ const propTypesWithoutAnnotation = {
};

type ExtractedProps = PropTypes.InferProps<typeof propTypes>;
>ExtractedProps : PropTypes.InferProps<PropTypes.ValidationMap<Props>>
>ExtractedProps : ExtractedProps
>PropTypes : any
>propTypes : PropTypes.ValidationMap<Props>

type ExtractedPropsWithoutAnnotation = PropTypes.InferProps<typeof propTypesWithoutAnnotation>;
>ExtractedPropsWithoutAnnotation : PropTypes.InferProps<{ any: PropTypes.Requireable<any>; array: PropTypes.Validator<any[]>; bool: PropTypes.Validator<boolean>; shape: PropTypes.Validator<PropTypes.InferProps<{ foo: PropTypes.Validator<string>; bar: PropTypes.Requireable<boolean>; baz: PropTypes.Requireable<any>; }>>; oneOfType: PropTypes.Validator<string | boolean | PropTypes.InferProps<{ foo: PropTypes.Requireable<string>; bar: PropTypes.Validator<number>; }>>; }>
>ExtractedPropsWithoutAnnotation : ExtractedPropsWithoutAnnotation
>PropTypes : any
>propTypesWithoutAnnotation : { any: PropTypes.Requireable<any>; array: PropTypes.Validator<any[]>; bool: PropTypes.Validator<boolean>; shape: PropTypes.Validator<PropTypes.InferProps<{ foo: PropTypes.Validator<string>; bar: PropTypes.Requireable<boolean>; baz: PropTypes.Requireable<any>; }>>; oneOfType: PropTypes.Validator<string | boolean | PropTypes.InferProps<{ foo: PropTypes.Requireable<string>; bar: PropTypes.Validator<number>; }>>; }

Expand Down
10 changes: 5 additions & 5 deletions tests/baselines/reference/ramdaToolsNoInfinite.types
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ declare namespace Tools {
>Cast : Cast<X, Y>

type Pos<I extends any[]> =
>Pos : Length<I>
>Pos : Pos<I>

Length<I>;

Expand Down Expand Up @@ -116,7 +116,7 @@ declare namespace Tools {
>Reverse : Reverse<T, R, I>

0: Reverse<T, Prepend<T[Pos<I>], R>, Next<I>>;
>0 : Reverse<T, [head: T[Length<I>], ...args: R], [head: any, ...args: I]>
>0 : Reverse<T, [head: T[Pos<I>], ...args: R], [head: any, ...args: I]>

1: R;
>1 : R
Expand All @@ -128,12 +128,12 @@ declare namespace Tools {
];

type Concat<T1 extends any[], T2 extends any[]> =
>Concat : Reverse<Reverse<T1, [], []> extends infer R ? Cast<R, any[]> : never, T2, []>
>Concat : Concat<T1, T2>

Reverse<Reverse<T1> extends infer R ? Cast<R, any[]> : never, T2>;

type Append<E, T extends any[]> =
>Append : Reverse<Reverse<T, [], []> extends infer R ? Cast<R, any[]> : never, [E], []>
>Append : Append<E, T>

Concat<T, [E]>;

Expand Down Expand Up @@ -168,7 +168,7 @@ declare namespace Curry {
>Tools : any

1: Tools.Concat<TN, Tools.Drop<Tools.Pos<I>, T2> extends infer D ? Tools.Cast<D, any[]> : never>;
>1 : Tools.Reverse<Tools.Reverse<TN, [], []> extends infer R ? Tools.Cast<R, any[]> : never, Tools.Drop<Tools.Length<I>, T2, []> extends infer D ? Tools.Cast<D, any[]> : never, []>
>1 : Tools.Concat<TN, Tools.Drop<Tools.Pos<I>, T2, []> extends infer D ? Tools.Cast<D, any[]> : never>
>Tools : any
>Tools : any
>Tools : any
Expand Down
Loading

0 comments on commit 4507270

Please sign in to comment.