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

Any idea on "type mapping"? #8054

Closed
techird opened this issue Apr 13, 2016 · 2 comments
Closed

Any idea on "type mapping"? #8054

techird opened this issue Apr 13, 2016 · 2 comments
Labels
Duplicate An existing issue was already created

Comments

@techird
Copy link

techird commented Apr 13, 2016

I got confused when using redux-form. I have to define two interface for the fields.

interface FormFields {
    fieldA: FieldProp;
    fieldB: FieldProp;
    ...
    fieldX: FieldProp;
}

interface FormValues {
    fieldA: string;
    fieldB: string;
    ...
    fieldX: string;
}

I thought these work is too verbose and I wonder if there is a way to do the type mapping automaticly.

For example,

interface FormValues {
    [key: keyof FormFields]: string;
}

I am not sure if this is possible.

PS. I am not a native english user and I have no idea how to express this issue to search for duplication. If there is duplicated please tell. Thanks a lot.

@saschanaz
Copy link
Contributor

#394 and #1295 discusses about this with a new 'memberof' keyword proposal.

@techird
Copy link
Author

techird commented Apr 13, 2016

@saschanaz Thanks a lot, I will track them and close this.

@techird techird closed this as completed Apr 13, 2016
@RyanCavanaugh RyanCavanaugh added the Duplicate An existing issue was already created label Apr 13, 2016
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

3 participants