-
Notifications
You must be signed in to change notification settings - Fork 60
goog.require
overloading cannot create an alias for a type
#117
Comments
so calling it with var myClassConstructorValue = goog.require('MyClass');
var myClassInstance = new myClassConstructorValue();
var anotherInstnace: typeof myClassInstance; // === type MyClass I think what you want to say is something like microsoft/TypeScript#4233 |
Thanks for the explanation, that makes sense and has a good consistent mental model. The way I see it The missing context here is that we are trying to craft a This issue is a bit of wishful thinking, because only natively supported module imports do cary types through. For example for node modules the following works:
and similarly for ES6 modules:
I don't see how even more generalized
is a non-solution, as we don't want to expose too much complexity to the authors of that code. However, we will work with Closure team to support ES6 import statement as a full replacement for |
We now have the machinery in place to drop |
With require overloading on strings, we can emulate:
However this does not create a type alias for MyClass so the user cannot write:
even though they can do
or even add their own type alias with
type MyClass = typeof MyClass.prototype
.//cc @mhegazy
The text was updated successfully, but these errors were encountered: