Sha256: 89ddead58c35e9025de95e97dcee798c9b0d6aeb260cdc17eb59dc76a5d1e414

Contents?: true

Size: 1.92 KB

Versions: 15

Compression:

Stored size: 1.92 KB

Contents

"use strict";
/**
 * Type annotation defs shared between Flow and TypeScript.
 * These defs could not be defined in ./flow.ts or ./typescript.ts directly
 * because they use the same name.
 */
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var types_1 = tslib_1.__importDefault(require("../types"));
var shared_1 = tslib_1.__importStar(require("../shared"));
function default_1(fork) {
    var types = fork.use(types_1.default);
    var def = types.Type.def;
    var or = types.Type.or;
    var defaults = fork.use(shared_1.default).defaults;
    var TypeAnnotation = or(def("TypeAnnotation"), def("TSTypeAnnotation"), null);
    var TypeParamDecl = or(def("TypeParameterDeclaration"), def("TSTypeParameterDeclaration"), null);
    def("Identifier")
        .field("typeAnnotation", TypeAnnotation, defaults["null"]);
    def("ObjectPattern")
        .field("typeAnnotation", TypeAnnotation, defaults["null"]);
    def("Function")
        .field("returnType", TypeAnnotation, defaults["null"])
        .field("typeParameters", TypeParamDecl, defaults["null"]);
    def("ClassProperty")
        .build("key", "value", "typeAnnotation", "static")
        .field("value", or(def("Expression"), null))
        .field("static", Boolean, defaults["false"])
        .field("typeAnnotation", TypeAnnotation, defaults["null"]);
    ["ClassDeclaration",
        "ClassExpression",
    ].forEach(function (typeName) {
        def(typeName)
            .field("typeParameters", TypeParamDecl, defaults["null"])
            .field("superTypeParameters", or(def("TypeParameterInstantiation"), def("TSTypeParameterInstantiation"), null), defaults["null"])
            .field("implements", or([def("ClassImplements")], [def("TSExpressionWithTypeArguments")]), defaults.emptyArray);
    });
}
exports.default = default_1;
;
(0, shared_1.maybeSetModuleExports)(function () { return module; });
//# sourceMappingURL=type-annotations.js.map

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
immosquare-cleaner-0.1.52 node_modules/ast-types/lib/def/type-annotations.js
immosquare-cleaner-0.1.51 node_modules/ast-types/lib/def/type-annotations.js
immosquare-cleaner-0.1.50 node_modules/ast-types/lib/def/type-annotations.js
immosquare-cleaner-0.1.49 node_modules/ast-types/lib/def/type-annotations.js
immosquare-cleaner-0.1.48 node_modules/ast-types/lib/def/type-annotations.js
immosquare-cleaner-0.1.47 node_modules/ast-types/lib/def/type-annotations.js
immosquare-cleaner-0.1.46 node_modules/ast-types/lib/def/type-annotations.js
immosquare-cleaner-0.1.45 node_modules/ast-types/lib/def/type-annotations.js
immosquare-cleaner-0.1.44 node_modules/ast-types/lib/def/type-annotations.js
immosquare-cleaner-0.1.43 node_modules/ast-types/lib/def/type-annotations.js
immosquare-cleaner-0.1.42 node_modules/ast-types/lib/def/type-annotations.js
immosquare-cleaner-0.1.41 node_modules/ast-types/lib/def/type-annotations.js
immosquare-cleaner-0.1.40 node_modules/ast-types/lib/def/type-annotations.js
immosquare-cleaner-0.1.39 node_modules/ast-types/lib/def/type-annotations.js
immosquare-cleaner-0.1.38 node_modules/ast-types/lib/def/type-annotations.js