Write MyReturnType<T> without the built-in ReturnType.
MyReturnType<T> gives the return type of the function type T, and rejects a T that isn't a function type.
type MyReturnType<T> = T; // the type T's function returns // MyReturnType<() => string> // string// MyReturnType<(id: number) => boolean> // boolean// MyReturnType<string> // should be an errorThe answer
Write it yourself first. Then compare it with a reference solution and the checks it passes.
Checking your sign-in…