You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
QueryHelperResult doesn't accept helper with optional argument:
import{typeQueryHelperResult,createBaseTable,orchidORM}from"orchid-orm"constBaseTable=createBaseTable()classPostTableextendsBaseTable{readonlytable="post"columns=this.setColumns(t=>({id: t.identity().primaryKey(),text: t.text(),}))}constdb=orchidORM({},{post: PostTable})constselectPost=db.post.makeHelper((q,searchTerm?: string)=>q.where(q=>searchTerm ? q.whereSql`text like ${`%${searchTerm}%`}` : q),)// Type 'unknown' is not assignable to type 'string | undefined'.exporttypePost=Awaited<QueryHelperResult<typeofselectPost>>[0]
Interestingly though, this works:
constselectPost=db.post.makeHelper((q,searchTerm="")=>q.where(q=>searchTerm ? q.whereSql`text like ${`%${searchTerm}%`}` : q),)// No type errorsexporttypePost=Awaited<QueryHelperResult<typeofselectPost>>[0]
orchid-orm 1.32.13
The text was updated successfully, but these errors were encountered:
QueryHelperResult
doesn't accept helper with optional argument:Interestingly though, this works:
The text was updated successfully, but these errors were encountered: