Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
yuit opened this issue Apr 28, 2017 · 0 comments · Fixed by #15568
Closed

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

yuit opened this issue Apr 28, 2017 · 0 comments · Fixed by #15568
Assignees
Labels
Bug A bug in TypeScript Domain: JSX/TSX Relates to the JSX parser and emitter Fixed A PR has been merged for this issue

Comments

@yuit
Copy link
Contributor

yuit commented Apr 28, 2017

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> { ... }
@yuit yuit added the Domain: JSX/TSX Relates to the JSX parser and emitter label Apr 28, 2017
@yuit yuit self-assigned this Apr 28, 2017
@mhegazy mhegazy added the Bug A bug in TypeScript label Apr 28, 2017
@yuit yuit modified the milestones: TypeScript 2.3.3, TypeScript 2.4 May 1, 2017
@yuit yuit added the Fixed A PR has been merged for this issue label May 2, 2017
@yuit yuit closed this as completed May 2, 2017
yuit added a commit that referenced this issue May 3, 2017
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Domain: JSX/TSX Relates to the JSX parser and emitter Fixed A PR has been merged for this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants