Skip to content

Addon .gts Components Cannot Use Modifiers: "...does not appear to be usable as a component/modifier/helper" #774

Description

@kdagnan

I get this type error from Glint when trying to use an ember-modifier in a .gts component in my addon:

The given value does not appear to be usable as a component, modifier or helper.
  No overload matches this call.
    Overload 1 of 3, '(item: DirectInvokable): AnyFunction', gave the following error.
      Argument of type 'FunctionBasedModifier<{ Args: { Positional: [string]; Named: EmptyObject; }; Element: Element; }>' is not assignable to parameter of type 'DirectInvokable'.
    Overload 2 of 3, '(item: (abstract new () => InvokableInstance) | null | undefined): (...args: any) => any', gave the following error.
      Argument of type 'FunctionBasedModifier<{ Args: { Positional: [string]; Named: EmptyObject; }; Element: Element; }>' is not assignable to parameter of type 'abstract new () => InvokableInstance'.
        Property '[Invoke]' is missing in type 'FunctionBasedModifierInstance<{ Args: { Positional: [string]; Named: EmptyObject; }; Element: Element; }>' but required in type 'InvokableInstance'.
    Overload 3 of 3, '(item: ((...params: any) => any) | null | undefined): (...params: any) => any', gave the following error.
      Argument of type 'FunctionBasedModifier<{ Args: { Positional: [string]; Named: EmptyObject; }; Element: Element; }>' is not assignable to parameter of type '(...params: any) => any'.
        Type 'FunctionBasedModifier<{ Args: { Positional: [string]; Named: EmptyObject; }; Element: Element; }>' provides no match for the signature '(...params: any): any'.glint(2769)

I have created a minimal reproduction here:
https://github.com/kdagnan/glint-gts-modifier-issue/blob/main/addon/src/components/broken-example.gts

I have also tried updating to ember-source@5.12 and using built-in types instead of the DT types. I cannot for the life of me figure out the issue. I have a new app that is working fine, I cannot figure out the issue for this addon.

Activity

  1. NullVoxPopuli commented on Oct 28, 2024

    @NullVoxPopuli
    Contributor

    Looks like the repo wants node 16?

    Node 18 is probably the oldest LTS that you could use -- npm v10 reports a ton of EBADENGINE errors with Node 16.

    I had issues recovering, so I deleted the lockfile.

    But then I see there are other dependency errors

    npm error code ERESOLVE
    npm error ERESOLVE unable to resolve dependency tree
    npm error
    npm error While resolving: blocks-components@1.10.0-SNAPSHOT.0
    npm error Found: @typescript-eslint/parser@6.21.0
    npm error node_modules/@typescript-eslint/parser
    npm error   dev @typescript-eslint/parser@"^6.20.0" from blocks-components@1.10.0-SNAPSHOT.0
    npm error   addon
    npm error     blocks-components@1.10.0-SNAPSHOT.0
    npm error     node_modules/blocks-components
    npm error       workspace addon from the root project
    npm error
    npm error Could not resolve dependency:
    npm error peer @typescript-eslint/parser@"^5.0.0" from @typescript-eslint/eslint-plugin@5.62.0
    npm error node_modules/@typescript-eslint/eslint-plugin
    npm error   dev @typescript-eslint/eslint-plugin@"^5.59.8" from blocks-components@1.10.0-SNAPSHOT.0
    npm error   addon
    npm error     blocks-components@1.10.0-SNAPSHOT.0
    npm error     node_modules/blocks-components
    npm error       workspace addon from the root project
    npm error
    npm error Fix the upstream dependency conflict, or retry
    npm error this command with --force or --legacy-peer-deps
    npm error to accept an incorrect (and potentially broken) dependency resolution.
    npm error
    npm error
    

    Can you provide a minimal reproduction free from engines / dependency problems?

    Thanks!


    Additional things I noticed:

    I noticed also that your root package.json doesn't have @glint/core or typescript. If you use VSCode, you'll need both of those packages in the root package.json.

    So I tried with pnpm, and found that things work as expected:
    image

  2. kdagnan commented on Oct 28, 2024

    @kdagnan
    Author

    Updated repo to address dependency issues and require Node 18.

    You're right though, using pnpm i, it works as expected?? We're not ready to move to pnpm right now...any ideas what could be causing this ?

  3. NullVoxPopuli commented on Oct 28, 2024

    @NullVoxPopuli
    Contributor

    what npm version are you using?

  4. kdagnan commented on Oct 28, 2024

    @kdagnan
    Author

    I was able to get this resolved after a lot of trial and error in dependencies. Updating "@typescript-eslint/eslint-plugin",
    "@typescript-eslint/parser", and "ember-eslint-parser" to latest versions worked.

    Thank you for your help

  5. NullVoxPopuli commented on Oct 28, 2024

    @NullVoxPopuli
    Contributor

    Some tools that may be able to help in the future:

    • npx dep-hellp
      • a fork of npx are-my-node-modules-messed-up
  6. johanrd commented on Apr 11, 2025

    @johanrd
    Contributor

    I got the same error with glint 1.4.1-unstable.6e222ff with when used with ember-headless-table modifiers:

    app/components/activity-report.gts:834:18 - error TS2769: No overload matches this call.
      Overload 1 of 3, '(item: DirectInvokable): AnyFunction', gave the following error.
        Argument of type 'FunctionBasedModifier<{ Args: { Named: Record<string, unknown>; Positional: unknown[]; }; Element: HTMLElement; }>' is not assignable to parameter of type 'DirectInvokable'.
      Overload 2 of 3, '(item: (abstract new () => InvokableInstance) | null | undefined): (...args: any[]) => any', gave the following error.
        Argument of type 'FunctionBasedModifier<{ Args: { Named: Record<string, unknown>; Positional: unknown[]; }; Element: HTMLElement; }>' is not assignable to parameter of type 'abstract new () => InvokableInstance'.
          Property '[Invoke]' is missing in type 'FunctionBasedModifierInstance<{ Args: { Named: Record<string, unknown>; Positional: unknown[]; }; Element: HTMLElement; }>' but required in type 'InvokableInstance'.
      Overload 3 of 3, '(item: ((...params: any) => any) | null | undefined): (...params: any) => any', gave the following error.
        Argument of type 'FunctionBasedModifier<{ Args: { Named: Record<string, unknown>; Positional: unknown[]; }; Element: HTMLElement; }>' is not assignable to parameter of type '(...params: any) => any'.
          Type 'FunctionBasedModifier<{ Args: { Named: Record<string, unknown>; Positional: unknown[]; }; Element: HTMLElement; }>' provides no match for the signature '(...params: any): any'.
    
    234         <table {{this.table.modifiers.container}} class='table-fixed w-fit min-w-full'>
                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
      node_modules/.pnpm/@glint+template@1.4.1-unstable.6e222ff/node_modules/@glint/template/-private/integration.d.ts:22:72
        22 export type InvokableInstance<T extends AnyFunction = AnyFunction> = { [Invoke]: T };
                                                                                  ~~~~~~~~
        '[Invoke]' is declared here.
    
    app/components/activity-report.gts:839:21 - error TS2769: No overload matches this call.
      Overload 1 of 3, '(item: DirectInvokable): AnyFunction', gave the following error.
        Argument of type 'FunctionBasedModifier<{ Args: { Named: Record<string, unknown>; Positional: [Column<NodeEdge>]; }; Element: HTMLElement; }>' is not assignable to parameter of type 'DirectInvokable'.
      Overload 2 of 3, '(item: (abstract new () => InvokableInstance) | null | undefined): (...args: any[]) => any', gave the following error.
        Argument of type 'FunctionBasedModifier<{ Args: { Named: Record<string, unknown>; Positional: [Column<NodeEdge>]; }; Element: HTMLElement; }>' is not assignable to parameter of type 'abstract new () => InvokableInstance'.
          Property '[Invoke]' is missing in type 'FunctionBasedModifierInstance<{ Args: { Named: Record<string, unknown>; Positional: [Column<NodeEdge>]; }; Element: HTMLElement; }>' but required in type 'InvokableInstance'.
      Overload 3 of 3, '(item: ((...params: any) => any) | null | undefined): (...params: any) => any', gave the following error.
        Argument of type 'FunctionBasedModifier<{ Args: { Named: Record<string, unknown>; Positional: [Column<NodeEdge>]; }; Element: HTMLElement; }>' is not assignable to parameter of type '(...params: any) => any'.
          Type 'FunctionBasedModifier<{ Args: { Named: Record<string, unknown>; Positional: [Column<NodeEdge>]; }; Element: HTMLElement; }>' provides no match for the signature '(...params: any): any'.
    
    239                   {{this.table.modifiers.columnHeader column}}

    npx dephellp did not return any relevant conflicts.

    Neither did this help, as I don't have any of these packages:

    updating "@typescript-eslint/eslint-plugin", "@typescript-eslint/parser", and "ember-eslint-parser" to latest

    However, overriding ember-headless-table's ember-modifier did the trick:

    "overrides": {
          "ember-modifier": "^4.2.0"
        }
    

    See CrowdStrike/ember-headless-table#290

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