docs/libs/typescript.js
function checkDecorators(node) {
            if (!node.decorators) {
                return;
            }
            // skip this check for nodes that cannot have decorators. These should have already had an error reported by
            // checkGrammarDecorators.
            if (!ts.nodeCanBeDecorated(node)) {
                return;
            }
            if (!compilerOptions.experimentalDecorators) {
                error(node, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning);
            }
            if (compilerOptions.emitDecoratorMetadata) {
                // we only need to perform these checks if we are emitting serialized type metadata for the target of a decorator.
                switch (node.kind) {
                    case 221 /* ClassDeclaration */:
                        var constructor = ts.getFirstConstructorWithBody(node);
                        if (constructor) {
                            checkParameterTypeAnnotationsAsExpressions(constructor);
                        }
                        break;
                    case 147 /* MethodDeclaration */:
                    case 149 /* GetAccessor */:
                    case 150 /* SetAccessor */:
                        checkParameterTypeAnnotationsAsExpressions(node);
                        checkReturnTypeAnnotationAsExpression(node);
                        break;
                    case 145 /* PropertyDeclaration */:
                    case 142 /* Parameter */:
                        checkTypeAnnotationAsExpression(node);
                        break;
                }
            }
            ts.forEach(node.decorators, checkDecorator);
        }
function checkDecorators(node) {
            if (!node.decorators) {
                return;
            }
            // skip this check for nodes that cannot have decorators. These should have already had an error reported by
            // checkGrammarDecorators.
            if (!ts.nodeCanBeDecorated(node)) {
                return;
            }
            if (!compilerOptions.experimentalDecorators) {
                error(node, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning);
            }
            if (compilerOptions.emitDecoratorMetadata) {
                // we only need to perform these checks if we are emitting serialized type metadata for the target of a decorator.
                switch (node.kind) {
                    case 221 /* ClassDeclaration */:
                        var constructor = ts.getFirstConstructorWithBody(node);
                        if (constructor) {
                            checkParameterTypeAnnotationsAsExpressions(constructor);
                        }
                        break;
                    case 147 /* MethodDeclaration */:
                    case 149 /* GetAccessor */:
                    case 150 /* SetAccessor */:
                        checkParameterTypeAnnotationsAsExpressions(node);
                        checkReturnTypeAnnotationAsExpression(node);
                        break;
                    case 145 /* PropertyDeclaration */:
                    case 142 /* Parameter */:
                        checkTypeAnnotationAsExpression(node);
                        break;
                }
            }
            ts.forEach(node.decorators, checkDecorator);
        }
function checkDecorators ( node ) { if ( ! node . decorators ) { return ; } // skip this check for nodes that cannot have decorators. These should have already had an error reported by // checkGrammarDecorators. if ( ! ts . nodeCanBeDecorated ( node ) ) { return ; } if ( ! compilerOptions . experimentalDecorators ) { error ( node , ts . Diagnostics . Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning ) ; } if ( compilerOptions . emitDecoratorMetadata ) { // we only need to perform these checks if we are emitting serialized type metadata for the target of a decorator. switch ( node . kind ) { case 221 /* ClassDeclaration */ : var constructor = ts . getFirstConstructorWithBody ( node ) ; if ( constructor ) { checkParameterTypeAnnotationsAsExpressions ( constructor ) ; } break ; case 147 /* MethodDeclaration */ : case 149 /* GetAccessor */ : case 150 /* SetAccessor */ : checkParameterTypeAnnotationsAsExpressions ( node ) ; checkReturnTypeAnnotationAsExpression ( node ) ; break ; case 145 /* PropertyDeclaration */ : case 142 /* Parameter */ : checkTypeAnnotationAsExpression ( node ) ; break ; } } ts . forEach ( node . decorators , checkDecorator ) ; }
Check the decorators of a node
Check the decorators of a node