How to use the typeAlias function from @babel/types

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

53
54
55
56
57
58
59
60
61
62
/**
 * export type NAME = TYPE
 */
function exportType(name: string, type: BabelAST): $FlowFixMe {
  return t.exportNamedDeclaration(
    t.typeAlias(t.identifier(name), null, type),
    [],
    null,
  );
}
fork icon0
star icon1
watch icon3

+ 7 other calls in file

18
19
20
21
22
23
24
25
26
27

/**
 * type NAME = any;
 */
function anyTypeAlias(name: string): BabelAST {
  return t.typeAlias(t.identifier(name), undefined, t.anyTypeAnnotation());
}

/**
 * {|
fork icon0
star icon1
watch icon1

+ 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)