How to use the declareTypeAlias function from @babel/types
Find comprehensive JavaScript @babel/types.declareTypeAlias code examples handpicked from public code repositorys.
8 9 10 11 12 13 14 15 16 17
} class FlowBuilder extends AbstractJsBuilder { buildUnion(object/*: Union*/) { const variants = object.variants.map((name) => bt.genericTypeAnnotation(bt.identifier(name))) const ast = bt.declareTypeAlias( bt.identifier(object.name), undefined, bt.unionTypeAnnotation(variants) )
9
40
4
+ 35 other calls in file
GitHub: deecewan/jsroutes-types
67 68 69 70 71 72 73 74 75 76
]), ); const stringableValue = t.genericTypeAnnotation(stringableId); const validValueId = t.identifier('ValidValue'); const validValueType = t.declareTypeAlias( validValueId, null, t.unionTypeAnnotation([ t.stringTypeAnnotation(),
1
3
2
+ 30 other calls in file
@babel/types.identifier is the most popular function in @babel/types (20936 examples)