Skip to content

Commit

Permalink
feat: convert Flow's ThisTypeAnnotation to a doctrine NameExpression (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
ahutchings authored and tmcw committed Aug 9, 2017
1 parent e73dd98 commit 23aa981
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 5 additions & 1 deletion __tests__/lib/flow_doctrine.js
Expand Up @@ -295,11 +295,15 @@ test('flowDoctrine', function() {
type: 'VoidLiteral'
});

expect(toDoctrineType('this')).toEqual({
type: 'NameExpression',
name: 'this'
});

// TODO: remove all these types
expect(types).toEqual([
'IntersectionTypeAnnotation',
'EmptyTypeAnnotation',
'ThisTypeAnnotation',
'TypeofTypeAnnotation'
]);
});
5 changes: 5 additions & 0 deletions src/flow_doctrine.js
Expand Up @@ -152,6 +152,11 @@ function flowDoctrine(type: Object): DoctrineType {
type: 'StringLiteralType',
value: type.value
};
case 'ThisTypeAnnotation':
return {
type: 'NameExpression',
name: 'this'
};
default:
return {
type: 'AllLiteral'
Expand Down

0 comments on commit 23aa981

Please sign in to comment.