import { type AnnotationInheritancePolicy, type CustomAnnotationTagDocumentation, type MetadataSlotRegistration } from "@stripe/formspec-core/internals"; export type FormSpecValueKind = "number" | "integer" | "signedInteger" | "string" | "json" | "boolean" | "condition"; /** * Target syntaxes that a FormSpec tag can accept. * * @public */ export type FormSpecTargetKind = "none" | "path" | "member" | "variant"; export type FormSpecTagCategory = "constraint" | "annotation" | "structure" | "ecosystem"; /** * Declaration contexts where a FormSpec tag may appear. * * @public */ export type FormSpecPlacement = "class" | "class-field" | "class-method" | "interface" | "interface-field" | "type-alias" | "type-alias-field" | "variable" | "function" | "function-parameter" | "method-parameter"; export type SemanticCapability = "numeric-comparable" | "string-like" | "array-like" | "enum-member-addressable" | "json-like" | "condition-like" | "object-like"; export interface TagSignatureParameter { readonly kind: "value" | "target-path" | "target-member" | "target-variant"; readonly label: string; readonly optional?: boolean; readonly capability?: SemanticCapability; readonly valueKind?: FormSpecValueKind; } export interface TagSignature { readonly label: string; readonly placements: readonly FormSpecPlacement[]; readonly parameters: readonly TagSignatureParameter[]; } export interface TagDefinition { readonly canonicalName: string; readonly valueKind: FormSpecValueKind | null; readonly requiresArgument: boolean; readonly supportedTargets: readonly FormSpecTargetKind[]; readonly allowDuplicates: boolean; readonly category: FormSpecTagCategory; readonly placements: readonly FormSpecPlacement[]; /** * Type-level semantic inheritance policy for annotation tags. Omitted * registrations behave as `"never"`. `"local-wins"` means a derived * declaration inherits this annotation only when it does not provide the * same annotation identity locally. */ readonly inheritFromBase?: AnnotationInheritancePolicy; /** * The semantic capabilities required of the field type for this tag to be * applicable. At most one capability may be declared per tag. * * The "at most one" invariant is structural: all `capabilitiesForValueKind` * return paths yield 0 or 1 elements, and no tag definition supplies 2+ * capabilities. The tuple type enforces this at the type level so future * additions that accidentally provide two capabilities produce a type error. */ readonly capabilities: readonly [SemanticCapability] | readonly []; readonly completionDetail: string; readonly hoverSummary: string; readonly hoverMarkdown: string; readonly signatures: readonly TagSignature[]; } export type FormSpecTagDefinition = TagDefinition; export type FormSpecTagOverload = TagSignature; export type FormSpecTagParameter = TagSignatureParameter; export interface ExtensionConstraintTagSource { readonly tagName: string; } export interface ExtensionAnnotationTagSource { readonly annotationName: string; readonly inheritFromBase?: AnnotationInheritancePolicy; readonly tagDocumentation?: CustomAnnotationTagDocumentation; } /** * Type declaration metadata for extension-registered custom types. * Used by host-checker-aware consumers to recognize declarations that reference * extension-provided type names. */ export interface ExtensionCustomTypeSource { /** TypeScript surface names that resolve to this type (e.g., ['Decimal']) */ readonly tsTypeNames: readonly string[]; } export interface ExtensionTagSource { readonly extensionId: string; readonly constraintTags?: readonly ExtensionConstraintTagSource[]; readonly annotations?: readonly ExtensionAnnotationTagSource[]; readonly metadataSlots?: readonly MetadataSlotRegistration[]; /** Custom types registered by this extension */ readonly customTypes?: readonly ExtensionCustomTypeSource[]; } export interface SettingsExtensionTypeRegistration { readonly extensionId: string; readonly registration: { readonly typeName: string; }; } export interface SettingsExtensionDefinition { readonly constraintTags?: readonly { readonly tagName: unknown; }[]; readonly metadataSlots?: readonly { readonly tagName: unknown; }[]; readonly annotations?: readonly { readonly annotationName: unknown; }[]; } export interface SettingsExtensionRegistry { readonly extensions?: readonly SettingsExtensionDefinition[]; readonly findTypeByName?: (typeName: string) => SettingsExtensionTypeRegistration | undefined; readonly findBuiltinConstraintBroadening?: (typeId: string, tagName: string) => object | undefined; } export declare const FORM_SPEC_PLACEMENTS: readonly ["class", "class-field", "class-method", "interface", "interface-field", "type-alias", "type-alias-field", "variable", "function", "function-parameter", "method-parameter"]; export declare const FORM_SPEC_TARGET_KINDS: readonly ["none", "path", "member", "variant"]; export declare function normalizeFormSpecTagName(rawName: string): string; export declare function getInheritableAnnotationKeys(extensions?: readonly ExtensionTagSource[]): ReadonlySet; /** * Reads the extension registry that FormSpec integrations place in settings. * * ESLint, the TypeScript plugin, and the language server all receive this value * through a weakly typed host boundary, so the shared analysis layer owns the * defensive object checks instead of each consumer casting settings locally. */ export declare function readExtensionRegistryFromSettings(settings: Readonly>): SettingsExtensionRegistry | undefined; /** * Reads every tag name registered by extensions in FormSpec settings. * * Constraint tags, metadata slots, and annotations store their names under * different property names; callers should treat them as one extension-defined * tag-name set. Malformed settings entries are ignored so host tooling never * crashes while linting partially configured projects. */ export declare function readExtensionTagNames(settings: Readonly>): ReadonlySet; export declare function getTagDefinition(rawName: string, extensions?: readonly ExtensionTagSource[]): TagDefinition | null; export declare function getConstraintTagDefinitions(extensions?: readonly ExtensionTagSource[]): readonly TagDefinition[]; export declare function getAllTagDefinitions(extensions?: readonly ExtensionTagSource[]): readonly TagDefinition[]; export declare function getTagHoverMarkdown(rawName: string, extensions?: readonly ExtensionTagSource[]): string | null; //# sourceMappingURL=tag-registry.d.ts.map