How to use the voidTypeAnnotation function from @babel/types

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

@babel/types.voidTypeAnnotation represents the void type in JavaScript.

21
22
23
24
25
26
27
28
29
30
31
      return getTypeAnnotationBindingConstantViolations(binding, this, node.name);
    }
  }


  if (node.name === "undefined") {
    return t.voidTypeAnnotation();
  } else if (node.name === "NaN" || node.name === "Infinity") {
    return t.numberTypeAnnotation();
  } else if (node.name === "arguments") {}
}
fork icon0
star icon1
watch icon1

+ 2 other calls in file

How does @babel/types.voidTypeAnnotation work?

@babel/types.voidTypeAnnotation is a function provided by Babel that creates an AST node representing the void type in JavaScript, indicating the absence of any value. It does not take any arguments and returns a new VoidTypeAnnotation node.

Ai Example

1
2
3
4
const t = require("@babel/types");

const voidAnnotation = t.voidTypeAnnotation();
console.log(voidAnnotation);

Output: bash Copy code

Other functions in @babel/types

Sorted by popularity

function icon

@babel/types.identifier is the most popular function in @babel/types (20936 examples)