Y
Hacker News
new
|
ask
|
show
|
jobs
by
hermanradtke
1613 days ago
I do not know of a way to make this a compiler error:
const user: User = JSON.parse(…);
1 comments
dhucerbin
1613 days ago
You can redefine all definitions from lib.d.ts and similar. In my projects, parse function returns unknown, so I need to parse/validate/decode it in runtime to satisfy types.
link