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

TemplateFactory type incompatible with setComponentTemplate type from @types/ember__component #787

Open
simonihmig opened this issue Feb 20, 2024 · 1 comment

Comments

@simonihmig
Copy link
Contributor

With ember-cli-htmlbars 6.3.0 and latest version 4.0.22 of @types/ember__component, for this type of code...

import { hbs } from 'ember-cli-htmlbars';
import { setComponentTemplate } from '@ember/component';

export const Button = setComponentTemplate(
  hbs`
    <button>{{yield}}</button>`,
  templateOnly(),
);

I am getting this type error:

Argument of type 'import("/[...]/node_modules/ember-cli-htmlbars/lib/index").TemplateFactory' is not assignable to parameter of type 'TemplateFactory'.
  Property '__htmlbars_inline_precompile_template_factory' is missing in type 'import("/[...]/node_modules/ember-cli-htmlbars/lib/index").TemplateFactory' but required in type 'TemplateFactory'.ts(2345)
index.d.ts(14, 5): '__htmlbars_inline_precompile_template_factory' is declared here.

@types/ember__component is still defining TemplateFactory like this:

interface TemplateFactory {
    __htmlbars_inline_precompile_template_factory: any;
}

But #764 removed that __htmlbars_inline_precompile_template_factory property (used as a way of type branding I guess?), so I am indeed wondering how this is supposed to work now? Maybe just working with Ember's native types?

/cc @chriskrycho

@chriskrycho
Copy link
Contributor

It should work with Ember's native types (I believe that’s part of why that change is shaped the way it is), but it may also make sense to back-port a compatibility fix to the DT types for it.

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

2 participants