Skip to content

Commit e53e351

Browse files
committed
Add Glint template registry for local-class helper
1 parent 54f7671 commit e53e351

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,27 @@ export default Ember.Controller.extend({
192192
});
193193
```
194194

195+
### Glint usage
196+
197+
Helper `{{local-class}}` has proper [Glint](https://github.com/typed-ember/glint) types,
198+
which allow you when using TypeScript to get strict type checking in your templates.
199+
200+
Unless you are using [strict mode](http://emberjs.github.io/rfcs/0496-handlebars-strict-mode.html) templates
201+
(via [first class component templates](http://emberjs.github.io/rfcs/0779-first-class-component-templates.html)),
202+
you need to import the addon's Glint template registry and extend your app's registry declaration
203+
as described in the [Using Addons](https://typed-ember.gitbook.io/glint/using-glint/ember/using-addons#using-glint-enabled-addons) documentation:
204+
205+
```ts
206+
import '@glint/environment-ember-loose';
207+
import type EmberCssModulesRegistry from 'ember-css-modules/template-registry';
208+
209+
declare module '@glint/environment-ember-loose/registry' {
210+
export default interface Registry extends EmberCssModulesRegistry, /* other addon registries */ {
211+
// local entries
212+
}
213+
}
214+
```
215+
195216
## Usage in Addons
196217

197218
You can also use ember-css-modules in addons that expose components to their consuming application. To do this you'll need to move `ember-css-modules` out of `devDependencies` and into `dependencies` in your addon's `package.json` ([see issue #8](https://github.com/salsify/ember-css-modules/issues/8)).
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import type { HelperLike } from '@glint/template';
2+
3+
interface Signature {
4+
Args: {
5+
Positional: [string];
6+
Named: {
7+
from?: string | undefined;
8+
};
9+
};
10+
Return: string;
11+
}
12+
13+
export default interface EmberCssModulesRegistry {
14+
'local-class': HelperLike<Signature>;
15+
}

0 commit comments

Comments
 (0)