MattIPv4
ZZod
•Created by MattIPv4 on 4/14/2025 in #questions
MattIPv4 - :WaveDoggo: I think this might be a ...
So I wasn't far off with what I had before manually setting the type for just the src, just needed to set the type manually for the entire schema
26 replies
ZZod
•Created by MattIPv4 on 4/14/2025 in #questions
MattIPv4 - :WaveDoggo: I think this might be a ...
Ahah!
Results in:
26 replies
ZZod
•Created by MattIPv4 on 4/14/2025 in #questions
MattIPv4 - :WaveDoggo: I think this might be a ...
But really, it could be anything, hence wanting to have this use those
import()
s correctly so that it'll just use whatever type the user of the library has setup in their module augmentations26 replies
ZZod
•Created by MattIPv4 on 4/14/2025 in #questions
MattIPv4 - :WaveDoggo: I think this might be a ...
One of our usages uses plain Webpack and returns a string for the file path, the other is Next.js which'll return an object with the file path, width, height, etc.
26 replies
ZZod
•Created by MattIPv4 on 4/14/2025 in #questions
MattIPv4 - :WaveDoggo: I think this might be a ...
What that bundler is and what it returns for those imports is up to the user of this library
26 replies
ZZod
•Created by MattIPv4 on 4/14/2025 in #questions
MattIPv4 - :WaveDoggo: I think this might be a ...
And so a bundler of some type is going to process them
26 replies
ZZod
•Created by MattIPv4 on 4/14/2025 in #questions
MattIPv4 - :WaveDoggo: I think this might be a ...
They are images being imported
26 replies
ZZod
•Created by MattIPv4 on 4/14/2025 in #questions
MattIPv4 - :WaveDoggo: I think this might be a ...
These aren't JSON, I'm not sure where JSON comes into this at all?
26 replies
ZZod
•Created by MattIPv4 on 4/14/2025 in #questions
MattIPv4 - :WaveDoggo: I think this might be a ...
Fwiw, the workaround is just to do
z.infer<typeof ambassadorImageSchema> & { src: ImageImport };
, but I'd really rather z.infer
just work correctly26 replies
ZZod
•Created by MattIPv4 on 4/14/2025 in #questions
MattIPv4 - :WaveDoggo: I think this might be a ...
Writing custom CI/CD to implement my own version of type-checking sounds like an incredibly complex solution, unless I'm not following
26 replies
ZZod
•Created by MattIPv4 on 4/14/2025 in #questions
MattIPv4 - :WaveDoggo: I think this might be a ...
The objects are a known type we set via module augmentation
26 replies
ZZod
•Created by MattIPv4 on 4/14/2025 in #questions
MattIPv4 - :WaveDoggo: I think this might be a ...
Hence wanting the type to propagate through from the imports correctly, so the end type is correct where we're using it
26 replies
ZZod
•Created by MattIPv4 on 4/14/2025 in #questions
MattIPv4 - :WaveDoggo: I think this might be a ...
For one of our usages they'll be URLs, for the other they'll be objects
26 replies
ZZod
•Created by MattIPv4 on 4/14/2025 in #questions
MattIPv4 - :WaveDoggo: I think this might be a ...
Yah, the schema works, but if you try to z.infer from it, it doesn't work (updated my example link as I'd pasted one w/o the infer)
26 replies
ZZod
•Created by MattIPv4 on 4/14/2025 in #questions
MattIPv4 - :WaveDoggo: I think this might be a ...
26 replies