-
Hey, Prefacing this by saying not a the biggest typescript expert. Using export const foo = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<fooData, ThrowOnError>) => {
return (options?.client ?? client).post<fooResponse, fooError, ThrowOnError>({
...options,
url: '/foo'
});
}; which typescript can't infer the return type of (just gives Possible avenues:
import { createClient, createConfig, type OptionsLegacyParser, Client } from '@hey-api/client-fetch';
export const foo = <ThrowOnError extends boolean = false>(client: Client, options: OptionsLegacyParser<fooData, ThrowOnError>) => {
return client.post<fooResponse, fooError, ThrowOnError>({
...options,
url: '/a'
});
}; export const foo = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<fooData, ThrowOnError>) => {
return client.post<fooResponse, fooError, ThrowOnError>({
...options,
url: '/foo'
});
}; |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
@saska Hi, the easiest way for me to see would be to have a reproducible example in StackBlitz, but I'd also suggest turning on the experimental parser with |
Beta Was this translation helpful? Give feedback.
-
Found the issue after trying to replicate in a fresh env; the DOM defs are apparently necessary for something somewhere and were excluded in our original config. So changing {
"compilerOptions": {
...
"lib": [
"ES2022"
],
...
}
} to {
"compilerOptions": {
...
"lib": [
"ES2022",
"DOM"
],
...
}
} fixed the issue. |
Beta Was this translation helpful? Give feedback.
Found the issue after trying to replicate in a fresh env; the DOM defs are apparently necessary for something somewhere and were excluded in our original config. So changing
to
fixed the issue.