-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Add related span for mixin constructor error #28319
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
Add related span for mixin constructor error #28319
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one style suggestion.
const err = error(baseTypeNode.expression, Diagnostics.Type_0_is_not_a_constructor_function_type, typeToString(baseConstructorType)); | ||
if (baseConstructorType.flags & TypeFlags.TypeParameter) { | ||
const constraint = getConstraintFromTypeParameter(baseConstructorType); | ||
let elaborated = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of mutating let elaborated = false
, I think you can just let ctorReturn = unknownType;
and mutate that in the innermost if.
} | ||
} | ||
if (!elaborated) { | ||
addRelatedInfo(err, createDiagnosticForNode(baseConstructorType.symbol.declarations[0], Diagnostics.Did_you_mean_for_0_to_be_constrained_to_type_new_args_Colon_any_1, symbolToString(baseConstructorType.symbol), typeToString(unknownType))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you swap mutable elaborated for mutable ctorReturn, you can forgo the if and just say typeToString(ctorReturn)
👍 |
Fixes #17504