Skip to content

Commit 3519e18

Browse files
committed
Merge pull request #327 from researchgate/boolean-literal-type
Add support for flow boolean literal type
2 parents 94140dc + 0853c57 commit 3519e18

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

lib/flow_doctrine.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ var oneToOne = {
1313

1414
var literalTypes = {
1515
'StringLiteralTypeAnnotation': 'StringLiteral',
16-
'NumberLiteralTypeAnnotation': 'NumberLiteral'
16+
'NumberLiteralTypeAnnotation': 'NumberLiteral',
17+
'BooleanLiteralTypeAnnotation': 'BooleanLiteral'
1718
};
1819

1920
function flowDoctrine(type) {

test/lib/flow_doctrine.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,14 @@ test('flowDoctrine', function (t) {
128128
name: '1'
129129
}, 'NumberLiteral');
130130

131+
t.deepEqual(flowDoctrine(toComment(
132+
"/** add */function add(a: true) { }"
133+
).context.ast.value.params[0].typeAnnotation.typeAnnotation),
134+
{
135+
type: 'BooleanLiteral',
136+
name: true
137+
}, 'BooleanLiteral');
138+
131139
t.end();
132140
});
133141
/* eslint-enable */

0 commit comments

Comments
 (0)