I'm looking at a solution to the Union to Intersection challenge on typehero.dev https://typehero.dev/challenge/union-to-intersection/solutions/297 . You can see that the solution satisfies the tests here ( https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBDAnmApnA3nAogRwK4CGANgDTYAeqAxvAL5wBmUEIcA5AAJKoC0VAFsSIoAdgHMUAZwD0eGMCKS2AKGXc0AVRHAIIgCoQAkiJgooklDR0iAPBoB8cALxwAFBrgpypkQBNJcHgiANYiEADuInAA-G4EAFxwGgCUzo4AbhDAvnCJIijpZqlePv5uygCQCXDAIgxmcIYkyqlOGVm+lbGGlXkFZgDcqupwVAQWAS4A2spwFNQwNriERHbaugbGpuaW8ro2bAwQEGxwAD5wACwATOcIUHgo9mSHx6cAZFe3nzAPT8+zea7Jb4YhraybExmCxWfauVytRyvE6pC7w4CJG6I+6PZLPNwItLsI4ouCfdGY67Y364+wAgC6w2QaByLi0EKMUJ2sNsyNOFxudxpTyAA ) . However, on line 14 of the playground, if you hover over type d, it says "never". Why wouldn't it show the resulting intersection?
#Why is the intersection not visible on hover after converting Union To Intersection?
3 messages · Page 1 of 1 (latest)
@barren wigeon Here's a shortened URL of your playground link! You can remove the full link from your message.
Preview:```ts
import type {
Equal,
Expect,
} from "@type-challenges/utils"
type UnionToIntersection<U> = (
U extends unknown ? (a: U) => void : never
) extends (a: infer I) => void
? I
: never
type cases = [
Expect<
Equal<
UnionToIntersection<"foo" | 42 | true>,
"foo" & 42 & true
>
,
Expect<
Equal<
UnionToInters
...```
You can choose specific lines to embed by selecting them before copying the link.
never is the resulting intersection