UNPKG

eslint-plugin-obsidian

Version:

ESLint rules for Obsidian

36 lines 1.16 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.TypeIntersection = void 0; const lodash_1 = require("lodash"); const identifier_1 = require("../identifier"); const typeReference_1 = require("./typeReference"); class TypeIntersection { constructor(typeAnnotation) { this.typeAnnotation = typeAnnotation; } toString() { return this.typeAnnotation.types.map((type) => { const typeRef = type; return new identifier_1.Identifier(typeRef.typeName).name; }); } isEmpty() { return this.typeAnnotation.types.length === 0; } equals(types) { return (0, lodash_1.isEqual)(this.toString(), types.map((type) => type.toString()).flat()); } includes(type) { return this.types.every((t) => t.includes(type)); } get types() { return this.typeAnnotation.types.map((type) => { return new typeReference_1.TypeReference(type); }); } size() { return this.typeAnnotation.types.length; } } exports.TypeIntersection = TypeIntersection; //# sourceMappingURL=typeIntersection.js.map