Using Mapped Types does not yield any prop type
emmenko opened this issue · 3 comments
emmenko commented
Given this usage of Mapped Types (meaning an index signature where index strings can be members of a union of literal strings):
export type Color = "red" | "green";
export type Props {
colors: {
[key in Color]: boolean;
};
}
Then, there are no resulting prop types associated to the prop color
.
You can see it from the following failing spec:
emmenko commented
@milesj I'd like to try to fix this, could you point me to the right direction where I should be looking at in the code?
milesj commented
@emmenko You would probably add another if conditional here: https://github.com/milesj/babel-plugin-typescript-to-proptypes/blob/master/src/convertBabelToPropTypes.ts#L24
milesj commented
Will be supported in the next version.