`static abstract` methods and properties
This is a continuation of #14600 which had two separate features proposed in the same issue (static members in interfaces *and* abstract static class members) ## Search Terms static abstract method property properties implement concrete ## Suggestion Currently, this code is illegal: ```ts abstract class A { static abstract doSomething(): void; } // Should be OK class B extends A { static doSomething() { } } // Should be an error; non-abstract class failed to implement abstract member class C extends A { } ``` It should be legal to have `abstract static` (`static abstract`?) members. ## Use Cases (what are they?) ## Unresolved Questions **What calls of abstract static methods are allowed?** Let's say you wrote a trivial hierarchy ```ts abstract class A { static abstract doSomething(): void; } class B extends A { static doSomething() { } } ``` For an expression `x.doSomething()`, what are valid `x`s? #### Option 1: All of them Because `this` isn't generic in `static` members, we should simply allow all invocations of abstract static methods. Otherwise code like this would be illegal: ```ts abstract class A { static abstract initialize(self: A): void; static createInstance() { const a = new this(); this.initialize(a); return a; } } ``` However, this means that TypeScript would miss straight-up crashes: ```ts // Exception: 'this.initialize' is not a function A.createInstance(); ``` * **Pros**: Ergonomic * **Cons**: Literally a
Posted by RyanCavanaugh on Oct 16, 2019, 4:42 PM
Tags
Related issues
- [Meta] Feedback on granular control over Copilot changes
- unexpected status 401 Unauthorized issue
- [MODEL] Measurable quality regression in Claude generation 5 (Fable 5 / Opus 5 / Sonnet 5): worse nonsense detection, ~2x verbosity, under-disclosed model fallb
- [CRITICAL] Subagent spawning and subagent pattern bugs trigger infinite recursion, infinite token usage, grossly inefficient token usage, and lost accumulated s
- Video stops playing after some minutes
- [MODEL] Claude verbose code comments by default — ignores instructions to stop.
Raise real-world problems, find people facing the same issue, and discuss solutions.3,500 issues0 comments
github (Software)
[Meta] Feedback on granular control over Copilot changes
unexpected status 401 Unauthorized issue
[MODEL] Measurable quality regression in Claude generation 5 (Fable 5 / Opus 5 / Sonnet 5): worse nonsense detection, ~2x verbosity, under-disclosed model fallb
[CRITICAL] Subagent spawning and subagent pattern bugs trigger infinite recursion, infinite token usage, grossly inefficient token usage, and lost accumulated s
Video stops playing after some minutes
[MODEL] Claude verbose code comments by default — ignores instructions to stop.
Scope Codex VS Code chats to the current workspace/project
Update on "Co-authored-by: Copilot" in commit messages
`static abstract` methods and properties
This is a continuation of #14600 which had two separate features proposed in the same issue (static members in interfaces *and* abstract static class members) ## Search Terms static abstract method property properties implement concrete ## Suggestion Currently, this code is illegal: ```ts abstract class A { static abstract doSomething(): void; } // Should be OK class B extends A { static doSomething() { } } // Should be an error; non-abstract class failed to implement abstract member class C extends A { } ``` It should be legal to have `abstract static` (`static abstract`?) members. ## Use Cases (what are they?) ## Unresolved Questions **What calls of abstract static methods are allowed?** Let's say you wrote a trivial hierarchy ```ts abstract class A { static abstract doSomething(): void; } class B extends A { static doSomething() { } } ``` For an expression `x.doSomething()`, what are valid `x`s? #### Option 1: All of them Because `this` isn't generic in `static` members, we should simply allow all invocations of abstract static methods. Otherwise code like this would be illegal: ```ts abstract class A { static abstract initialize(self: A): void; static createInstance() { const a = new this(); this.initialize(a); return a; } } ``` However, this means that TypeScript would miss straight-up crashes: ```ts // Exception: 'this.initialize' is not a function A.createInstance(); ``` * **Pros**: Ergonomic * **Cons**: Literally a
Comments (0)
No comments yet. Start the discussion.