How to use the createTSUnionType function from @babel/types

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

52
53
54
55
56
57
58
59
60
61
if (!types.length) {
  return;
}

if (t.isTSTypeAnnotation(types[0]) && t.createTSUnionType) {
  return t.createTSUnionType(types);
}

if (t.createFlowUnionType) {
  return t.createFlowUnionType(types);
fork icon0
star icon1
watch icon1

+ 5 other calls in file

112
113
114
115
116
117
118
119
120
121
122
123
124


function LogicalExpression() {
  const argumentTypes = [this.get("left").getTypeAnnotation(), this.get("right").getTypeAnnotation()];


  if (t.isTSTypeAnnotation(argumentTypes[0]) && t.createTSUnionType) {
    return t.createTSUnionType(argumentTypes);
  }


  if (t.createFlowUnionType) {
    return t.createFlowUnionType(argumentTypes);
fork icon0
star icon0
watch icon0

Other functions in @babel/types

Sorted by popularity

function icon

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