Add support for aliases

master
Paul Loyd 2017-11-02 20:39:34 +03:00
parent 492a9e9af8
commit b836d2ef8c
2 changed files with 8 additions and 4 deletions

View File

@ -7,7 +7,12 @@ const {partition, log} = require('./utils');
const extractors = {
* TypeAlias(node) {
const schema = yield node.right;
let schema = yield node.right;
if (typeof schema === 'string') {
schema = {type: schema};
}
schema.name = yield node.id;
yield provide(schema);

View File

@ -1,4 +1,4 @@
type A = {};
type A = string;
type Type = {
a: A,
@ -21,9 +21,8 @@ class Class {
// ###
({
A: {
type: 'record',
type: 'string',
name: 'A',
fields: [],
},
Type: {
type: 'record',