Translate null correctly when it is a part of a union type
parent
e5afdbcb58
commit
6fe28de2dc
|
@ -103,13 +103,13 @@ function convertType(fund: Fund, type: ?Type): Schema {
|
||||||
};
|
};
|
||||||
case 'union':
|
case 'union':
|
||||||
const enumerate = wu(type.variants)
|
const enumerate = wu(type.variants)
|
||||||
.filter(variant => variant.kind === 'literal')
|
.filter(variant => variant.kind === 'literal' && variant.value !== null)
|
||||||
.map(literal => (literal: $FlowFixMe).value)
|
.map(literal => (literal: $FlowFixMe).value)
|
||||||
.tap(value => invariant(value !== undefined))
|
.tap(value => invariant(value !== undefined))
|
||||||
.toArray();
|
.toArray();
|
||||||
|
|
||||||
const schemas = wu(type.variants)
|
const schemas = wu(type.variants)
|
||||||
.filter(variant => variant.kind !== 'literal')
|
.filter(variant => variant.kind !== 'literal' || variant.value === null)
|
||||||
.map(variant => convert(fund, variant))
|
.map(variant => convert(fund, variant))
|
||||||
.toArray();
|
.toArray();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue