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) {
fork icon108
star icon0
watch icon23

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