-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Labels
SuggestionAn idea for TypeScriptAn idea for TypeScriptWon't FixThe severity and priority of this issue do not warrant the time or complexity needed to fix itThe severity and priority of this issue do not warrant the time or complexity needed to fix it
Description
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 241 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
Metadata
Metadata
Assignees
Labels
SuggestionAn idea for TypeScriptAn idea for TypeScriptWon't FixThe severity and priority of this issue do not warrant the time or complexity needed to fix itThe severity and priority of this issue do not warrant the time or complexity needed to fix it