6aeb8c12cc
* Create separate types for equivalent aliased unions * Accept new baselines * Preserve original types for union types * Accept new baselines * Preserve intersection origin for union types * Accept new baselines * Accept new baselines * Preserve aliases during relationship checks * Accept new baselines * Preserve aliases for intersection and indexed access types * Accept new baselines * Compute intersection-of-unions cross product without recursion * Accept new baselines * Use denormalized type objects for origin / support 'keyof' origins * Accept new baselines * Fix fourslash test * Recursively extract named union types * Accept new baselines * Map on union origin in mapType to better preserve aliases and origins * Remove redundant call * Accept new baselines * Revert back to declared type when branches produce equivalent union * Accept new baselines * Don't include denormal origin types in regular type statistics * Fix issue with unions not being marked primitive-only * Allow new alias to be associated with type alias instantiation * Accept new baselines * Revert "Accept new baselines" This reverts commit4507270cc1
. * Revert "Allow new alias to be associated with type alias instantiation" This reverts commit2c2d06dfe1
.
92 lines
2 KiB
Plaintext
92 lines
2 KiB
Plaintext
=== tests/cases/compiler/conditionalTypeRelaxingConstraintAssignability.ts ===
|
|
export type ElChildren =
|
|
>ElChildren : ElChildren
|
|
|
|
| ElChildren.Void
|
|
>ElChildren : any
|
|
|
|
| ElChildren.Text;
|
|
>ElChildren : any
|
|
|
|
export namespace ElChildren {
|
|
export type Void = undefined;
|
|
>Void : undefined
|
|
|
|
export type Text = string;
|
|
>Text : string
|
|
}
|
|
|
|
type Relax<C extends ElChildren> = C extends ElChildren.Text ? ElChildren.Text : C;
|
|
>Relax : Relax<C>
|
|
>ElChildren : any
|
|
>ElChildren : any
|
|
|
|
export class Elem<
|
|
>Elem : Elem<C>
|
|
|
|
C extends ElChildren,
|
|
> {
|
|
constructor(
|
|
private children_: Relax<C>,
|
|
>children_ : Relax<C>
|
|
|
|
) {
|
|
}
|
|
}
|
|
|
|
new Elem(undefined as ElChildren.Void);
|
|
>new Elem(undefined as ElChildren.Void) : Elem<undefined>
|
|
>Elem : typeof Elem
|
|
>undefined as ElChildren.Void : undefined
|
|
>undefined : undefined
|
|
>ElChildren : any
|
|
|
|
new Elem('' as ElChildren.Text);
|
|
>new Elem('' as ElChildren.Text) : Elem<string>
|
|
>Elem : typeof Elem
|
|
>'' as ElChildren.Text : string
|
|
>'' : ""
|
|
>ElChildren : any
|
|
|
|
new Elem('' as ElChildren.Void | ElChildren.Text); // error
|
|
>new Elem('' as ElChildren.Void | ElChildren.Text) : Elem<string | undefined>
|
|
>Elem : typeof Elem
|
|
>'' as ElChildren.Void | ElChildren.Text : string | undefined
|
|
>'' : ""
|
|
>ElChildren : any
|
|
>ElChildren : any
|
|
|
|
new Elem('' as ElChildren); // error
|
|
>new Elem('' as ElChildren) : Elem<ElChildren>
|
|
>Elem : typeof Elem
|
|
>'' as ElChildren : ElChildren
|
|
>'' : ""
|
|
|
|
// Repro from #31766
|
|
|
|
interface I { a: string }
|
|
>a : string
|
|
|
|
type DeepPartial<T> =
|
|
>DeepPartial : DeepPartial<T>
|
|
|
|
T extends object ? {[K in keyof T]?: DeepPartial<T[K]>} : T;
|
|
|
|
declare function f<T>(t: T, partial: DeepPartial<T>): T;
|
|
>f : <T>(t: T, partial: DeepPartial<T>) => T
|
|
>t : T
|
|
>partial : DeepPartial<T>
|
|
|
|
function g(p1: I, p2: Partial<I>): I {
|
|
>g : (p1: I, p2: Partial<I>) => I
|
|
>p1 : I
|
|
>p2 : Partial<I>
|
|
|
|
return f(p1, p2);
|
|
>f(p1, p2) : I
|
|
>f : <T>(t: T, partial: DeepPartial<T>) => T
|
|
>p1 : I
|
|
>p2 : Partial<I>
|
|
}
|
|
|