TypeScript/tests/cases/conformance/jsx/tsxSpreadAttributesResolution17.tsx
Nathan Shively-Sanders ae652404cd Fix JSX attribute checking when spreading unions
Previously, the code didn't account for the fact that spreading a union
creates a union. In fact, before Decemeber, spreading a union in JSX
didn't create a union.

Now the check for properties of the spread type uses
`getPropertiesOfType`, which works with unions, instead of accessing the
`properties` property directly.
2018-01-22 13:34:12 -08:00

26 lines
503 B
TypeScript

// @strictNullChecks: true
// @filename: file.tsx
// @jsx: preserve
// @noLib: true
// @skipLibCheck: true
// @libFiles: lib.d.ts
declare global {
namespace JSX {
interface Element {}
interface ElementAttributesProperty { props: {} }
}
}
declare var React: any;
export class Empty extends React.Component<{}, {}> {
render() {
return <div>Hello</div>;
}
}
declare const obj: { a: number | undefined } | undefined;
// OK
let unionedSpread = <Empty {...obj} />;