TypeScript/tests/cases/compiler/tsxAttributesHasInferrableIndex.tsx
Wesley Wigham ca1d19a579
Always make a new jsxAttributes type, dont reuse emptyObjectType (#22810)
* Always make a new jsxAttributes type, dont reuse emptyObjectType

* Break up conditional a bit
2018-03-22 15:16:33 -07:00

19 lines
492 B
TypeScript

// @strict: true
// @jsx: react
// @jsxFactory: createElement
type AttributeValue = number | string | Date | boolean;
interface Attributes {
[key: string]: AttributeValue;
}
function createElement(name: string, attributes: Attributes | undefined, ...contents: string[]) {
return name;
}
namespace createElement.JSX {
type Element = string;
}
function Button(attributes: Attributes | undefined, contents: string[]) {
return '';
}
const b = <Button></Button>