YRIP_You
YRIP_You•2w ago

no I am sorry, it isn't about getting a

no I am sorry, it isn't about getting a type any but here it is : Property 'filter' does not exist on type '"" | { _id: Id<"messages">; _creationTime: number; streamId: string; chatId: Id<"chats">; role: "user" | "assistant"; content: string; isComplete: boolean; }[]'. Property 'filter' does not exist on type '""'.ts(2339)
12 Replies
Sara
Sara•2w ago
Mind sharing the query? I think it's because it can be null
YRIP_You
YRIP_YouOP•2w ago
there is a conditional return, if (!chatId && !publicChatId) return "" that is how it does start
Sara
Sara•2w ago
So either use messages?. or filter for null on your backend Yep, filter doesn't exist for strings
YRIP_You
YRIP_YouOP•2w ago
okk tysm I will handle that later maybe throwing an error
Sara
Sara•2w ago
I'd just filter for null
YRIP_You
YRIP_YouOP•2w ago
wdym?
Sara
Sara•2w ago
Oh sorry!
YRIP_You
YRIP_YouOP•2w ago
return null ?
Sara
Sara•2w ago
Are you defining them as optional? In your args If so, try keeping them as string, and add an error boundary for validation If not, return [] Empty array
YRIP_You
YRIP_YouOP•2w ago
that is right, for now I'll just return null filter function doesn't have any problem with that type
Sara
Sara•2w ago
Sweet!
YRIP_You
YRIP_YouOP•2w ago
ty 😃 !

Did you find this page helpful?