TypeScript - What is the correct way to type custom model methods & item methods? #1646
-
As per title. Let's say I have a model called const Foo = model<FooItem>()
Foo.methods.set('bar', function () {})
Foo.methods.item.set('baz', function() {}) What is the correct way to type const Foo = model<FooItem & { bar: () => void }>()
Foo.methods.set('bar', function () {})
Foo.methods.item.set('baz', function() {}) However, it doesn't seem possible to type What would be the correct way to approach this? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
@tranhl I don't think this case is supported currently. You either have to type cast it to PRs would be appreciated here. Or an issue documenting this feature request. |
Beta Was this translation helpful? Give feedback.
@tranhl I don't think this case is supported currently. You either have to type cast it to
any
or usets-ignore
. Dynamoose TypeScript support is currently in beta: https://dynamoosejs.com/getting_started/TypeScript.PRs would be appreciated here. Or an issue documenting this feature request.