To override a private static property on a subclass in TypeScript, you can use Object.defineProperty()
method to define a new value for the private static property.
Here's an example:
index.ts578 chars21 lines
In the ChildClass
, we use Object.defineProperty()
to set a new value for the myPrivateStaticProperty
.
Note that since myPrivateStaticProperty
is private
, we cannot access it directly outside the class, but we can define a static method getMyPrivateStaticProperty()
to get its value.
gistlibby LogSnag