ecmarkup
Version:
Custom element definitions and core utilities for markup that specifies ECMAScript and related technologies.
91 lines (90 loc) • 2.52 kB
TypeScript
export interface BiblioEntryBase {
type: string;
location: string;
namespace?: string;
id?: string;
refId?: string;
aoid?: string | null;
referencingIds: string[];
}
export type Type = {
kind: 'opaque';
type: string;
} | {
kind: 'unused';
} | {
kind: 'completion';
completionType: 'abrupt';
} | {
kind: 'completion';
typeOfValueIfNormal: Type | null;
completionType: 'normal' | 'mixed';
} | {
kind: 'list';
elements: Type | null;
} | {
kind: 'union';
types: Exclude<Type, {
kind: 'union';
}>[];
} | {
kind: 'record';
fields: Record<string, Type | null>;
};
export type Parameter = {
name: string;
type: null | Type;
};
export type Signature = {
parameters: Parameter[];
optionalParameters: Parameter[];
return: null | Type;
};
export type AlgorithmType = 'abstract operation' | 'host-defined abstract operation' | 'implementation-defined abstract operation' | 'syntax-directed operation' | 'numeric method';
export interface AlgorithmBiblioEntry extends BiblioEntryBase {
type: 'op';
aoid: string;
kind?: AlgorithmType;
signature: null | Signature;
effects: string[];
skipGlobalChecks?: boolean;
}
export interface ProductionBiblioEntry extends BiblioEntryBase {
type: 'production';
name: string;
}
export interface ClauseBiblioEntry extends BiblioEntryBase {
type: 'clause';
id: string;
aoid: string | null;
title: string;
titleHTML: string;
number: string | number;
}
export interface TermBiblioEntry extends BiblioEntryBase {
type: 'term';
term: string;
variants?: string[];
}
export interface FigureBiblioEntry extends BiblioEntryBase {
type: 'table' | 'figure' | 'example' | 'note';
id: string;
number: string | number;
clauseId?: string;
caption?: string;
}
export interface StepBiblioEntry extends BiblioEntryBase {
type: 'step';
id: string;
stepNumbers: number[];
}
export type BiblioEntry = AlgorithmBiblioEntry | ProductionBiblioEntry | ClauseBiblioEntry | TermBiblioEntry | FigureBiblioEntry | StepBiblioEntry;
type Unkey<T, S extends string> = T extends any ? Omit<T, S> : never;
type NonExportedKeys = 'location' | 'referencingIds' | 'namespace';
export type PartialBiblioEntry = Unkey<BiblioEntry, NonExportedKeys>;
export type ExportedBiblio = {
location: string;
entries: PartialBiblioEntry[];
};
export declare function getKeys(entry: TermBiblioEntry): string[];
export {};