How to use the tsTypeParameterDeclaration function from @babel/types
Find comprehensive JavaScript @babel/types.tsTypeParameterDeclaration code examples handpicked from public code repositorys.
60 61 62 63 64 65 66 67 68 69
seen.add(path.node); // Find the parent declaration of the reference, and add a generic if needed. let parent = path.findParent(p => p.isDeclaration()); if (!parent.node.typeParameters) { parent.node.typeParameters = t.tsTypeParameterDeclaration([]); } let params = parent.get('typeParameters'); let param = params.node.params.find(p => p.default.typeName.name === name); if (!param) {
108
0
23
+ 13 other calls in file
@babel/types.identifier is the most popular function in @babel/types (20936 examples)