Files
tsgo/testdata/baselines/reference/submodule/compiler/deepExcessPropertyCheckingWhenTargetIsIntersection.errors.txt

39 lines
1.9 KiB
Plaintext

deepExcessPropertyCheckingWhenTargetIsIntersection.ts(21,33): error TS2353: Object literal may only specify known properties, and 'INVALID_PROP_NAME' does not exist in type 'ITestProps'.
deepExcessPropertyCheckingWhenTargetIsIntersection.ts(27,34): error TS2353: Object literal may only specify known properties, and 'INVALID_PROP_NAME' does not exist in type 'ITestProps'.
==== deepExcessPropertyCheckingWhenTargetIsIntersection.ts (2 errors) ====
interface StatelessComponent<P = {}> {
(props: P & { children?: number }, context?: any): null;
}
const TestComponent: StatelessComponent<TestProps> = (props) => {
return null;
}
interface ITestProps {
ariaLabel?: string;
}
interface NestedProp<TProps> {
props: TProps;
}
interface TestProps {
icon: NestedProp<ITestProps>;
}
TestComponent({icon: { props: { INVALID_PROP_NAME: 'share', ariaLabel: 'test label' } }});
~~~~~~~~~~~~~~~~~
!!! error TS2353: Object literal may only specify known properties, and 'INVALID_PROP_NAME' does not exist in type 'ITestProps'.
!!! related TS6500 deepExcessPropertyCheckingWhenTargetIsIntersection.ts:14:3: The expected type comes from property 'props' which is declared here on type 'NestedProp<ITestProps>'
const TestComponent2: StatelessComponent<TestProps | {props2: {x: number}}> = (props) => {
return null;
}
TestComponent2({icon: { props: { INVALID_PROP_NAME: 'share', ariaLabel: 'test label' } }});
~~~~~~~~~~~~~~~~~
!!! error TS2353: Object literal may only specify known properties, and 'INVALID_PROP_NAME' does not exist in type 'ITestProps'.
!!! related TS6500 deepExcessPropertyCheckingWhenTargetIsIntersection.ts:14:3: The expected type comes from property 'props' which is declared here on type 'NestedProp<ITestProps>'