🔎 Search Terms
class extends null interface
🕗 Version & Regression Information
- This is the behavior in every version I tried (at least up until 3.3, which is the oldest build in the playground).
⏯ Playground Link
https://www.typescriptlang.org/play?lib=true&ts=5.1.6#code/JYOwLgpgTgZghgYwgAgEJwM4oN4CgC+uuCANphsgMLIQAekIAJhSAK4knJ7I-IID2IDGCisEYflAAUASi65eyQoVCRYiFNToNmaTDnxA
💻 Code
interfaceBase{}classCextendsnull{constructor(){}}interfaceCextendsBase{}🙁 Actual behavior
Reports the following error:
Class static side 'typeof C' incorrectly extends base class static side 'null'.
🙂 Expected behavior
No error. inteface Base does not describe the static side of anything, and reopening a class using something like interface C extends Base {} is common practice for shims.
Additional information about the issue
I ran into this when implementing a class that utilizes return override in a constructor when combined with class extends null while experimenting with the Shared Structs origin trial (whose constructors produce objects with a null prototype). Though native extends null has some issues in ES2015+, it still works fine with explicit return override in a constructor in any engine:
classCextendsnull{constructor(){return{};}}newC();// works just fine.
🔎 Search Terms
class extends null interface
🕗 Version & Regression Information
⏯ Playground Link
https://www.typescriptlang.org/play?lib=true&ts=5.1.6#code/JYOwLgpgTgZghgYwgAgEJwM4oN4CgC+uuCANphsgMLIQAekIAJhSAK4knJ7I-IID2IDGCisEYflAAUASi65eyQoVCRYiFNToNmaTDnxA
💻 Code
🙁 Actual behavior
Reports the following error:
🙂 Expected behavior
No error.
inteface Basedoes not describe the static side of anything, and reopening a class using something likeinterface C extends Base {}is common practice for shims.Additional information about the issue
I ran into this when implementing a class that utilizes
returnoverride in a constructor when combined withclass extends nullwhile experimenting with the Shared Structs origin trial (whose constructors produce objects with anullprototype). Though nativeextends nullhas some issues in ES2015+, it still works fine with explicitreturnoverride in a constructor in any engine: