mirror of
https://github.com/documentationjs/documentation.git
synced 2026-01-25 14:26:29 +00:00
22 lines
435 B
JavaScript
22 lines
435 B
JavaScript
const t = require('@babel/types');
|
|
const flowDoctrine = require('./flow_doctrine');
|
|
const tsDoctrine = require('./ts_doctrine');
|
|
|
|
function typeAnnotation(type) {
|
|
if (t.isFlow(type)) {
|
|
if (t.isTypeAnnotation(type)) {
|
|
type = type.typeAnnotation;
|
|
}
|
|
|
|
return flowDoctrine(type);
|
|
}
|
|
|
|
if (t.isTSTypeAnnotation(type)) {
|
|
type = type.typeAnnotation;
|
|
}
|
|
|
|
return tsDoctrine(type);
|
|
}
|
|
|
|
module.exports = typeAnnotation;
|