Skip to content
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

TypeScript mapped type support #361

Closed
ahutchings opened this issue May 18, 2019 · 2 comments
Closed

TypeScript mapped type support #361

ahutchings opened this issue May 18, 2019 · 2 comments

Comments

@ahutchings
Copy link
Contributor

Docgen is outputting parsing TypeScript mapped types as {name: 'unknown'} . I've started putting together a change to add support for mapped types, but I'm not sure how we want to represent the type descriptor for it, since it's not a feature that Flow has. Does anyone have thoughts on how the type descriptor should be structured for something like this?

var x: MyMappedType = {top: true};

type Side = 'top' | 'right' | 'bottom' | 'left';
type MyMappedType = { [side in Side]?: boolean};

cc @devongovett

@danez
Copy link
Collaborator

danez commented May 18, 2019

Isn't this the same as https://flow.org/en/docs/types/objects/#toc-objects-as-maps ?

@ahutchings
Copy link
Contributor Author

Yep, looks like it is, and we can use the existing FlowObjectSignatureType to represent it. PR incoming shortly.

ahutchings added a commit to ahutchings/react-docgen that referenced this issue May 19, 2019
danez pushed a commit that referenced this issue Jul 14, 2019
@danez danez closed this as completed Jul 15, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants