Using Annotations to differentiate origin of transaction

Could I see a simple example of how to create an annotation and add it to a change?
Thanks.

Something like this should work…

const myAnnotation = Annotation.define<string>()

view.dispatch({
  change: {from: 0, insert: "hi"},
  annotations: myAnnotation.of("greeting")
})

Brilliant. Thanks

I can get it to work with

const myAnnotation = Annotation.define<string>()

view.dispatch({
  changes: [{from: 0, insert: "hi"}],
  annotations: myAnnotation.of("greeting")
})

I needed an array of changes rather than a single change.

Oh, right, my bad. changes: {...} should work too, but change is nonsense there.