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'm currently facing an issue with TypeScript where it seems to be unable to correctly infer types in a specific scenario involving generics, enums, and inheritance.
TypeScript only infers the return type of done() as Promise<Result<Status.SUCCESS, unknown, string | number>>, while I expect it to infer Promise<Result<Status.SUCCESS, {}, number>>.
Why does TypeScript fail to infer the specific generic types as I expect in the TestTask class? Is this a limitation of TypeScript's type inference system, or am I missing something in how I should annotate or structure my types or code?
The text was updated successfully, but these errors were encountered:
This isn't an appropriate place to ask this question, and you haven't properly filled out the issue template. Please close this to spare the TS team from having to do so. Please stick to Stack Overflow or some other more appropriate place if you're asking questions.
To expedite the triage process, we need everyone to follow the issue template and instructions.
When you clicked "Create New Issue", the issue form was pre-populated with a template and some instructions. We need you to read those instructions completely, follow them, and then fill in all the fields in that template.
We are not able to assist with issues that don't follow the template instructions as they represent a significantly larger amount of work compared to issues which are correctly specified. Thank you for understanding.
I'm currently facing an issue with TypeScript where it seems to be unable to correctly infer types in a specific scenario involving generics, enums, and inheritance.
Here is a simplified version of my code:
TypeScript only infers the return type of
done()
asPromise<Result<Status.SUCCESS, unknown, string | number>>
, while I expect it to inferPromise<Result<Status.SUCCESS, {}, number>>
.Why does TypeScript fail to infer the specific generic types as I expect in the TestTask class? Is this a limitation of TypeScript's type inference system, or am I missing something in how I should annotate or structure my types or code?
The text was updated successfully, but these errors were encountered: