-
-
Notifications
You must be signed in to change notification settings - Fork 793
Open
Milestone
Description
Steps to reproduce
In a fresh copy of feathers-chat, paste the following snippet at the end of the app.ts file:
(async () => {
const query: any = {
text: 'foo'
}
const messages = await app.service('messages').find({
query,
paginate: false
})
messages.forEach(() => {})
})Expected behavior
There should be no Typescript errors.
Actual behavior
Property 'forEach' does not exist on type 'Paginated<{ id: number; user: { password?: string | undefined; githubId?: number | undefined; avatar?: string | undefined; id: number; email: string; }; text: string; createdAt: number; userId: number; }>'.
Workaround
Using explicit type assertion on query props resolves the errors:
(async () => {
const query: any = {
text: 'foo'
}
const messages = await app.service('messages').find({
query: {
text: query.text as string
},
paginate: false
})
messages.forEach(() => {})
})Possibly related to #3012 as I think both issues suffer from the way HookContext interprets the current Service<Params>.
System configuration
Module versions: v5
NodeJS version: 16,18
Operating System: linux
Browser Version: -
React Native Version: -
Module Loader: es6
wshart and AshotN
Metadata
Metadata
Assignees
Labels
No labels