Search
Get Started
TTC
Theo's Typesafe Cult
•
4y ago
GarbanzoBeans
error when using a query
Type
'
{ name
: string
;
}
' is not assignable to type
'null
| undefined
'
.
Theo's Typesafe Cult
Join
26,249
Members
View on Discord
Was this page helpful?
Yes
No
G
GarbanzoBeans
OP
•
11/15/22, 6:08 AM
query works fine
, just getting a type error here and I cant figure out why
. I made a carbon copy of another route
, modified the names
P
Piotrek
•
11/15/22, 6:31 AM
You have to use it outside of the array
P
Piotrek
•
11/15/22, 6:31 AM
P
Piotrek
•
11/15/22, 6:32 AM
The first argument is telling rq what to fetch
(array of keys
)
P
Piotrek
•
11/15/22, 6:32 AM
Then the second one is the one you need
- query params
P
Piotrek
`.useQuery(["supabase.get-user-settings"], { name: "test" });`
G
GarbanzoBeans
OP
•
11/15/22, 7:33 AM
tried this
, got this
:
Argument of type
'
{ name
: string
;
}
' is not assignable to parameter of type
'UseTRPCQueryOptions
<
"supabase
.get
-user
-settings
"
, unknown
, any
, any
, TRPCClientErrorLike
<Router
<
{
}
, unknown
,
{
}
,
P
Piotrek
•
11/15/22, 8:24 PM
Sorry for being inactive
, did not have much time today
P
Piotrek
•
11/15/22, 8:25 PM
It
's hard for me to tell exactly what
's wrong
, but I would suggest checking your code with docs
P
Piotrek
•
11/15/22, 8:26 PM
I think I could actually be wrong about the usage haha
, mixed up V10 and v9
P
Piotrek
•
11/15/22, 8:27 PM
I would probably just restart Vs code and use the code you had previously
.useQuery(["supabase.get-user-settings"], { name: "test" });
.useQuery(["supabase.get-user-settings"], { name: "test" });