How to use the classExpression function from @babel/types

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

84
85
86
87
88
89
90
91
92
93
if (replacer) {
  replacer.replaceWith(
    t.variableDeclaration('const', [
      t.variableDeclarator(
        t.identifier(EXPORTED_DEF),
        t.classExpression(id, t.identifier(SAFE_SUPER_COMPONENT), body, decorators)
      )
    ])
  );
}
fork icon663
star icon0
watch icon1

+ 9 other calls in file

205
206
207
208
209
210
211
212
213
214
var name = path.node.id.name; // have we seen a reference to this class already?
// if so we should replace it with a `var className = class className {}`
// to avoid temporal dead zone issues

if (!path.parentPath.isExportDefaultDeclaration() && path.scope.getData("seenReference:".concat(name))) {
  path.replaceWith(t.variableDeclaration('var', [t.variableDeclarator(t.identifier(name), t.classExpression(path.node.id, path.node.superClass, path.node.body, path.node.decorators || []))]));
  return;
}

className = name;
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)