| ▲ | nrhrjrjrjtntbt 12 hours ago | ||||||||||||||||||||||
Why? why make your code so complex you even hit this problem. Just use the type: const x: Thetype = .... I am not keen on as const either. Just program to interfaces. It is a better way to think IMO. | |||||||||||||||||||||||
| ▲ | ibejoeb 10 hours ago | parent [-] | ||||||||||||||||||||||
The author gets into that. `Thetype` might be complex. It also protects you from overgeneralizing, like casting to and from `unknown` to escape the type checker. | |||||||||||||||||||||||
| |||||||||||||||||||||||