TypeScript/tests/cases/conformance/jsx/tsxIntrinsicAttributeErrors.tsx
Nathan Shively-Sanders 15bfaf1cf6
Skip IntrinsicAttributes elaboration in JSX errors (#24461)
* Skip IntrinsicAttributes elaboration in JSX errors

Do not issue an error message for a source type that comes from JSX
attributes and a target type that is an intersection containing
IntrinsicAttributes or IntrinsicClassAttributes. This will make error
messages simpler and less confusing.

Note:
1. There will always be elaboration under the skipped message, so this
won't elide errors completely.
2. Rarely (once in the tests) the intersection type will have more that
one non-Intrinsic* member. However, these additional members don't
provide useful information either, so it's fine to skip them.

* Add test of IntrinsicAttributes error

* Fix indentation in test
2018-05-29 14:00:26 -07:00

32 lines
512 B
TypeScript

// @jsx: preserve
declare namespace JSX {
interface Element { }
interface ElementClass {
render: any;
}
interface IntrinsicAttributes {
key: string | number
}
interface IntrinsicClassAttributes<T> {
ref: T
}
interface IntrinsicElements {
div: {
text?: string;
width?: number;
}
span: any;
}
}
interface I {
new(n: string): {
x: number
render(): void
}
}
var E: I;
<E x={10} />