-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
type alias does not work with classes #5014
Comments
Does not work too. The same Error! |
The problem here is var NextCommand = (function (_super) {
__extends(NextCommand, _super);
function NextCommand() {
_super.apply(this, arguments);
}
return NextCommand;
})(Command); /// notice Command is not defined. So you can only extend from value. the type alias you can achieve what you want by creating a new class, something like: class Command extends TCommand<any, any, any> { }
// then this works
export class NextCommand extends Command {
}
// and this:
var cmd = new MOD.mvvm.Command(); for more information about what is value vs. what is type see: https://github.com/Microsoft/TypeScript-Handbook/blob/master/pages/Declaration%20Merging.md#basic-concepts |
@mhegazy and
should be in JavaScript
P.S. - please, reopen the bug and fix this in new version |
if you want an alias for both value and type use export import Command = MOD.mvvm.TCommand; for your request, see #2559 |
@mhegazy export import Command = MOD.mvvm.TCommand <> |
yes. |
@mhegazy Better to make the alias work properly |
Please see #2559 . |
I defined a class:
and created an alias for the closed type:
now when i try:
the compiler says: Error 1 Cannot find name 'Command'
but i can write
without errors,
Expected: to allow using this type alias for inheritance purposes.
The text was updated successfully, but these errors were encountered: