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
Static class members should be allowed to reference the class's type parameters.
Use Cases
A very simple use case is in database models such as the example given below.
At the moment there's no way provided by the TypeScript to deal with such a problem which is the main reason we use this language, type safety!
This bahavior is unacceptable since it needs the developer to reference the item interface every time he/she calls these sort of methods, which doesn't seem to satisfy the soul purpose of the TypeScript
Checklist
My suggestion meets these guidelines:
This wouldn't be a breaking change in existing TypeScript/JavaScript code
This wouldn't change the runtime behavior of existing JavaScript code
This could be implemented without emitting different JS based on the types of the expressions
This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
Search Terms
static, generic, type, class, model, inheritance
Suggestion
Static class members should be allowed to reference the class's type parameters.
Use Cases
A very simple use case is in database models such as the example given below.
At the moment there's no way provided by the TypeScript to deal with such a problem which is the main reason we use this language, type safety!
Examples
Expected behavior:
The behavior we got to deal with: (which can add more typing error easily)
This bahavior is unacceptable since it needs the developer to reference the item interface every time he/she calls these sort of methods, which doesn't seem to satisfy the soul purpose of the TypeScript
Checklist
My suggestion meets these guidelines:
The text was updated successfully, but these errors were encountered: