How to use the classDeclaration function from babel-types
Find comprehensive JavaScript babel-types.classDeclaration code examples handpicked from public code repositorys.
GitHub: wx-chevalier/ueact
84 85 86 87 88 89 90 91 92 93
) { node.superClass.object.name = nervJsImportDefaultName; if (node.id === null) { const renameComponentClassName = '_TaroComponentClass'; astPath.replaceWith( t.classDeclaration( t.identifier(renameComponentClassName), node.superClass, node.body, node.decorators || []
5
49
4
+ 5 other calls in file
GitHub: JX-Zhuang/architect
10 11 12 13 14 15 16 17 18 19
const node = path.node; const id = node.id; const superClass = node.superClass; const body = node.body; // const classBody = types.classBody(body.body); // const classDeclaration = types.classDeclaration(id, superClass, classBody,[]); // const classExpression = types.classExpression(id, superClass, classBody,[]); // console.log(classExpression) let func; body.body.forEach(body => {
2
6
2
58 59 60 61 62 63 64 65 66 67 68
function toES6Component(name, jsxElement, publics) { var block = publics.length ? t.blockStatement([props(publics, "class"), t.returnStatement(jsxElement)]) : t.blockStatement([t.returnStatement(jsxElement)]); return t.classDeclaration( t.identifier(name), t.memberExpression(t.identifier("React"), t.identifier("Component")), t.classBody([t.classMethod("method", t.identifier("render"), [], block)]), []
143
0
0
+ 14 other calls in file
babel-types.identifier is the most popular function in babel-types (4076 examples)