We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
nullish, nullable
transform does not infer type correctly when combined with nullish.
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.
number
{ id: string }
This is also the case with nullable as well.
nullable
Live examples: https://www.typescriptlang.org/play?#code/JYWwDg9gTgLgBAbwFBzhARgKwKYGMYA0KcAdgK4jrZRGoDOMUwJA5rXIwIYl0Bm0IduQA2w4HQAW7GAE8w2OAHkyMMCvacoUTjKIBfOLygQQcAOQA3TmPQQYZpElCRYiOAC84BoyfPuIACYOSLgQPPAAKhLMLHAAvBzaPPxQIAAUImKSaRg4+GkIcMABAFxwDEysaQCUXtXVBHAAHvEAfIjEqFDYMGRQJHAATHCcdKQUVFBIetVIsvJwUTHxSipqMAA889gQvIvRrK2dcAD0JwB6APyOZ3AAjAB0cADuwDAScAAGmeISn0i3bBNeT4bClL4VGIAbQAup82nA0gAxACCAEkADKzULhOAorQ6ADKjBiaJIoS0eHgCS4yQEGTIol+aUhVXqjRacXayFQqGAezSAEImrVur1+nBYSMxvjtDINqyWEdeXAxX0Bk0HnQwGIYGkzI0zLMZnM5ApZUSSawyRTuvgVspVCotmbdniCTJiZUWDboHaYMqVbcro4ASchk9Xu8ICovj9JP9bgBhRQAJVTAFEkxE4ABaOBAkEwMFlT6K2HwrmIgAKKMJhOxYQY7rlXpiSb9VJWtL49MVNQ5CJ5vP5iOFop66slMOlLZ0CqtSuOaolmu1uv1huNs22c89i47lPtCUd6xd8jdFv33sP-sDqGD1xu4YAzJG3h9voysn8wwXgVSJZxhM1CVu0yLoliIRNvAKIkHYEjUL6R7Uok3C9qkDJMtkuRUgURTgv21QzA0zRDsuk4SsMozjJQ1DTDuZp4vB7xIeSnbHqsTqbNsl4sYhUDIXexynOGIbPnAAAs77RrGX7Yb+gIAaC4JloucAAD7lIuFYImktb1o2uIosIdAQLeXY0kkGHpERg5VsOfICuOqqUQMUo0VeC7evernihqDGmgsJlmRZnGns6vF7CF5kcQGnSPqGty5ilqVpelGWZVlKWODizYAFqBBmTScOAwgKAk7haouNQPPGEi1T2KTpJy3LHKOQoin5U4eWM5YwhR-nNFqOpvJu5jbkFCiFQExWlTqFUeA8zC8NQ547HsM1zWV2BHEAA
The text was updated successfully, but these errors were encountered:
Thank you! I will fix that with the next version.
Sorry, something went wrong.
Fix types at brand and transform method #195
3693a45
Will be fixed with the next version! Thanks again!
Fixed in v0.19.0
fabian-hiller
No branches or pull requests
transform
does not infer type correctly when combined withnullish
.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
The text was updated successfully, but these errors were encountered: