-
Notifications
You must be signed in to change notification settings - Fork 23
Add Glint support #102
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
Add Glint support #102
Conversation
README.md
Outdated
|
|
||
| ```ts | ||
| import '@glint/environment-ember-loose'; | ||
| import type EmberElementHelperRegistry from 'ember-css-modules/template-registry'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| import type EmberElementHelperRegistry from 'ember-css-modules/template-registry'; | |
| import type EmberElementHelperRegistry from 'ember-element-helper/template-registry'; |
package.json
Outdated
| "concurrently": "^7.2.2" | ||
| }, | ||
| "peerDependencies": { | ||
| "@glint/template": "1.0.0-beta.3" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| "@glint/template": "1.0.0-beta.3" | |
| "@glint/template": "^1.0.0-beta.3" |
| @@ -0,0 +1,11 @@ | |||
| import Helper from '@ember/component/helper'; | |||
| import type { ComponentReturn } from '@glint/template/-private/integration'; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Relying on private types for this is (a) dangerous, but (b) fortunately unnecessary 🙂
You can do this with public API and actually get the correct typing for it as well by defining the signature as something like:
export interface ElementHelperSignature<T extends string> {
Args: {
Positional: [name: T];
};
Return: ComponentLike<{
Element:
T extends keyof HTMLElementTagNameMap
? HTMLElementTagNameMap[T]
: Element;
Blocks: { default: [] };
}>;
}
export default class ElementHelper<T extends string> extends Helper<ElementHelperSignature<T>> {}|
@danieljust thank you so much for your work! it was pulled in to #107 and we got it merged -- than kyou!! |
This PR adds Glint support for element helper, so consumers will be able to
and {{element}} won't throw errors in hbs templates.