Skip to content
RED SAG Skills
hardStudy question · answer published in JavaScript interview questions, so no pointstypescript

When extra properties are an error

Which line or lines does TypeScript report as an error?

type User = { name: string }

const data = { name: 'Ana', age: 30 }
const a: User = data                       // line A
const b: User = { name: 'Ana', age: 30 }   // line B
Choose one answer

Discussion 0

Join free to post in the discussion.

Related questions