flow2schema/tests/unions.js

55 lines
965 B
JavaScript
Raw Normal View History

2017-10-29 16:00:09 +03:00
type Type = {
a: string | number,
b: ?string,
};
interface Interface {
a: string | number;
b: ?string;
}
class Class {
a: string | number;
b: ?string;
}
// ###
2017-11-02 21:30:51 +03:00
[
{
2017-10-29 16:00:09 +03:00
type: 'record',
name: 'Type',
2017-11-02 23:09:18 +03:00
namespace: 'unions',
2017-10-29 16:00:09 +03:00
fields: [{
name: 'a',
type: ['string', 'double'],
}, {
name: 'b',
type: ['null', 'string'],
}],
},
2017-11-02 21:30:51 +03:00
{
2017-10-29 16:00:09 +03:00
type: 'record',
name: 'Interface',
2017-11-02 23:09:18 +03:00
namespace: 'unions',
2017-10-29 16:00:09 +03:00
fields: [{
name: 'a',
type: ['string', 'double'],
}, {
name: 'b',
type: ['null', 'string'],
}],
},
2017-11-02 21:30:51 +03:00
{
2017-10-29 16:00:09 +03:00
type: 'record',
name: 'Class',
2017-11-02 23:09:18 +03:00
namespace: 'unions',
2017-10-29 16:00:09 +03:00
fields: [{
name: 'a',
type: ['string', 'double'],
}, {
name: 'b',
type: ['null', 'string'],
}],
},
2017-11-02 21:30:51 +03:00
]