How to use the isClassDeclaration function from typescript

Find comprehensive JavaScript typescript.isClassDeclaration code examples handpicked from public code repositorys.

166
167
168
169
170
171
172
173
174
175
ts.isInterfaceDeclaration(s) ||
ts.isModuleDeclaration(s) ||
ts.isEnumDeclaration(s) ||
(isGlobal && (
    // in global scripts we don't wrap classes and functions so they can be accessed from non-global scripts
    ts.isClassDeclaration(s) ||
    ts.isFunctionDeclaration(s)
)) ||
// and declare ... / export ... statements
(s.modifiers &&
fork icon116
star icon294
watch icon29

+ 5 other calls in file

116
117
118
119
120
121
122
123
124
125
    [AngularClassDecorators.NgModule, new Set([])],
    [AngularClassDecorators.Pipe, new Set([AngularLifecycleMethods.ngOnDestroy])]
]);
exports.getClassName = function (node) {
    var klass = exports.getNextToLastParentNode(node);
    return typescript_1.isClassDeclaration(klass) && klass.name ? klass.name.text : undefined;
};
exports.getDecorator = function (node, decoratorName) {
    return typescript_1.createNodeArray(node.decorators).find(function (decorator) {
        return typescript_1.isCallExpression(decorator.expression) &&
fork icon0
star icon0
watch icon1

116
117
118
119
120
121
122
123
124
125
    || !ts.isIdentifier(returnStatement.expression)) {
    return false;
}
if (functionExpression.parameters.length === 0) {
    // potential non-extended class or wrapped es2015 class
    return (ts.isFunctionDeclaration(firstStatement) || ts.isClassDeclaration(firstStatement))
        && firstStatement.name !== undefined
        && returnStatement.expression.text === firstStatement.name.text;
}
else if (functionExpression.parameters.length !== 1) {
fork icon0
star icon0
watch icon1

Other functions in typescript

Sorted by popularity

function icon

typescript.SyntaxKind is the most popular function in typescript (82777 examples)