Closed crookedneighbor closed 2 weeks ago
Oh, interesting! I think the never
here is an important hint:
does not exist in type 'Partial<ComponentConstructorOptions<never>>'
render
is generic on the component, which is showing up as never
in that error. You need to make sure that your setup
function is also generic:
export function setup<C>(
component: Parameters<typeof render<C>>[0],
renderOptions: Parameters<typeof render<C>>[1] = {},
additionalOptions?: {
userEventOptions?: Options;
}
) {
// ...
}
Awesome, yep, that works perfectly!
Hey there, this is probably user error, but I'm confused about it.
I've created a simple wrapper function around render that sets up a user and returns it, along with all the props that
render
returns. It looks like this:And it works, great! Except, VS Code complains about it.
So when calling render, it accurately interprets the prop types:
But if I use my helper function, it can't interpret the props correctly:
Am I missing something obvious? I thought that if I set the params to be exactly the same, it should be able to infer the types correctly, but maybe there's some TS magic I'm missing?