Created
December 12, 2024 15:36
-
-
Save dannyrb/ce21e4b93d03ae12e7663cc4bfd51cc1 to your computer and use it in GitHub Desktop.
Revisions
-
dannyrb created this gist
Dec 12, 2024 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ export type Expect<T extends true> = T; export type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends < T, >() => T extends Y ? 1 : 2 ? true : false; const myFunc = () => { return "hello"; }; /** * How do we extract MyFuncReturn from myFunc? */ type MyFuncReturn = ReturnType<typeof myFunc>; type tests = [Expect<Equal<MyFuncReturn, string>>];