Add tests for union+enum case
parent
d9aef3b22e
commit
98b4546611
|
@ -37,6 +37,6 @@ Output:
|
|||
|
||||
## TODO
|
||||
|
||||
* Tests.
|
||||
* Support `extends` and `implements`.
|
||||
* Generics.
|
||||
* Namespaces.
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
type Type = {
|
||||
a: 'one' | 'two' | number,
|
||||
};
|
||||
|
||||
interface Interface {
|
||||
a: 'one' | 'two' | number;
|
||||
}
|
||||
|
||||
class Class {
|
||||
a: 'one' | 'two' | number;
|
||||
}
|
||||
|
||||
// ###
|
||||
({
|
||||
Type: {
|
||||
type: 'record',
|
||||
name: 'Type',
|
||||
fields: [{
|
||||
name: 'a',
|
||||
type: [
|
||||
'double',
|
||||
{type: 'enum', symbols: ['one', 'two']},
|
||||
],
|
||||
}],
|
||||
},
|
||||
Interface: {
|
||||
type: 'record',
|
||||
name: 'Interface',
|
||||
fields: [{
|
||||
name: 'a',
|
||||
type: [
|
||||
'double',
|
||||
{type: 'enum', symbols: ['one', 'two']},
|
||||
],
|
||||
}],
|
||||
},
|
||||
Class: {
|
||||
type: 'record',
|
||||
name: 'Class',
|
||||
fields: [{
|
||||
name: 'a',
|
||||
type: [
|
||||
'double',
|
||||
{type: 'enum', symbols: ['one', 'two']},
|
||||
],
|
||||
}],
|
||||
},
|
||||
});
|
Loading…
Reference in New Issue