-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
error TS4058 caused by RawSymbol #7048
Comments
You can turn off |
Hey there! 👋🏻 This was fixed in
|
@RomainLanz Could you please provide a minimum reproduction repo? |
Sure, it happens when using a "complex" typing from async function fetchFoo() {
return markRaw({ foo: 'bar' });
}
export function useFoo(options?: UseQueryOptions<Awaited<ReturnType<typeof fetchFoo>>>) {
return useQuery({
queryKey: ['foo'],
queryFn: fetchFoo,
...options
})
} Without using I created a Stackblitz here: https://stackblitz.com/edit/vitejs-vite-zwx4la?file=src%2Fuse-foo.ts |
It seems to be an issue with TypeScript, maybe. Bulit-in Try this one: +++ type Awaited<T> = T extends PromiseLike<infer U> ? U : T
export function useFoo(
options?: UseQueryOptions<Awaited<Raw<{ foo: string }>>>
) {
return useQuery({
queryKey: ['foo'],
queryFn: fetchFoo,
...options
})
} |
Yes, it does fix it! |
So, are we supposed to copy-paste this code everywhere? I don't really like this solution |
@klausXR |
Vue version
3.2.41
Link to minimal reproduction
https://stackblitz.com/edit/vitejs-vite-f88icu?file=src/use-foo.ts
Steps to reproduce
Note: Similar to #2548
@vue/tsconfig
configmarkRaw
What is expected?
TypeScript should be happy
What is actually happening?
TypeScript raises an error.
System Info
No response
Any additional comments?
No response
The text was updated successfully, but these errors were encountered: