Closed shtse8 closed 2 years ago
/cc @danielroe
defu
already accepts partials of the desired type. I think the issue in your case is due to the untyped {}
you are passing as the first argument, and I think you can resolve in your own project with:
+ // for readability
+ type Options = UploadOptions<typeof this.storages> & UrlUploadOptions
- const opts = defu(options ?? {}, this.defaultUploadOptions, this.defaultUrlUploadOptions)
+ const opts = defu(options ?? {} as Partial<Options>, this.defaultUploadOptions, this.defaultUrlUploadOptions)
Let me know if I've misunderstood what you are asking for.
Type Error:
It's because of the type
Could we change it to
Partial<Defaults>
?Currently I can merge two defaults into one to apply.
but, it needs merging before applying. or call
defu
twice... sounds stupid.