Course contentsShow
TypeScript
Lesson 987 of 1,79623. Type AssertionsPro lesson

Assertions with JSON.parse

Since `JSON.parse` returns `any`, assert the expected shape: `const data = JSON.parse(str) as MyType`.

This lesson is for subscribers

You've completed the free preview. Subscribe to unlock every lesson in every course.