Skip to content

Conversation

JohannesMeierSE
Copy link
Collaborator

@JohannesMeierSE JohannesMeierSE commented Sep 4, 2025

This PR increases the TypeScript type-safety and can be seen as a follow-up of #90

  • The TypirSpecifics now contain the property LanguageKeys: Record<string, unknown>; to make language keys explicit. This is the precondition for the following improvements:
  • make properties which are using language keys type-safe
  • exploit Specifics['LanguageKeys'] to simplify inference rules for functions and operators: Now it is possible to skip the TypeScript type when using only languageKey and no filter. @Lotes You sketched this idea some time ago and now we have everything to make your idea happen 🙂

Contributions of this PR which are not related to language keys:

  • languageProperty supports only valid property names of the given languageNode
  • wrote some more documentation

Open issues:

  • Since we have Specifics['LanguageKeys'] now even in Typir (core), we could support the features addValidationRulesForAstNodes and addInferenceRulesForAstNodes (which are Typir-Langium only so far) also in Typir (core): I would prefer that (but did not implement that yet), what do you think?
  • In typir.ts, there are two open issues/improvements marked with // possible extension, for which I found no solution so far

I recommend to review this PR commit by commit.

@JohannesMeierSE JohannesMeierSE added this to the v0.4 milestone Sep 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant