UNPKG

typir

Version:

General purpose type checking library

40 lines 2.38 kB
/****************************************************************************** * Copyright 2024 TypeFox GmbH * This program and the accompanying materials are made available under the * terms of the MIT License, which is available in the project root. ******************************************************************************/ import { Type, TypeDetails } from '../../graph/type-node.js'; import { TypirServices, TypirSpecifics } from '../../typir.js'; import { Kind, KindOptions } from '../kind.js'; import { MultiplicityType } from './multiplicity-type.js'; export interface MultiplicityTypeDetails<Specifics extends TypirSpecifics> extends TypeDetails<Specifics> { constrainedType: Type; lowerBound: number; upperBound: number; } export interface MultiplicityKindOptions extends KindOptions { symbolForUnlimited: string; } export declare const MULTIPLICITY_UNLIMITED = -1; export declare const MultiplicityKindName = "MultiplicityTypeKind"; /** * Types of this kind constrain a type with lower bound and upper bound, * e.g. ConstrainedType[1..*] or ConstrainedType[2..4]. */ export declare class MultiplicityKind<Specifics extends TypirSpecifics> implements Kind { readonly $name: string; readonly services: TypirServices<Specifics>; readonly options: Readonly<MultiplicityKindOptions>; constructor(services: TypirServices<Specifics>, options?: Partial<MultiplicityKindOptions>); protected collectOptions(options?: Partial<MultiplicityKindOptions>): MultiplicityKindOptions; getMultiplicityType(typeDetails: MultiplicityTypeDetails<Specifics>): MultiplicityType | undefined; createMultiplicityType(typeDetails: MultiplicityTypeDetails<Specifics>): MultiplicityType; protected registerInferenceRules(_typeDetails: MultiplicityTypeDetails<Specifics>, _typeWithMultiplicity: MultiplicityType): void; calculateIdentifier(typeDetails: MultiplicityTypeDetails<Specifics>): string; protected checkBounds(lowerBound: number, upperBound: number): boolean; printRange(lowerBound: number, upperBound: number): string; protected printBound(bound: number): string; isBoundGreaterEquals(leftBound: number, rightBound: number): boolean; } export declare function isMultiplicityKind<Specifics extends TypirSpecifics>(kind: unknown): kind is MultiplicityKind<Specifics>; //# sourceMappingURL=multiplicity-kind.d.ts.map