How to use the tSUnionType function from @babel/types

Find comprehensive JavaScript @babel/types.tSUnionType code examples handpicked from public code repositorys.

8
9
10
11
12
13
14
15
16
17
buildUnion(object/*: Union */) {
  const ast = bt.exportNamedDeclaration(
    bt.tSTypeAliasDeclaration(
      bt.identifier(object.name),
      undefined,
      bt.tSUnionType(object.variants.map((name) => (
        bt.tSTypeReference(bt.identifier(name))
      )))
    ),
    [],
fork icon9
star icon40
watch icon4

+ 3 other calls in file

Other functions in @babel/types

Sorted by popularity

function icon

@babel/types.identifier is the most popular function in @babel/types (20936 examples)