Skip to content
This repository was archived by the owner on Jul 23, 2021. It is now read-only.

Commit db8573b

Browse files
committed
Support nulls in genTypeDefData.js
1 parent 64fe9a0 commit db8573b

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

pages/lib/TypeKind.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,14 @@ var TypeKind = {
2121

2222
This: 10,
2323
Undefined: 11,
24-
Union: 12,
25-
Intersection: 13,
26-
Tuple: 14,
27-
Indexed: 15,
28-
Operator: 16,
24+
Null: 12,
25+
Union: 13,
26+
Intersection: 14,
27+
Tuple: 15,
28+
Indexed: 16,
29+
Operator: 17,
2930

30-
Unknown: 17,
31+
Unknown: 18,
3132
};
3233

3334
module.exports = TypeKind;

pages/lib/genTypeDefData.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ function DocVisitor(source) {
273273
switch (node.kind) {
274274
case ts.SyntaxKind.NeverKeyword:
275275
return {
276-
k: TypeKind.NeverKeyword,
276+
k: TypeKind.Never,
277277
};
278278
case ts.SyntaxKind.AnyKeyword:
279279
return {
@@ -283,6 +283,10 @@ function DocVisitor(source) {
283283
return {
284284
k: TypeKind.Unknown,
285285
};
286+
case ts.SyntaxKind.NullKeyword:
287+
return {
288+
k: TypeKind.Null,
289+
};
286290
case ts.SyntaxKind.ThisType:
287291
return {
288292
k: TypeKind.This,

pages/src/docs/src/Defs.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ var TypeDef = React.createClass({
9797
return this.wrap('primitive', 'any');
9898
case TypeKind.This:
9999
return this.wrap('primitive', 'this');
100+
case TypeKind.Null:
101+
return this.wrap('primitive', 'null');
100102
case TypeKind.Undefined:
101103
return this.wrap('primitive', 'undefined');
102104
case TypeKind.Boolean:

0 commit comments

Comments
 (0)