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) )
+ 35 other calls in file
GitHub: deecewan/jsroutes-types
![deecewan profile picture](/deecewan.png?size=40)
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(),
+ 30 other calls in file
@babel/types.identifier is the most popular function in @babel/types (20936 examples)