How to use the classExpression function from @babel/types
Find comprehensive JavaScript @babel/types.classExpression code examples handpicked from public code repositorys.
GitHub: tapaswenipathak/rax
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) ) ]) ); }
663
0
1
+ 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;
0
0
0
@babel/types.identifier is the most popular function in @babel/types (20936 examples)