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
Could potentially have an intermediary abstract class with all declarations, but static cannot be abstract. Reasonable.
Definition merging sounded promising, but class merging is not allowed. Yet?
Override the actual method with an actual implementation – this is not really an answer, it results in too much code that does absolutely nothing.
There's one solution that partially works. Partially, because it gives JetBrains IDE the necessary hinting, that's all I want for now. Besides that it's useless.
This fails to compile with Duplicate identifier 'Baz' error. If the ambient declaration moved somewhere else, so that typescript doesn't compile it, then the IDE gets the hinting and tsc doesn't fail. But couldn't that just work like in example above? The rationale is:
Ambient declarations don't do much besides type checking and hinting.
Can be injected into final declarations produced by compiler.
Final declarations are fully reusable.
The text was updated successfully, but these errors were encountered:
Definition merging sounded promising, but class merging is not allowed. Yet?
A class introduces an instance type in the "type" space and a constructor function in the "value" space. interface + class merging augments the instance space, namespace + class merging augments the value space.
classBarextendsFoo{publicx: any;publicconstructor(x?: any){super();this.x=x;}}declarenamespaceBar{functionconstruct(x?: any): Bar;}Bar.construct().x// ok
I searched issues and SO, this seems to be something that comes up often, but there's no definitive / any answer to this. I have a proposal.
In
Bar
I want to define the same constructor signature for the staticconstruct
method. I've tried several things without much success:There's one solution that partially works. Partially, because it gives JetBrains IDE the necessary hinting, that's all I want for now. Besides that it's useless.
This fails to compile with
Duplicate identifier 'Baz'
error. If the ambient declaration moved somewhere else, so that typescript doesn't compile it, then the IDE gets the hinting and tsc doesn't fail. But couldn't that just work like in example above? The rationale is:The text was updated successfully, but these errors were encountered: