eslint-plugin-obsidian
Version:
ESLint rules for Obsidian
30 lines • 1.43 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ComponentProps = void 0;
const ast_1 = require("../utils/ast");
const singleType_1 = require("./types/singleType");
const typeIntersection_1 = require("./types/typeIntersection");
const missingType_1 = require("./types/missingType");
const typeReference_1 = require("./types/typeReference");
class ComponentProps {
constructor(props) {
this.props = props;
}
get type() {
var _a, _b, _c;
const typeAnnotation = (_b = (_a = this.props) === null || _a === void 0 ? void 0 : _a.typeAnnotation) === null || _b === void 0 ? void 0 : _b.typeAnnotation;
if (!typeAnnotation)
return new missingType_1.MissingType();
if ((0, ast_1.isTypeIntersection)(typeAnnotation))
return new typeIntersection_1.TypeIntersection(typeAnnotation);
if ((0, ast_1.isAnyType)(typeAnnotation))
return new missingType_1.MissingType();
if ((0, ast_1.isTypeReference)(typeAnnotation))
return new typeReference_1.TypeReference(typeAnnotation);
if ((0, ast_1.isTypeAnnotation)((_c = this.props) === null || _c === void 0 ? void 0 : _c.typeAnnotation))
return new singleType_1.SingleType(this.props);
return new missingType_1.MissingType();
}
}
exports.ComponentProps = ComponentProps;
//# sourceMappingURL=componentProps.js.map