Alongside the existing ExpectTypeOf methods, a method to check for successful extension of types would be helpful. Perhaps a strict/branded version as well.
Proposed syntax:
expectTypeOf<5>().toExtend<number>();
expectTypeOf<unknown>().toExtend<any>();
expectTypeOf('abc').toExtend([{}]); // Typescript error
expectTypeOf<5>().toStrictExtend<number>();
expectTypeOf<unknown>().toStrictExtend<any>(); // Typescript error
expectTypeOf('abc').toStrictExtend([{}]); // Typescript error
I would be happy to submit a PR for this. Especially since the Extends and StrictExtends types are already implemented, just not directly exposed in the main method.
My current workaround is:
expectTypeOf<
StrictExtends<Foo, Bar>
>().toBeEqual<true>();
Admittedly the grammar is a bit different (most methods start with toBe) so open to a renaming to match. toBeExtending...?
Alongside the existing
ExpectTypeOfmethods, a method to check for successful extension of types would be helpful. Perhaps a strict/branded version as well.Proposed syntax:
I would be happy to submit a PR for this. Especially since the
ExtendsandStrictExtendstypes are already implemented, just not directly exposed in the main method.My current workaround is:
Admittedly the grammar is a bit different (most methods start with
toBe) so open to a renaming to match.toBeExtending...?