Closed
Description
Consider the following:
declare module JSX {
interface ElementAttributesProperty { props: {}; }
}
class Component<P> {
props: P & { ref?: string };
}
This results in the error: JSX element attributes type '[type parameter] & { ref?: string; }' must be an object type.
An alternative would be an additional member of the JSX namespace that allowed specifying "global" attributes (that would apply to both value-based and intrinsic elements). For example:
declare module JSX {
interface GlobalAttributes {
ref?: string
}
}
See also DefinitelyTyped/DefinitelyTyped#5347