Private class field helpers throw a confusing error when in unbound method with undefined this
#57609
Labels
Awaiting More Feedback
This means we'd like to hear from more people who would be helped by this feature
Suggestion
An idea for TypeScript
π Search Terms
this undefined bind private identifier class __classPrivateFieldSet __classPrivateFieldGet bound unbound
π Version & Regression Information
β― Playground Link
https://www.typescriptlang.org/play?#code/MYGwhgzhAEBiD29oG8BQ0PQMQDcwgFcBTaAXmgEYAmAZgBYBudTAcyIBcA1fYgCgEoU0AE4cCwgHbR2ACwCWEAHS4eRBtAC+qLamDwJEdtABmiMtAlEA7nEQCmu-RHggiikPBa8ABqfiK2LlUBcwASZD8Ajm5CIgENb34HAHpk6AB5eAAHCAAaaABJaAATOWKJAHIjACM5CWKAQkcDI0CY4nNIttUUtIAVGWF4KwgALmgAYTAJCXgjUTBi6CzhOTx2EgBbIk3qomETIc3oaeh4aoArImAjKxl4CBJQSBhSpdmjYuvwUWg5dmazlc7k8Pm6sRC5HC4L4-AS-FQQA
π» Code
π Actual behavior
Throws
Cannot read private member from an object whose class did not declare it
.But the actual problem is that
this
is undefined and I had no idea!π Expected behavior
A special error for
this
when undefined; IIRC there's no possible way this would normally pass, so a special error would be a lot more clear.Additional information about the issue
No response
The text was updated successfully, but these errors were encountered: