Interview practice question
"Property does not exist on type" error
Frontend Engineering · TypeScript · Beginner
TypeScript says "Property 'role' does not exist on type 'User'," but you know the API sends it. How do you fix it?
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- Update the type definition.
- Make optional if not always present.
- Check source of truth (API spec).
- Avoid casting to any.
- Narrow if union.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.