demo/typescript.js
function getEffectiveArgumentCount(node, args, signature) {
            if (node.kind === 139 /* Decorator */) {
                switch (node.parent.kind) {
                    case 214 /* ClassDeclaration */:
                    case 186 /* ClassExpression */:
                        // A class decorator will have one argument (see `ClassDecorator` in core.d.ts)
                        return 1;
                    case 141 /* PropertyDeclaration */:
                        // A property declaration decorator will have two arguments (see
                        // `PropertyDecorator` in core.d.ts)
                        return 2;
                    case 143 /* MethodDeclaration */:
                    case 145 /* GetAccessor */:
                    case 146 /* SetAccessor */:
                        // A method or accessor declaration decorator will have two or three arguments (see
                        // `PropertyDecorator` and `MethodDecorator` in core.d.ts)
                        // If we are emitting decorators for ES3, we will only pass two arguments.
                        if (languageVersion === 0 /* ES3 */) {
                            return 2;
                        }
                        // If the method decorator signature only accepts a target and a key, we will only
                        // type check those arguments.
                        return signature.parameters.length >= 3 ? 3 : 2;
                    case 138 /* Parameter */:
                        // A parameter declaration decorator will have three arguments (see
                        // `ParameterDecorator` in core.d.ts)
                        return 3;
                }
            }
            else {
                return args.length;
            }
        }
function getEffectiveArgumentCount(node, args, signature) {
            if (node.kind === 139 /* Decorator */) {
                switch (node.parent.kind) {
                    case 214 /* ClassDeclaration */:
                    case 186 /* ClassExpression */:
                        // A class decorator will have one argument (see `ClassDecorator` in core.d.ts)
                        return 1;
                    case 141 /* PropertyDeclaration */:
                        // A property declaration decorator will have two arguments (see
                        // `PropertyDecorator` in core.d.ts)
                        return 2;
                    case 143 /* MethodDeclaration */:
                    case 145 /* GetAccessor */:
                    case 146 /* SetAccessor */:
                        // A method or accessor declaration decorator will have two or three arguments (see
                        // `PropertyDecorator` and `MethodDecorator` in core.d.ts)
                        // If we are emitting decorators for ES3, we will only pass two arguments.
                        if (languageVersion === 0 /* ES3 */) {
                            return 2;
                        }
                        // If the method decorator signature only accepts a target and a key, we will only
                        // type check those arguments.
                        return signature.parameters.length >= 3 ? 3 : 2;
                    case 138 /* Parameter */:
                        // A parameter declaration decorator will have three arguments (see
                        // `ParameterDecorator` in core.d.ts)
                        return 3;
                }
            }
            else {
                return args.length;
            }
        }
Returns the effective argument count for a node that works like a function invocation.
If 'node' is a Decorator, the number of arguments is derived from the decoration
target and the signature:
If 'node.target' is a class declaration or class expression, the effective argument
count is 1.
If 'node.target' is a parameter declaration, the effective argument count is 3.
If 'node.target' is a property declaration, the effective argument count is 2.
If 'node.target' is a method or accessor declaration, the effective argument count
is 3, although it can be 2 if the signature only accepts two arguments, allowing
us to match a property decorator.
Otherwise, the argument count is the length of the 'args' array.