You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I acknowledge that issues using this template may be closed without further explanation at the maintainer's discretion.
Comment
Hi, here’s my issue :
The inference when using the new keyword doesn't work as expected. I can't find a pattern that allows the types inferred by new to be the actual types inferred at instantiation, rather than just the types constrained by the class's generic parameters (e.g extends Record<string, string>)
In the first code (Prisma1), the inference for ModelName doesn't work as expected (the inferred type is Record<string, string>), but it feels more natural.
In the second code (Prisma2), the inference works correctly ({Model1: "Model1", ...}), but it forces me to repeat the type t_Prisma<MNs> everywhere in the class definition , which is not ideal.
I really want to use the first pattern because it exactly represents what I want to do: parameterize a class with an object of type t_Prisma, but I'm not sure if it's a good practice since it doesn't work that way.
Thank you for your help and have a great day!
The text was updated successfully, but these errors were encountered:
Acknowledgement
Comment
Hi, here’s my issue :
The inference when using the new keyword doesn't work as expected. I can't find a pattern that allows the types inferred by new to be the actual types inferred at instantiation, rather than just the types constrained by the class's generic parameters (e.g
extends Record<string, string>
)ts-playground:
In the first code (
Prisma1
), the inference for ModelName doesn't work as expected (the inferred type isRecord<string, string>
), but it feels more natural.In the second code (
Prisma2
), the inference works correctly ({Model1: "Model1", ...}
), but it forces me to repeat the typet_Prisma<MNs>
everywhere in the class definition , which is not ideal.I really want to use the first pattern because it exactly represents what I want to do: parameterize a class with an object of type
t_Prisma
, but I'm not sure if it's a good practice since it doesn't work that way.Thank you for your help and have a great day!
The text was updated successfully, but these errors were encountered: