Interface LangiumTypeSystemDefinition<Specifics>

This service provides the API to define the actual types, inference rules and validation rules for a textual DSL developed with Langium.

interface LangiumTypeSystemDefinition<Specifics extends TypirLangiumSpecifics> {
    onInitialize(typir: TypirLangiumServices<Specifics>): void;
    onNewAstNode(
        languageNode: Specifics["LanguageType"],
        typir: TypirLangiumServices<Specifics>,
    ): void;
}

Type Parameters

Methods

  • React on updates of the AST in order to add/remove corresponding types from the type system, e.g. for user-defined functions to create corresponding function types in the type graph. Note that Langium does no incremental parsing, but skips the whole AST for an updated document and creates a completely new AST. Therefore, only new AstNodes need to be considered, since types created for removed AstNodes are automatically removed from the type system.

    Parameters

    • languageNode: Specifics["LanguageType"]

      an AstNode of the current AST, as this method is called for each

    • typir: TypirLangiumServices<Specifics>

      the current Typir services, just for convenience, these services are the same as for 'onInitialize'

    Returns void