How to use the typeAlias function from babel-types

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

106
107
108
109
110
111
112
113
114
115
for (let key in cssData.properties) {
  let prop = parseSyntax(cssData.properties[key]);
  key = toCamelCase(key);
  statementList.push(
    t.exportNamedDeclaration(
      t.typeAlias(
        t.identifier(propertyName(key)),
        null,
        normalizeType(buildType(prop, key)),
      ),
fork icon10
star icon148
watch icon8

+ 17 other calls in file

29
30
31
32
33
34
35
36
37
38
/**
 * export type NAME = TYPE
 */
function exportType(name: string, type: BabelAST) {
  return t.exportNamedDeclaration(
    t.typeAlias(t.identifier(name), null, type),
    [],
    null,
  );
}
fork icon0
star icon1
watch icon3

+ 5 other calls in file

223
224
225
226
227
228
229
230
231
232
Fragment(node) {
  const baseType = selectionsToBabel(node.selections);
  const type = isPlural(node) ? arrayOfType(baseType) : baseType;

  return t.exportNamedDeclaration(
    t.typeAlias(t.identifier(node.name), null, type),
    [],
    null,
  );
},
fork icon0
star icon1
watch icon2

+ 3 other calls in file

113
114
115
116
117
118
119
120
121
122
path.traverse(findObjectTypeProperty, {prevName: this.name});

// Add the node of that transformed path to the array
normalizedRoots.push(
  t.exportNamedDeclaration(
    t.typeAlias(t.identifier(this.name), null, path.node),
    [],
    null,
  ),
);
fork icon0
star icon1
watch icon2

+ 19 other calls in file

17
18
19
20
21
22
23
24
25
26

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

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

+ 7 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 (4076 examples)