Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A keyword-only modifier does not type-check when used with the modifier helper #719

Open
boris-petrov opened this issue Apr 9, 2024 · 0 comments

Comments

@boris-petrov
Copy link
Contributor

boris-petrov commented Apr 9, 2024

import { typeTest } from '@glint/type-test';
import { hbs } from 'ember-cli-htmlbars';
import { modifier } from 'ember-modifier';

interface Signature {
  Element: HTMLElement;
  Args: {
    Named: {
      block?: ScrollLogicalPosition;
    };
  };
}

typeTest(
  {
    mod: modifier<Signature>(() => {}),
  },
  hbs`
    <div {{(if true (modifier this.mod block="nearest"))}}></div>
  `,
);

There is an error on the modifier call - Property '[NamedArgs]' is missing in type 'HTMLDivElement' but required in type 'NamedArgsMarker'. Making block a mandatory parameter (i.e. removing the ?) fixes the issue and then it works. But I don't want it mandatory. 😄 Also, using (modifier this.mod (hash block="nearest")) makes it compile fine but that has a different meaning at runtime so it's also not what I want.

Somewhat similar to #86 and #627.

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

No branches or pull requests

1 participant