demo/typescript.js
function emitSerializedTypeOfNode(node) {
                // serialization of the type of a declaration uses the following rules:
                //
                // * The serialized type of a ClassDeclaration is "Function"
                // * The serialized type of a ParameterDeclaration is the serialized type of its type annotation.
                // * The serialized type of a PropertyDeclaration is the serialized type of its type annotation.
                // * The serialized type of an AccessorDeclaration is the serialized type of the return type annotation of its getter or parameter type annotation of its setter.
                // * The serialized type of any other FunctionLikeDeclaration is "Function".
                // * The serialized type of any other node is "void 0".
                //
                // For rules on serializing type annotations, see `serializeTypeNode`.
                switch (node.kind) {
                    case 214 /* ClassDeclaration */:
                        write("Function");
                        return;
                    case 141 /* PropertyDeclaration */:
                        emitSerializedTypeNode(node.type);
                        return;
                    case 138 /* Parameter */:
                        emitSerializedTypeNode(node.type);
                        return;
                    case 145 /* GetAccessor */:
                        emitSerializedTypeNode(node.type);
                        return;
                    case 146 /* SetAccessor */:
                        emitSerializedTypeNode(ts.getSetAccessorTypeAnnotationNode(node));
                        return;
                }
                if (ts.isFunctionLike(node)) {
                    write("Function");
                    return;
                }
                write("void 0");
            }
function emitSerializedTypeOfNode(node) {
                // serialization of the type of a declaration uses the following rules:
                //
                // * The serialized type of a ClassDeclaration is "Function"
                // * The serialized type of a ParameterDeclaration is the serialized type of its type annotation.
                // * The serialized type of a PropertyDeclaration is the serialized type of its type annotation.
                // * The serialized type of an AccessorDeclaration is the serialized type of the return type annotation of its getter or parameter type annotation of its setter.
                // * The serialized type of any other FunctionLikeDeclaration is "Function".
                // * The serialized type of any other node is "void 0".
                //
                // For rules on serializing type annotations, see `serializeTypeNode`.
                switch (node.kind) {
                    case 214 /* ClassDeclaration */:
                        write("Function");
                        return;
                    case 141 /* PropertyDeclaration */:
                        emitSerializedTypeNode(node.type);
                        return;
                    case 138 /* Parameter */:
                        emitSerializedTypeNode(node.type);
                        return;
                    case 145 /* GetAccessor */:
                        emitSerializedTypeNode(node.type);
                        return;
                    case 146 /* SetAccessor */:
                        emitSerializedTypeNode(ts.getSetAccessorTypeAnnotationNode(node));
                        return;
                }
                if (ts.isFunctionLike(node)) {
                    write("Function");
                    return;
                }
                write("void 0");
            }
Serializes the type of a declaration to an appropriate JS constructor value. Used by the __metadata decorator for a class member.