How to use the tsInterfaceDeclaration function from @babel/types

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

37
38
39
40
41
42
43
44
45
46

buildInterface(object/*: Interface*/) {
  const fields = Object.keys(object.fields)
    .map((fieldName) => this.buildField(object.fields[fieldName]))
  const ast = bt.exportNamedDeclaration(
    bt.tsInterfaceDeclaration(
      bt.identifier(object.name),
      undefined,
      null,
      bt.tsInterfaceBody(fields),
fork icon9
star icon40
watch icon4

+ 7 other calls in file

96
97
98
99
100
101
102
103
104
105
 * @param {string} propLines
 */
function handleTypedefObjBlock(stmts, m, objName, propLines) {
  stmts.push(
    t.exportNamedDeclaration(
      t.tsInterfaceDeclaration(
        t.identifier(objName),
        null,
        null,
        t.tsInterfaceBody(propLines.trim().split('\n').map(propLineToTypeElem))
fork icon0
star icon0
watch icon7

+ 3 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)