1 line
15 KiB
JSON
1 line
15 KiB
JSON
{"ast":null,"code":"\"use strict\";\n\nvar _utils = _interopRequireWildcard(require(\"./utils\"));\n\nvar _core = require(\"./core\");\n\nvar _es = require(\"./es2015\");\n\nfunction _getRequireWildcardCache() {\n if (typeof WeakMap !== \"function\") return null;\n var cache = new WeakMap();\n\n _getRequireWildcardCache = function _getRequireWildcardCache() {\n return cache;\n };\n\n return cache;\n}\n\nfunction _interopRequireWildcard(obj) {\n if (obj && obj.__esModule) {\n return obj;\n }\n\n if (obj === null || typeof obj !== \"object\" && typeof obj !== \"function\") {\n return {\n default: obj\n };\n }\n\n var cache = _getRequireWildcardCache();\n\n if (cache && cache.has(obj)) {\n return cache.get(obj);\n }\n\n var newObj = {};\n var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;\n\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;\n\n if (desc && (desc.get || desc.set)) {\n Object.defineProperty(newObj, key, desc);\n } else {\n newObj[key] = obj[key];\n }\n }\n }\n\n newObj.default = obj;\n\n if (cache) {\n cache.set(obj, newObj);\n }\n\n return newObj;\n}\n\nvar bool = (0, _utils.assertValueType)(\"boolean\");\nvar tSFunctionTypeAnnotationCommon = {\n returnType: {\n validate: (0, _utils.assertNodeType)(\"TSTypeAnnotation\", \"Noop\"),\n optional: true\n },\n typeParameters: {\n validate: (0, _utils.assertNodeType)(\"TSTypeParameterDeclaration\", \"Noop\"),\n optional: true\n }\n};\n(0, _utils.default)(\"TSParameterProperty\", {\n aliases: [\"LVal\"],\n visitor: [\"parameter\"],\n fields: {\n accessibility: {\n validate: (0, _utils.assertOneOf)(\"public\", \"private\", \"protected\"),\n optional: true\n },\n readonly: {\n validate: (0, _utils.assertValueType)(\"boolean\"),\n optional: true\n },\n parameter: {\n validate: (0, _utils.assertNodeType)(\"Identifier\", \"AssignmentPattern\")\n }\n }\n});\n(0, _utils.default)(\"TSDeclareFunction\", {\n aliases: [\"Statement\", \"Declaration\"],\n visitor: [\"id\", \"typeParameters\", \"params\", \"returnType\"],\n fields: Object.assign({}, _core.functionDeclarationCommon, {}, tSFunctionTypeAnnotationCommon)\n});\n(0, _utils.default)(\"TSDeclareMethod\", {\n visitor: [\"decorators\", \"key\", \"typeParameters\", \"params\", \"returnType\"],\n fields: Object.assign({}, _es.classMethodOrDeclareMethodCommon, {}, tSFunctionTypeAnnotationCommon)\n});\n(0, _utils.default)(\"TSQualifiedName\", {\n aliases: [\"TSEntityName\"],\n visitor: [\"left\", \"right\"],\n fields: {\n left: (0, _utils.validateType)(\"TSEntityName\"),\n right: (0, _utils.validateType)(\"Identifier\")\n }\n});\nvar signatureDeclarationCommon = {\n typeParameters: (0, _utils.validateOptionalType)(\"TSTypeParameterDeclaration\"),\n parameters: (0, _utils.validateArrayOfType)([\"Identifier\", \"RestElement\"]),\n typeAnnotation: (0, _utils.validateOptionalType)(\"TSTypeAnnotation\")\n};\nvar callConstructSignatureDeclaration = {\n aliases: [\"TSTypeElement\"],\n visitor: [\"typeParameters\", \"parameters\", \"typeAnnotation\"],\n fields: signatureDeclarationCommon\n};\n(0, _utils.default)(\"TSCallSignatureDeclaration\", callConstructSignatureDeclaration);\n(0, _utils.default)(\"TSConstructSignatureDeclaration\", callConstructSignatureDeclaration);\nvar namedTypeElementCommon = {\n key: (0, _utils.validateType)(\"Expression\"),\n computed: (0, _utils.validate)(bool),\n optional: (0, _utils.validateOptional)(bool)\n};\n(0, _utils.default)(\"TSPropertySignature\", {\n aliases: [\"TSTypeElement\"],\n visitor: [\"key\", \"typeAnnotation\", \"initializer\"],\n fields: Object.assign({}, namedTypeElementCommon, {\n readonly: (0, _utils.validateOptional)(bool),\n typeAnnotation: (0, _utils.validateOptionalType)(\"TSTypeAnnotation\"),\n initializer: (0, _utils.validateOptionalType)(\"Expression\")\n })\n});\n(0, _utils.default)(\"TSMethodSignature\", {\n aliases: [\"TSTypeElement\"],\n visitor: [\"key\", \"typeParameters\", \"parameters\", \"typeAnnotation\"],\n fields: Object.assign({}, signatureDeclarationCommon, {}, namedTypeElementCommon)\n});\n(0, _utils.default)(\"TSIndexSignature\", {\n aliases: [\"TSTypeElement\"],\n visitor: [\"parameters\", \"typeAnnotation\"],\n fields: {\n readonly: (0, _utils.validateOptional)(bool),\n parameters: (0, _utils.validateArrayOfType)(\"Identifier\"),\n typeAnnotation: (0, _utils.validateOptionalType)(\"TSTypeAnnotation\")\n }\n});\nvar tsKeywordTypes = [\"TSAnyKeyword\", \"TSBooleanKeyword\", \"TSBigIntKeyword\", \"TSNeverKeyword\", \"TSNullKeyword\", \"TSNumberKeyword\", \"TSObjectKeyword\", \"TSStringKeyword\", \"TSSymbolKeyword\", \"TSUndefinedKeyword\", \"TSUnknownKeyword\", \"TSVoidKeyword\"];\n\nfor (var _i = 0, _tsKeywordTypes = tsKeywordTypes; _i < _tsKeywordTypes.length; _i++) {\n var type = _tsKeywordTypes[_i];\n (0, _utils.default)(type, {\n aliases: [\"TSType\"],\n visitor: [],\n fields: {}\n });\n}\n\n(0, _utils.default)(\"TSThisType\", {\n aliases: [\"TSType\"],\n visitor: [],\n fields: {}\n});\nvar fnOrCtr = {\n aliases: [\"TSType\"],\n visitor: [\"typeParameters\", \"parameters\", \"typeAnnotation\"],\n fields: signatureDeclarationCommon\n};\n(0, _utils.default)(\"TSFunctionType\", fnOrCtr);\n(0, _utils.default)(\"TSConstructorType\", fnOrCtr);\n(0, _utils.default)(\"TSTypeReference\", {\n aliases: [\"TSType\"],\n visitor: [\"typeName\", \"typeParameters\"],\n fields: {\n typeName: (0, _utils.validateType)(\"TSEntityName\"),\n typeParameters: (0, _utils.validateOptionalType)(\"TSTypeParameterInstantiation\")\n }\n});\n(0, _utils.default)(\"TSTypePredicate\", {\n aliases: [\"TSType\"],\n visitor: [\"parameterName\", \"typeAnnotation\"],\n builder: [\"parameterName\", \"typeAnnotation\", \"asserts\"],\n fields: {\n parameterName: (0, _utils.validateType)([\"Identifier\", \"TSThisType\"]),\n typeAnnotation: (0, _utils.validateOptionalType)(\"TSTypeAnnotation\"),\n asserts: (0, _utils.validateOptional)(bool)\n }\n});\n(0, _utils.default)(\"TSTypeQuery\", {\n aliases: [\"TSType\"],\n visitor: [\"exprName\"],\n fields: {\n exprName: (0, _utils.validateType)([\"TSEntityName\", \"TSImportType\"])\n }\n});\n(0, _utils.default)(\"TSTypeLiteral\", {\n aliases: [\"TSType\"],\n visitor: [\"members\"],\n fields: {\n members: (0, _utils.validateArrayOfType)(\"TSTypeElement\")\n }\n});\n(0, _utils.default)(\"TSArrayType\", {\n aliases: [\"TSType\"],\n visitor: [\"elementType\"],\n fields: {\n elementType: (0, _utils.validateType)(\"TSType\")\n }\n});\n(0, _utils.default)(\"TSTupleType\", {\n aliases: [\"TSType\"],\n visitor: [\"elementTypes\"],\n fields: {\n elementTypes: (0, _utils.validateArrayOfType)(\"TSType\")\n }\n});\n(0, _utils.default)(\"TSOptionalType\", {\n aliases: [\"TSType\"],\n visitor: [\"typeAnnotation\"],\n fields: {\n typeAnnotation: (0, _utils.validateType)(\"TSType\")\n }\n});\n(0, _utils.default)(\"TSRestType\", {\n aliases: [\"TSType\"],\n visitor: [\"typeAnnotation\"],\n fields: {\n typeAnnotation: (0, _utils.validateType)(\"TSType\")\n }\n});\nvar unionOrIntersection = {\n aliases: [\"TSType\"],\n visitor: [\"types\"],\n fields: {\n types: (0, _utils.validateArrayOfType)(\"TSType\")\n }\n};\n(0, _utils.default)(\"TSUnionType\", unionOrIntersection);\n(0, _utils.default)(\"TSIntersectionType\", unionOrIntersection);\n(0, _utils.default)(\"TSConditionalType\", {\n aliases: [\"TSType\"],\n visitor: [\"checkType\", \"extendsType\", \"trueType\", \"falseType\"],\n fields: {\n checkType: (0, _utils.validateType)(\"TSType\"),\n extendsType: (0, _utils.validateType)(\"TSType\"),\n trueType: (0, _utils.validateType)(\"TSType\"),\n falseType: (0, _utils.validateType)(\"TSType\")\n }\n});\n(0, _utils.default)(\"TSInferType\", {\n aliases: [\"TSType\"],\n visitor: [\"typeParameter\"],\n fields: {\n typeParameter: (0, _utils.validateType)(\"TSTypeParameter\")\n }\n});\n(0, _utils.default)(\"TSParenthesizedType\", {\n aliases: [\"TSType\"],\n visitor: [\"typeAnnotation\"],\n fields: {\n typeAnnotation: (0, _utils.validateType)(\"TSType\")\n }\n});\n(0, _utils.default)(\"TSTypeOperator\", {\n aliases: [\"TSType\"],\n visitor: [\"typeAnnotation\"],\n fields: {\n operator: (0, _utils.validate)((0, _utils.assertValueType)(\"string\")),\n typeAnnotation: (0, _utils.validateType)(\"TSType\")\n }\n});\n(0, _utils.default)(\"TSIndexedAccessType\", {\n aliases: [\"TSType\"],\n visitor: [\"objectType\", \"indexType\"],\n fields: {\n objectType: (0, _utils.validateType)(\"TSType\"),\n indexType: (0, _utils.validateType)(\"TSType\")\n }\n});\n(0, _utils.default)(\"TSMappedType\", {\n aliases: [\"TSType\"],\n visitor: [\"typeParameter\", \"typeAnnotation\"],\n fields: {\n readonly: (0, _utils.validateOptional)(bool),\n typeParameter: (0, _utils.validateType)(\"TSTypeParameter\"),\n optional: (0, _utils.validateOptional)(bool),\n typeAnnotation: (0, _utils.validateOptionalType)(\"TSType\")\n }\n});\n(0, _utils.default)(\"TSLiteralType\", {\n aliases: [\"TSType\"],\n visitor: [\"literal\"],\n fields: {\n literal: (0, _utils.validateType)([\"NumericLiteral\", \"StringLiteral\", \"BooleanLiteral\"])\n }\n});\n(0, _utils.default)(\"TSExpressionWithTypeArguments\", {\n aliases: [\"TSType\"],\n visitor: [\"expression\", \"typeParameters\"],\n fields: {\n expression: (0, _utils.validateType)(\"TSEntityName\"),\n typeParameters: (0, _utils.validateOptionalType)(\"TSTypeParameterInstantiation\")\n }\n});\n(0, _utils.default)(\"TSInterfaceDeclaration\", {\n aliases: [\"Statement\", \"Declaration\"],\n visitor: [\"id\", \"typeParameters\", \"extends\", \"body\"],\n fields: {\n declare: (0, _utils.validateOptional)(bool),\n id: (0, _utils.validateType)(\"Identifier\"),\n typeParameters: (0, _utils.validateOptionalType)(\"TSTypeParameterDeclaration\"),\n extends: (0, _utils.validateOptional)((0, _utils.arrayOfType)(\"TSExpressionWithTypeArguments\")),\n body: (0, _utils.validateType)(\"TSInterfaceBody\")\n }\n});\n(0, _utils.default)(\"TSInterfaceBody\", {\n visitor: [\"body\"],\n fields: {\n body: (0, _utils.validateArrayOfType)(\"TSTypeElement\")\n }\n});\n(0, _utils.default)(\"TSTypeAliasDeclaration\", {\n aliases: [\"Statement\", \"Declaration\"],\n visitor: [\"id\", \"typeParameters\", \"typeAnnotation\"],\n fields: {\n declare: (0, _utils.validateOptional)(bool),\n id: (0, _utils.validateType)(\"Identifier\"),\n typeParameters: (0, _utils.validateOptionalType)(\"TSTypeParameterDeclaration\"),\n typeAnnotation: (0, _utils.validateType)(\"TSType\")\n }\n});\n(0, _utils.default)(\"TSAsExpression\", {\n aliases: [\"Expression\"],\n visitor: [\"expression\", \"typeAnnotation\"],\n fields: {\n expression: (0, _utils.validateType)(\"Expression\"),\n typeAnnotation: (0, _utils.validateType)(\"TSType\")\n }\n});\n(0, _utils.default)(\"TSTypeAssertion\", {\n aliases: [\"Expression\"],\n visitor: [\"typeAnnotation\", \"expression\"],\n fields: {\n typeAnnotation: (0, _utils.validateType)(\"TSType\"),\n expression: (0, _utils.validateType)(\"Expression\")\n }\n});\n(0, _utils.default)(\"TSEnumDeclaration\", {\n aliases: [\"Statement\", \"Declaration\"],\n visitor: [\"id\", \"members\"],\n fields: {\n declare: (0, _utils.validateOptional)(bool),\n const: (0, _utils.validateOptional)(bool),\n id: (0, _utils.validateType)(\"Identifier\"),\n members: (0, _utils.validateArrayOfType)(\"TSEnumMember\"),\n initializer: (0, _utils.validateOptionalType)(\"Expression\")\n }\n});\n(0, _utils.default)(\"TSEnumMember\", {\n visitor: [\"id\", \"initializer\"],\n fields: {\n id: (0, _utils.validateType)([\"Identifier\", \"StringLiteral\"]),\n initializer: (0, _utils.validateOptionalType)(\"Expression\")\n }\n});\n(0, _utils.default)(\"TSModuleDeclaration\", {\n aliases: [\"Statement\", \"Declaration\"],\n visitor: [\"id\", \"body\"],\n fields: {\n declare: (0, _utils.validateOptional)(bool),\n global: (0, _utils.validateOptional)(bool),\n id: (0, _utils.validateType)([\"Identifier\", \"StringLiteral\"]),\n body: (0, _utils.validateType)([\"TSModuleBlock\", \"TSModuleDeclaration\"])\n }\n});\n(0, _utils.default)(\"TSModuleBlock\", {\n aliases: [\"Scopable\", \"Block\", \"BlockParent\"],\n visitor: [\"body\"],\n fields: {\n body: (0, _utils.validateArrayOfType)(\"Statement\")\n }\n});\n(0, _utils.default)(\"TSImportType\", {\n aliases: [\"TSType\"],\n visitor: [\"argument\", \"qualifier\", \"typeParameters\"],\n fields: {\n argument: (0, _utils.validateType)(\"StringLiteral\"),\n qualifier: (0, _utils.validateOptionalType)(\"TSEntityName\"),\n typeParameters: (0, _utils.validateOptionalType)(\"TSTypeParameterInstantiation\")\n }\n});\n(0, _utils.default)(\"TSImportEqualsDeclaration\", {\n aliases: [\"Statement\"],\n visitor: [\"id\", \"moduleReference\"],\n fields: {\n isExport: (0, _utils.validate)(bool),\n id: (0, _utils.validateType)(\"Identifier\"),\n moduleReference: (0, _utils.validateType)([\"TSEntityName\", \"TSExternalModuleReference\"])\n }\n});\n(0, _utils.default)(\"TSExternalModuleReference\", {\n visitor: [\"expression\"],\n fields: {\n expression: (0, _utils.validateType)(\"StringLiteral\")\n }\n});\n(0, _utils.default)(\"TSNonNullExpression\", {\n aliases: [\"Expression\"],\n visitor: [\"expression\"],\n fields: {\n expression: (0, _utils.validateType)(\"Expression\")\n }\n});\n(0, _utils.default)(\"TSExportAssignment\", {\n aliases: [\"Statement\"],\n visitor: [\"expression\"],\n fields: {\n expression: (0, _utils.validateType)(\"Expression\")\n }\n});\n(0, _utils.default)(\"TSNamespaceExportDeclaration\", {\n aliases: [\"Statement\"],\n visitor: [\"id\"],\n fields: {\n id: (0, _utils.validateType)(\"Identifier\")\n }\n});\n(0, _utils.default)(\"TSTypeAnnotation\", {\n visitor: [\"typeAnnotation\"],\n fields: {\n typeAnnotation: {\n validate: (0, _utils.assertNodeType)(\"TSType\")\n }\n }\n});\n(0, _utils.default)(\"TSTypeParameterInstantiation\", {\n visitor: [\"params\"],\n fields: {\n params: {\n validate: (0, _utils.chain)((0, _utils.assertValueType)(\"array\"), (0, _utils.assertEach)((0, _utils.assertNodeType)(\"TSType\")))\n }\n }\n});\n(0, _utils.default)(\"TSTypeParameterDeclaration\", {\n visitor: [\"params\"],\n fields: {\n params: {\n validate: (0, _utils.chain)((0, _utils.assertValueType)(\"array\"), (0, _utils.assertEach)((0, _utils.assertNodeType)(\"TSTypeParameter\")))\n }\n }\n});\n(0, _utils.default)(\"TSTypeParameter\", {\n builder: [\"constraint\", \"default\", \"name\"],\n visitor: [\"constraint\", \"default\"],\n fields: {\n name: {\n validate: (0, _utils.assertValueType)(\"string\")\n },\n constraint: {\n validate: (0, _utils.assertNodeType)(\"TSType\"),\n optional: true\n },\n default: {\n validate: (0, _utils.assertNodeType)(\"TSType\"),\n optional: true\n }\n }\n});","map":null,"metadata":{},"sourceType":"script"} |