Always translate type named "integer" to json schema "integer"
parent
ec681fe6fc
commit
1d0a098c39
|
@ -32,15 +32,17 @@ import {invariant} from '../utils';
|
||||||
function processTypeAlias(ctx: Context, node: TypeAlias | DeclareTypeAlias) {
|
function processTypeAlias(ctx: Context, node: TypeAlias | DeclareTypeAlias) {
|
||||||
const {name} = node.id;
|
const {name} = node.id;
|
||||||
|
|
||||||
// Forward declaration for the recursive types
|
if (name != 'integer') {
|
||||||
ctx.define(name, t.createAny());
|
// Forward declaration for the recursive types
|
||||||
|
ctx.define(name, t.createAny());
|
||||||
|
|
||||||
const type = makeType(ctx, node.right);
|
const type = makeType(ctx, node.right);
|
||||||
|
|
||||||
// TODO: support function aliases.
|
// TODO: support function aliases.
|
||||||
invariant(type);
|
invariant(type);
|
||||||
|
|
||||||
ctx.define(name, type);
|
ctx.define(name, type);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: type params.
|
// TODO: type params.
|
||||||
|
@ -282,6 +284,9 @@ function makeIntersection(ctx: Context, node: IntersectionTypeAnnotation): ?Type
|
||||||
|
|
||||||
function makeReference(ctx: Context, node: GenericTypeAnnotation): ?Type {
|
function makeReference(ctx: Context, node: GenericTypeAnnotation): ?Type {
|
||||||
const {name} = node.id;
|
const {name} = node.id;
|
||||||
|
if (name == 'integer') {
|
||||||
|
return t.createNumber('i64');
|
||||||
|
}
|
||||||
const params = node.typeParameters
|
const params = node.typeParameters
|
||||||
&& wu(node.typeParameters.params).map(n => makeType(ctx, n)).toArray();
|
&& wu(node.typeParameters.params).map(n => makeType(ctx, n)).toArray();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue