How to use the isTSTypeAliasDeclaration function from @babel/types
Find comprehensive JavaScript @babel/types.isTSTypeAliasDeclaration code examples handpicked from public code repositorys.
41 42 43 44 45 46 47 48 49 50
} if (node.abstract) { comment.abstract = true; } } } else if (t.isTypeAlias(node) || t.isTSTypeAliasDeclaration(node)) { comment.kind = 'typedef'; } else if ( t.isInterfaceDeclaration(node) || t.isTSInterfaceDeclaration(node)
509
0
0
+ 20 other calls in file
188 189 190 191 192 193 194 195 196 197
} else if ( t.isClassDeclaration(declaration) || t.isFunctionDeclaration(declaration) || t.isTypeAlias(declaration) || t.isInterfaceDeclaration(declaration) || t.isTSTypeAliasDeclaration(declaration) || t.isTSInterfaceDeclaration(declaration) || t.isTSEnumDeclaration(declaration) || t.isTSDeclareFunction(declaration) || t.isTSDeclareMethod(declaration)
6
34
0
+ 3 other calls in file
GitHub: groupon/esfixup
47 48 49 50 51 52 53 54 55 56
try { const parseResult = /** @type {babel.types.File} */ ( parse(`type X = ${code}`, { plugins: ['typescript'] }) ); const { body } = parseResult.program; return t.isTSTypeAliasDeclaration(body[0]) ? body[0].typeAnnotation : t.tsUnknownKeyword(); } catch (err) { debug(`Failed to parse type string "${code}"`, err);
0
0
7
+ 5 other calls in file
@babel/types.identifier is the most popular function in @babel/types (20936 examples)