How to use the tSTypeAliasDeclaration function from @babel/types

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

5
6
7
8
9
10
11
12
13
14


class TypeScriptBuilder extends AbstractJsBuilder {
  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)