UNPKG

@typespec/compiler

Version:

TypeSpec compiler and standard library

29 lines 869 B
import { isArrayModelType } from "../../core/type-utils.js"; import { defineKit } from "../define-kit.js"; defineKit({ array: { is(type) { return (type.entityKind === "Type" && type.kind === "Model" && isArrayModelType(type) && type.properties.size === 0); }, getElementType(type) { if (!this.array.is(type)) { throw new Error("Type is not an array."); } return type.indexer.value; }, create(elementType) { return this.model.create({ name: "Array", properties: {}, indexer: { key: this.builtin.integer, value: elementType, }, }); }, }, }); //# sourceMappingURL=array.js.map