Support final classes (non-subclassable)
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();
}
}
If I get enough courage and free time on my hands, I'll check how they implement abstract and implement final myself

@Voltra yes but your pr won’t be accepted and your work rolled back « Endgame ». You better convince ecma script to add final.
I implemented it myself using a decorator and ESLint rules, in case anyone is interested:
Decorator: https://www.npmjs.com/package/final-decorator ESLint rules checking decorator: https://www.npmjs.com/package/eslint-plugin-final
Check the repo for how to use it: https://github.com/TiMESPLiNTER/ts-final
import { Final } from 'final-decorator';
@Final
class FinalBase {
keep(): void {}
}
class Child extends FinalBase { // ❌ Class FinalBase is marked with @Final and cannot be extended.
keep(): void {}
}
class FinalMethodBase {
@Final
keep(): void {}
}
class ChildOfFinalMethodBase extends FinalMethodBase {
keep(): void {} // ❌ Method keep overrides a base method marked with @Final.
}
//
// Not allowed
//
@Final
class FinalFinal {
@Final // ❌ Method-level @Final is redundant when the class is already marked with @Final.
keep(): void {}
}
@Final // ❌ Final is not allowed on abstract classes.
abstract class AbstractBase {
abstract run(): void;
}
From what I've gathered, the last comments from the Typescript team are 6+ years old, including in the duplicate/related tickets.
In the meantime, there's been
- Private properties in javascript
- override and --noImplicitOverride in Typescript
- Open discussions in TC39 for the final keyword in js
- @sealed given as example of decorator use case in the Typescript website 😄
Which all point towards a wider adoption of classes and OOP concepts in js, especially around extendability contract.
As a bonus, we also now have:
- LLMs running rampant on codebases, who could definitely use a syntactic keyword that conveys intentionality
Since 6 years is an eternity ago in software, it'd be valuable to know: Where does the Typescript team stand on this issue in 2027?
@RyanCavanaugh 🙏