TypeScript/tests/baselines/reference/deepExcessPropertyCheckingWhenTargetIsIntersection.types
Anders Hejlsberg 6aeb8c12cc
Preserve type aliases for union and intersection types (#42149)
* 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 commit 4507270cc1.

* Revert "Allow new alias to be associated with type alias instantiation"

This reverts commit 2c2d06dfe1.
2021-01-08 15:19:58 -10:00

71 lines
2.9 KiB
Plaintext

=== tests/cases/compiler/deepExcessPropertyCheckingWhenTargetIsIntersection.ts ===
interface StatelessComponent<P = {}> {
(props: P & { children?: number }, context?: any): null;
>props : P & { children?: number; }
>children : number
>context : any
>null : null
}
const TestComponent: StatelessComponent<TestProps> = (props) => {
>TestComponent : StatelessComponent<TestProps>
>(props) => { return null;} : (props: TestProps & { children?: number; }) => any
>props : TestProps & { children?: number; }
return null;
>null : null
}
interface ITestProps {
ariaLabel?: string;
>ariaLabel : string
}
interface NestedProp<TProps> {
props: TProps;
>props : TProps
}
interface TestProps {
icon: NestedProp<ITestProps>;
>icon : NestedProp<ITestProps>
}
TestComponent({icon: { props: { INVALID_PROP_NAME: 'share', ariaLabel: 'test label' } }});
>TestComponent({icon: { props: { INVALID_PROP_NAME: 'share', ariaLabel: 'test label' } }}) : null
>TestComponent : StatelessComponent<TestProps>
>{icon: { props: { INVALID_PROP_NAME: 'share', ariaLabel: 'test label' } }} : { icon: { props: { INVALID_PROP_NAME: string; ariaLabel: string; }; }; }
>icon : { props: { INVALID_PROP_NAME: string; ariaLabel: string; }; }
>{ props: { INVALID_PROP_NAME: 'share', ariaLabel: 'test label' } } : { props: { INVALID_PROP_NAME: string; ariaLabel: string; }; }
>props : { INVALID_PROP_NAME: string; ariaLabel: string; }
>{ INVALID_PROP_NAME: 'share', ariaLabel: 'test label' } : { INVALID_PROP_NAME: string; ariaLabel: string; }
>INVALID_PROP_NAME : string
>'share' : "share"
>ariaLabel : string
>'test label' : "test label"
const TestComponent2: StatelessComponent<TestProps | {props2: {x: number}}> = (props) => {
>TestComponent2 : StatelessComponent<TestProps | { props2: { x: number;}; }>
>props2 : { x: number; }
>x : number
>(props) => { return null;} : (props: (TestProps | { props2: { x: number;}; }) & { children?: number; }) => any
>props : (TestProps | { props2: { x: number; }; }) & { children?: number; }
return null;
>null : null
}
TestComponent2({icon: { props: { INVALID_PROP_NAME: 'share', ariaLabel: 'test label' } }});
>TestComponent2({icon: { props: { INVALID_PROP_NAME: 'share', ariaLabel: 'test label' } }}) : null
>TestComponent2 : StatelessComponent<TestProps | { props2: { x: number; }; }>
>{icon: { props: { INVALID_PROP_NAME: 'share', ariaLabel: 'test label' } }} : { icon: { props: { INVALID_PROP_NAME: string; ariaLabel: string; }; }; }
>icon : { props: { INVALID_PROP_NAME: string; ariaLabel: string; }; }
>{ props: { INVALID_PROP_NAME: 'share', ariaLabel: 'test label' } } : { props: { INVALID_PROP_NAME: string; ariaLabel: string; }; }
>props : { INVALID_PROP_NAME: string; ariaLabel: string; }
>{ INVALID_PROP_NAME: 'share', ariaLabel: 'test label' } : { INVALID_PROP_NAME: string; ariaLabel: string; }
>INVALID_PROP_NAME : string
>'share' : "share"
>ariaLabel : string
>'test label' : "test label"