A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/Microsoft/TypeScript/issues/8306 below:

Support final classes (non-subclassable) · Issue #8306 · microsoft/TypeScript · GitHub

I was thinking it could be useful to have a way to specify that a class should not be subclassed, so that the compiler would warn the user on compilation if it sees another class extending the original one.

On Java a class marked with final cannot be extended, so with the same keyword on TypeScript it would look like this:

final class foo {
    constructor() {
    }
}

class bar extends foo { // Error: foo is final and cannot be extended
    constructor() {
        super();
    }
}

ruslan-simonenko, hk0i, rylphs, MaximeMorin, Llorx and 242 morealuanhaddad and raveclassica11delavar, munjalpatel, paulshryock and neeko-catjazzfog, SCLeoX, lazarljubenovic, evans, Soothsilver and 26 morea11delavar, munjalpatel, marcospgp, NageshSingh-VidyaMantra, guizmaii and 2 morea11delavar, munjalpatel and paulshryock


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4