Closed serafimsanvol closed 11 months ago
The type definitions should already be exported, see: https://github.com/kleisauke/wasm-vips/blob/41594f2b3d10dc78770a3c2742bab6e26bf16af0/lib/vips.d.ts#L9834
I was able to use your example without any issues. Perhaps Yup validators won't work on abstract base classes? If so, this patch would probably fix that:
--- a/src/app/useVips.tsx
+++ b/src/app/useVips.tsx
@@ -30,8 +30,8 @@ export const useVips = () => {
return () => {
if (!vips) return;
- type ImageAutoGen = VipsWASM.ImageAutoGen;
- type webpsaveBufferType = ImageAutoGen['webpsaveBuffer'];
+ type Image = VipsWASM.Image;
+ type webpsaveBufferType = Image['webpsaveBuffer'];
type webpsaveBufferParams = Parameters<webpsaveBufferType>;
type webpsaveBufferOptions = webpsaveBufferParams[0];
const object: webpsaveBufferOptions = {};
@serafimsanvol Were you able to make any progress with this?
Closing due to inactivity. Please feel free to re-open if there's still a problem.
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch
wasm-vips@0.0.5
for the project I'm working on.I wanted to use types from .*saveBuffer functions to generate yup validators, but it wasn't possible because exports don't exist. So I added some improvements for types
example of usage:
Here is the diff that solved my problem:
This issue body was partially generated by patch-package.
I understand that I shoud've probably updated this - https://github.com/kleisauke/wasm-vips/blob/master/build/gen_type_declarations.py, but i'm not fluent enough in python to do it currently. Thanks