Open
Description
🚀 Feature Request
As per current state of JSII, there's a limitation regarding overriding base class members.
This is described in the typescript restrictions documentation.
export class Base {
public method(): any { /* ... */ }
}
export class Child {
// ⛔️ Illegal change of signature when overriding a member
public method(): string { /* ... */ }
}
However, c# recently announced covariant returns to enable the specialized class to override the base class method:
https://devblogs.microsoft.com/dotnet/c-9-0-on-the-record/#covariant-returns
If the whole limitation can't be removed, maybe we could at least allow override when the new member type is an extension of the original base member.
Also, I haven't tried myself, but it would be interested to explore if this can also remove the limitation of overriding interface members.
Thank you.
Affected Languages
-
TypeScript
orJavascript
-
Python
-
Java
- .NET (
C#
,F#
, ...)