Interface InferClassFieldAccess<Specifics, T>

An inference rule which is dedicated for inferrring a certain type. This utility type is often used for inference rules which are annotated to the declaration of a type. At least one of the properties needs to be specified.

interface InferClassFieldAccess<
    Specifics extends TypirSpecifics,
    T extends Specifics["LanguageType"] = Specifics["LanguageType"],
> {
    field: (languageNode: T) => string | Specifics;
    filter?: (languageNode: Specifics["LanguageType"]) => languageNode is T;
    languageKey?: string | string[];
    matching?: (languageNode: T, typeToInfer: ClassType) => boolean;
    skipThisRuleIfThisTypeAlreadyExists?:
        | boolean
        | (existingType: ClassType) => boolean;
    validation?:
        | InferCurrentTypeValidationRule<ClassType, Specifics, T>
        | InferCurrentTypeValidationRule<ClassType, Specifics, T>[];
}

Type Parameters

Hierarchy (View Summary)

Properties

field: (languageNode: T) => string | Specifics
filter?: (languageNode: Specifics["LanguageType"]) => languageNode is T
languageKey?: string | string[]
matching?: (languageNode: T, typeToInfer: ClassType) => boolean
skipThisRuleIfThisTypeAlreadyExists?:
    | boolean
    | (existingType: ClassType) => boolean

This validation will be applied to all language nodes for which the current type is inferred according to this inference rule. This validation is specific for this inference rule and this inferred type.