-
Notifications
You must be signed in to change notification settings - Fork 124
Open
Description
- I've validated the bug against the latest version of DB packages
Describe the bug
The collection.utils received in onInsert, onUpdate and onDelete of electricCollectionOptions is typed as UtilsRecord rather than ElectricCollectionUtils<T>. This makes it unsafe to call awaitTxId and awaitMatch.
To Reproduce
const todosCollection = createCollection(
electricCollectionOptions({
id: 'todos',
getKey: (item) => item.id,
shapeOptions: {
url: '/api/todos',
params: { table: 'todos' },
},
onInsert: async ({ collection }) => {
// ❌ This is typed as UtilsRecord instead of ElectricCollectionUtils<T>
collection.utils;
},
}),
);
// ✅ This is typed as ElectricCollectionUtils<T>
todosCollection.utils;Expected behavior
I expect mutation functions in electricCollectionOptions to receive collection utils typed as ElectricCollectionUtils<T>.
kevin-dp
Metadata
Metadata
Assignees
Labels
No labels