Skip to content

Generic types with HelperLike聽#540

Closed

Description

@swastik

Thanks for your work on this! 馃槃 I'm trying to type some external addons that provide helpers. For example:

import { HelperLike } from '@glint/template';

declare module '@glint/environment-ember-loose/registry' {
  export default interface Registry {
    or: HelperLike<{
      Args: { Positional: [any, any] };
      Return: any;
    }>;
  }
}

The helper can be invoked like this and it returns either of the two arguments (for example):

{{#let (or a b) as |foo|}}
  {{foo}}
{{/let}}

However, this seems like it will return an incorrect type: any. Is there a way to type these correctly? Thanks for any help!

Activity

  1. locked and limited conversation to collaborators on Mar 14, 2023
  2. converted this issue into a discussion #542 on Mar 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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