How to use the isTSDeclareFunction function from @babel/types

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

21
22
23
24
25
26
27
28
29
30
    comment.abstract = true;
  }
} else if (
  t.isFunction(node) ||
  t.isTSDeclareMethod(node) ||
  t.isTSDeclareFunction(node) ||
  t.isFunctionTypeAnnotation(node) ||
  t.isTSMethodSignature(node)
) {
  if (node.kind === 'get' || node.kind === 'set') {
fork icon509
star icon0
watch icon0

+ 20 other calls in file

98
99
100
101
102
103
104
105
106
107
}

function getReturnType(fn) {
  if (
    t.isFunction(fn) ||
    t.isTSDeclareFunction(fn) ||
    t.isTSDeclareMethod(fn) ||
    t.isFunctionTypeAnnotation(fn)
  ) {
    return fn.returnType;
fork icon509
star icon0
watch icon0

+ 3 other calls in file

191
192
193
194
195
196
197
198
199
200
  t.isTypeAlias(declaration) ||
  t.isInterfaceDeclaration(declaration) ||
  t.isTSTypeAliasDeclaration(declaration) ||
  t.isTSInterfaceDeclaration(declaration) ||
  t.isTSEnumDeclaration(declaration) ||
  t.isTSDeclareFunction(declaration) ||
  t.isTSDeclareMethod(declaration)
) {
  let name = declaration.id.name;
  exploded.exports.push(toModuleSpecifier(null, name, name, source, declaration.loc));
fork icon6
star icon34
watch icon0

+ 3 other calls in file

110
111
112
113
114
115
116
117
118
119
		params: func.parameters,
		returnType: func.typeAnnotation.typeAnnotation.typeName.name,
	};
} else {
	let func = funcs.legacy.body.find(
		(f) => t.isTSDeclareFunction(f) && f.id.name === n
	);
	return {
		params: func.params,
		returnType: func.returnType.typeAnnotation.typeName.name,
fork icon0
star icon0
watch icon0

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