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

AI solution for TypeScript puzzle on BFE.dev
30. implement IsAny<T>

type IsAny<T> = false extends (T extends any ? (T extends never ? true : false) : true) ? true : false;

Explanation:

  • We use a ternary operator to check if T extends any, if it does then return true else return false
  • Within the ternary, we perform another check using never to make sure false is returned when T extends unknown or never and only returns true when the type any is extended.