Skip to content

Add "virtual" and "override" keywords for methods #1524

Description

I know that my suggestion (as what you see above in the title) is something (not a must)……Well, however, it would be nice if we can use this "syntax suger" to make TypeScript "more professional", the wrapper of js. Those without the "virtual" cannot be overridden. And when you type something like "override", it will offer you functions that can be overridden.

Thanks anyway!

Activity

  1. changed the title [-][Suggestion] Add "virtual" and "override" to make the function marked as "overridable"[/-] [+]Add "virtual" and "override" keywords for methods[/+] on Dec 17, 2014
  2. RyanCavanaugh commented on Dec 17, 2014

    @RyanCavanaugh
    Member

    This would be a breaking change as methods are 'virtual' by default.

    it's not even clear what a non-virtual method would mean in JavaScript - there is no such thing as a non-virtual call.

  3. ghost changed the title [-]Add "virtual" and "override" keywords for methods[/-] [+]Add "sealed" key word to mark some public/protected methods not be overriden[/+] on Dec 18, 2014
  4. ghost changed the title [-]Add "sealed" key word to mark some public/protected methods not be overriden[/-] [+][Suggestion] Add "sealed" key word to mark some public/protected methods not be overriden[/+] on Dec 18, 2014
  5. RyanCavanaugh commented on Dec 18, 2014

    @RyanCavanaugh
    Member

    Can you un-edit the title and log a new issue to track that suggestion? Thanks!

  6. changed the title [-][Suggestion] Add "sealed" key word to mark some public/protected methods not be overriden[/-] [+]Add "virtual" and "override" keywords for methods[/+] on Dec 18, 2014
  7. ngates87 commented on Aug 16, 2017

    @ngates87

    this may be a superfluous suggestion, but maybe one idea, for purely syntactic sugar keyword that maybe wouldn't break anything, is just allow you to have the override keyword after a function, to make it clear that is overriding a specific function?

  8. RyanCavanaugh commented on Aug 16, 2017

    @RyanCavanaugh
    Member
  9. kitsonk commented on Aug 17, 2017

    @kitsonk
    Contributor

    @MaleDong #2000 is open, the suggestion is that is the only thing that is being considered and you should add any thoughts to that issue.

  10. locked and limited conversation to collaborators on Jun 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    DeclinedThe issue was declined as something which matches the TypeScript visionSuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions