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

transform with nullish, nullable incorrectly infers #195

Closed
husseyexplores opened this issue Oct 3, 2023 · 3 comments
Closed

transform with nullish, nullable incorrectly infers #195

husseyexplores opened this issue Oct 3, 2023 · 3 comments
Assignees
Labels
bug Something isn't working priority This has priority

Comments

@husseyexplores
Copy link

transform does not infer type correctly when combined with nullish.

const Thing = transform(nullish(object({ id: string() })), x => {
    return 2 as number
})
type Thing = Output<typeof Thing>

The inferred type should be number. But we get { id: string }.
Removing nullish results in correct types.

This is also the case with nullable as well.

Live examples: https://www.typescriptlang.org/play?#code/JYWwDg9gTgLgBAbwFBzhARgKwKYGMYA0KcAdgK4jrZRGoDOMUwJA5rXIwIYl0Bm0IduQA2w4HQAW7GAE8w2OAHkyMMCvacoUTjKIBfOLygQQcAOQA3TmPQQYZpElCRYiOAC84BoyfPuIACYOSLgQPPAAKhLMLHAAvBzaPPxQIAAUImKSaRg4+GkIcMABAFxwDEysaQCUXtXVBHAAHvEAfIjEqFDYMGRQJHAATHCcdKQUVFBIetVIsvJwUTHxSipqMAA889gQvIvRrK2dcAD0JwB6APyOZ3AAjAB0cADuwDAScAAGmeISn0i3bBNeT4bClL4VGIAbQAup82nA0gAxACCAEkADKzULhOAorQ6ADKjBiaJIoS0eHgCS4yQEGTIol+aUhVXqjRacXayFQqGAezSAEImrVur1+nBYSMxvjtDINqyWEdeXAxX0Bk0HnQwGIYGkzI0zLMZnM5ApZUSSawyRTuvgVspVCotmbdniCTJiZUWDboHaYMqVbcro4ASchk9Xu8ICovj9JP9bgBhRQAJVTAFEkxE4ABaOBAkEwMFlT6K2HwrmIgAKKMJhOxYQY7rlXpiSb9VJWtL49MVNQ5CJ5vP5iOFop66slMOlLZ0CqtSuOaolmu1uv1huNs22c89i47lPtCUd6xd8jdFv33sP-sDqGD1xu4YAzJG3h9voysn8wwXgVSJZxhM1CVu0yLoliIRNvAKIkHYEjUL6R7Uok3C9qkDJMtkuRUgURTgv21QzA0zRDsuk4SsMozjJQ1DTDuZp4vB7xIeSnbHqsTqbNsl4sYhUDIXexynOGIbPnAAAs77RrGX7Yb+gIAaC4JloucAAD7lIuFYImktb1o2uIosIdAQLeXY0kkGHpERg5VsOfICuOqqUQMUo0VeC7evernihqDGmgsJlmRZnGns6vF7CF5kcQGnSPqGty5ilqVpelGWZVlKWODizYAFqBBmTScOAwgKAk7haouNQPPGEi1T2KTpJy3LHKOQoin5U4eWM5YwhR-nNFqOpvJu5jbkFCiFQExWlTqFUeA8zC8NQ547HsM1zWV2BHEAA

@fabian-hiller
Copy link
Owner

Thank you! I will fix that with the next version.

@fabian-hiller fabian-hiller self-assigned this Oct 4, 2023
@fabian-hiller fabian-hiller added bug Something isn't working priority This has priority labels Oct 4, 2023
@fabian-hiller
Copy link
Owner

Will be fixed with the next version! Thanks again!

@fabian-hiller
Copy link
Owner

Fixed in v0.19.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority This has priority
Projects
None yet
Development

No branches or pull requests

2 participants