easy5 pts · first answer countstypescript
Optional property in strict mode
With "strict": true in tsconfig, what does TypeScript report for this function?
interface User {
id: number
email?: string
}
function emailDomain(u: User) {
return u.email.split('@')[1]
}Discussion 0
Join free to post in the discussion.
Related questions
- One schema for form and APIFull Stack Developer
- Type cast on fetch responseFull Stack Developer
- TypeScript types at runtimeFrontend Developer
- Type inferred from a letFrontend Developer
- Narrowing a union with typeofFrontend Developer
- Declaring the same interface twiceFrontend Developer
- Type of an optional parameterFrontend Developer
- Pushing to a readonly arrayFrontend Developer