
Tanner Linsley - TanStack
devtools.fm: Developer Tools, Open Source, Software Development
00:00
TypeScript: A Hack to Make Type Safety Available
Tanner: We export an empty interface called a register and we export that interface. What that does is it registers because interfaces are mutable. It registers the type of your router into the inner type space, like the entire module. And what that means is that now when you go to consume exports right out of the library, like use route or link or something like that,. We can actually just reference a special type inside of the library called registered router. Tanner: I don't blame myself too much. I didn't have TypeScript.
Transcript
Play full episode