Closed code3z closed 2 years ago
for some more context, here's my actual usecase
type index = {
'#': {
[key: string]: string
}
}
interface Indexes {
users: index
}
interface AppState {
// indexes under the `dataset`
[key: string]: Indexes
}
gun.get('dataset').get('users').get('#').map().put('hi')
put('hi') throws Argument of type 'string' is not assignable to parameter of type 'Partial<{ [x: string]: string; }>'.ts(2345)
@code3z check against github main
. If fails, ping @Orimay .
put
expects object with key/value pairs. This hasn't changed since previous Gun TS implementation
Edit: might be solved in next version
In the current typescript API, there does not seem to be a way to use map().
If I have a type like this:
And I use it like this:
The typescript thing will ignore the map() and consider 'something' to be directly under map and throw an error.