Skip to content

[React] Allow default type parameter in users specified React component . #15455

@yuit

Description

@yuit

From discussion in here DefinitelyTyped/DefinitelyTyped#16112
Although we can't have generic users' specified React component as there are no way to specify type argument or infer such arguments, I think it should work with default type parameter

i.e below should be ok.

interface MapProps {
    prop1: string;
}
export class Map<P = MapProps, E = Leaflet.Map> extends MapComponent<P, E> { ... }
let x = <Map prop1="hi" />

Note this won't work

export class Map<P , E > extends MapComponent<P, E> { ... }

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptDomain: JSX/TSXRelates to the JSX parser and emitterFixedA PR has been merged for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions