Skip to content

Commit 20ed1c4

Browse files
Molly LloydChrisLoer
Molly Lloyd
authored andcommitted
Support arrays of enums in validation and code generation.
1 parent 7fcfda9 commit 20ed1c4

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

build/generate-flow-typed-style-spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function flowType(property) {
2424
case 'enum':
2525
return flowEnum(property.values);
2626
case 'array':
27-
const elementType = flowType(typeof property.value === 'string' ? {type: property.value} : property.value)
27+
const elementType = flowType(typeof property.value === 'string' ? {type: property.value, values: property.values} : property.value)
2828
if (property.length) {
2929
return `[${Array(property.length).fill(elementType).join(', ')}]`;
3030
} else {

build/generate-style-code.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ global.flowType = function (property) {
3030
if (property.length) {
3131
return `[${new Array(property.length).fill(flowType({type: property.value})).join(', ')}]`;
3232
} else {
33-
return `Array<${flowType({type: property.value})}>`;
33+
return `Array<${flowType({type: property.value, values: property.values})}>`;
3434
}
3535
default: throw new Error(`unknown type for ${property.name}`)
3636
}

0 commit comments

Comments
 (0)