1 | const t = require('@babel/types');
|
2 | const flowDoctrine = require('./flow_doctrine');
|
3 | const tsDoctrine = require('./ts_doctrine');
|
4 |
|
5 | function typeAnnotation(type) {
|
6 | if (t.isFlow(type)) {
|
7 | if (t.isTypeAnnotation(type)) {
|
8 | type = type.typeAnnotation;
|
9 | }
|
10 |
|
11 | return flowDoctrine(type);
|
12 | }
|
13 |
|
14 | if (t.isTSTypeAnnotation(type)) {
|
15 | type = type.typeAnnotation;
|
16 | }
|
17 |
|
18 | return tsDoctrine(type);
|
19 | }
|
20 |
|
21 | module.exports = typeAnnotation;
|