-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
Need help with typescript typings #6
Comments
Hey @skjnldsv! Hmm, that's weird, it seems to work for me: Is your typescript version up to date? |
typescript 4 or 5, both are stating the same :) |
I wonder if your IDE is using some other version of typescript? Can you build with such a change? That should show if the version installed as a dependency is correct or not.. EDIT: It shouldn't I don't think, as you're using vscode.. |
(wrong click) Weirdly, I can build, but I don't know what tool the (vs)code extension is using, i'll investigate. |
Let's close, can't find anything 🤷 |
Actually, jest complains too 😁 apps/files/src/services/WebdavClient.ts:45:27 - error TS2345: Argument of type '(options: RequestOptions) => Promise<Response>' is not assignable to parameter of type 'PatchFn<Promise<Response>>'.
Types of parameters 'options' and 'args' are incompatible.
Type 'unknown' is not assignable to type 'RequestOptions'.
45 patcher.patch('request', (options: RequestOptions): Promise<Response> => {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
This will now work as the patch function is declared as patch<T>(key: string, method: PatchFn<T>, opts?: PatchOptions): this;
//...
export type PatchFn<T> = (...args: Array<unknown>) => T; So when passing The correct type would be
|
Hey @perry-mitchell
I'm patching the request method of your webdav lib, and typescript is complaining.
Do you have any tips on how to comply to this? I think this is an issue or misunderstanding from my part on the
PatchFn
type :)The text was updated successfully, but these errors were encountered: