Types are erased in typescript, but you can write generics with `extends typeof Thing` and do runtime type checks: https://effectivetypescript.com/2020/07/27/safe-queryselector/