Skip to content
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

fix(library): correct type inference in ArgsAction #976

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

shulaoda
Copy link

@shulaoda shulaoda commented Dec 12, 2024

Actually, I found that type Output = v.InferOutput<typeof ComplexSchema> will be deduced as:

type Output = {
    fn: (args_0: string) => boolean;
    argsWithFn: (args_0: (...args: unknown[]) => unknown) => unknown;
}

Is this the expected behavior? Is there a problem with my writing for the args_0 of the argsWithFn?

Originally posted by @shulaoda in #968 (comment)

The second generic of BaseTransformation should be InferOutput<...>.

Playground: https://valibot.dev/playground/?code=JYWwDg9gTgLgBAKjgQwM5wG5wGZQiOAcg2QBtgAjCGQgbgCh6BjCAO1XgGF8xSBTAB4BlJgAs+IZHAC8mAHQcowJjADyFAFZ8VACgDe9ODlYAueWGBg+Ow0fnYArqxXA2OgJQAaW0YxzkUADmqDp+MA681gDaforArIEeALruXj7yUHzhUOyhclQQ-MisHmlGZShBqADqwDCiAGKm5pbW6X6OzjCuJRW+-lU2dnZhEfw6UenDfhZWQ8MLHU4ubn0L-QHBeeGRE34FRb0pa+t+mdm5sTBKCaXe6+X3CylPj+1y5w45IVc3ialPNIAX3cDHoMAAnlY4KoHDAwHCZPIAJKsbB8KCw+FwgA8kKsEGwcG44H4wjEEmQAD4wSx2PAIHCETAzFjmUiDEZsM0dJszHEEu4ZFS4Ho4J8cnB8XxCZVAjJpLJCALAoQ4ECnpsanVGjzuWZeUEzAc+MUhdIRSrzSKxRLWMYdNgyKg+EKgfR3cw2KhCnw5KQIIlGdiYO56EA

@fabian-hiller
Copy link
Owner

I think there was a reason why I choose InferInput. I will investigate it to check if it is a bug and report back to you. Thank you!

@fabian-hiller fabian-hiller self-assigned this Dec 12, 2024
@fabian-hiller fabian-hiller added question Further information is requested priority This has priority labels Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority This has priority question Further information is requested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants