-
Notifications
You must be signed in to change notification settings - Fork 12.8k
class and function names should be typed as the actual name #51740
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
Comments
The problem with this is that minifiers are highly popular and they mangle those. So you could easily introduce runtime bugs by relying on those names - both at runtime and type level. |
See also: #47203 (comment) |
And in case of runtime code, like your I'd say that code that depends on the |
How is it possible for me to spend half an hour going through issues trying to find out if someone asked for this only to have missed it not once or twice but three times?
I see, I guess that makes sense, even if at design time the name is known, it may be changed by minifiers, making them not match.
Valid point, I hadn't even thought of that. My code doesn't rely on the name property, I really just want them to have the same name, and ensure I am not missing any entities for my tests. Do any of you have any alternative methods I could use for this use case? |
Suggestion
🔍 Search Terms
constructor name, function name
⭐ Suggestion
I would like for the type of a constructor's name property and a functions name property to be the actual name.
Currently, these are both typed as
string
.📃 Motivating Example
Current behaviour:
Proposed behaviour
💻 Use Cases
My use case involves an array of entity classes, used by an ORM.
For my unit tests, I want an object with as keys the name of the entity, and as a value, an array containing instances of the same entity.
I expected to be able to do this as follows:
However, here the type of TestEntities becomes
instead of
The text was updated successfully, but these errors were encountered: