Skip to content

Public API support disparity with Glint and typed templates with custom managers -- currently no story for TS support (for now?) #822

@NullVoxPopuli

Description

@NullVoxPopuli

Today, support for helpers, components, modifiers, etc is all hard-coded in Glint.

For folks wanting to use glint, and have their custom-manager implementations support TS, there is no path here.

I think we should figure out a path for managers to provide the types to Glint, based on the type of thing received in the template -- since
aside from raw-values, everything involves a manger -- components, helpers, modifiers, etc.

For example,
all of these use custom managers and have no way to utilize typed templates (would currently show unresolveable errors to consumers of these addons):

(as a disclaimer, I used github's search, and picked out a few things -- idk how used these things are -- but it looks like many are used by sizable companies)

Atm, @glimmer/component, specifically has ExpandSignature: https://github.com/typed-ember/glint/blob/0e31e49301776d552429892d5749ecbf88f68d00/packages/template/-private/index.d.ts

RFC here: #748

So (atm), I'm kinda thinking we need some sort of "ExpandSignature" type thing per syntax, rather than per implementation.
So, right now we have a ExpandSignature for the glimmer/component -- but what about all the other components? Or how does Expanding the signature of a helper or modifier work? we know what these are statically as they're all matched on prototype, so I can imagine "something" like:

interface HelperManagerLookup {
  [SomeHelperPrototype]: SignaturueForThisHelper,
  [EmberHelperProtoype]: EmberHelperSignature,
}

(and similar for modifiers, components, and maybe eventually services, too? idk)

Relevant discussion in Discord: https://discord.com/channels/480462759797063690/814921339219476571/980229057931276308

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions