This solution is generated by ChatGPT, correctness is not guaranteed.

AI solution for TypeScript puzzle on BFE.dev
8. implement Extract<T, U>

Here is one possible implementation of MyExtract<T, U>:

type MyExtract<T, U> = T extends U ? T : never;

The extends keyword is used to check whether each member of T is assignable to U. If so, that member is included in the resulting type. Otherwise, it is excluded (never).