cf.completefrontend

Write the codeMedium

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.

Write this
type MyReturnType<T> = T; // the type T's function returns // MyReturnType<() => string>          // string// MyReturnType<(id: number) => boolean> // boolean// MyReturnType<string>                // should be an error

Solve it in the editor

The answer

Write it yourself first. Then compare it with a reference solution and the checks it passes.

Checking your sign-in…