@@ -201,6 +201,26 @@ If you are only accessing keys in an object that is only one level deep, you do
201
201
</form>
202
202
```
203
203
204
+ ### Template Tag support
205
+
206
+ For usage in [ Template Tag Format] ( https://guides.emberjs.com/release/components/template-tag-format/ ) ,
207
+ this addon provides ` changesetGet ` and ` changesetSet ` named exports:
208
+
209
+ ``` gjs
210
+ import { changesetGet, changesetSet } from 'ember-changeset';
211
+
212
+ export default <template>
213
+ <form>
214
+ <FormInput
215
+ id="first-name"
216
+ type="text"
217
+ @value={{changesetGet @changeset "person.firstName"}}
218
+ @onChange={{changesetSet @changeset "person.firstName"}}
219
+ />
220
+ </form>
221
+ </template>
222
+ ```
223
+
204
224
## Limiting which keys dirty the changeset
205
225
206
226
In order to limit the changes made to your changeset and it's associated ` isDirty ` state, you can pass in a list of ` changesetKeys ` .
@@ -226,7 +246,7 @@ let changeset = Changeset(model, validatorFn, validationMap, { skipValidate: tru
226
246
227
247
Be sure to call ` validate() ` on the ` changeset ` before saving or committing changes.
228
248
229
- ## Types
249
+ ## TypesScript
230
250
231
251
``` ts
232
252
import Component from ' @glimmer/component' ;
@@ -256,6 +276,27 @@ Other available types include the following. Please put in a PR if you need more
256
276
import type { ValidationResult , ValidatorMapFunc , ValidatorAction } from ' ember-changeset/types' ;
257
277
```
258
278
279
+ This project ships [ Glint] ( https://github.com/typed-ember/glint ) types,
280
+ which allow you when using TypeScript to get strict type checking in your templates.
281
+
282
+ Unless you are using [ strict mode] ( http://emberjs.github.io/rfcs/0496-handlebars-strict-mode.html ) templates
283
+ (via [ first class component templates] ( http://emberjs.github.io/rfcs/0779-first-class-component-templates.html ) ),
284
+ Glint needs a [ Template Registry] ( https://typed-ember.gitbook.io/glint/using-glint/ember/template-registry )
285
+ that contains entries for the template helper provided by this addon.
286
+ To add these registry entries automatically to your app, you just need to import ` ember-changeset/template-registry `
287
+ from somewhere in your app. When using Glint already, you will likely have a file like
288
+ ` types/glint.d.ts ` where you already import glint types, so just add the import there:
289
+
290
+ ``` ts
291
+ import ' @glint/environment-ember-loose' ;
292
+ import type ChangesetRegistry from ' ember-changeset/template-registry' ;
293
+ declare module ' @glint/environment-ember-loose/registry' {
294
+ export default interface Registry extends ChangesetRegistry , /* other addon registries */ {
295
+ // local entries
296
+ }
297
+ }
298
+ ```
299
+
259
300
## Alternative Changeset
260
301
261
302
Enabled in 4.1.0. Experimental and subject to changes until 5.0.
0 commit comments