typescript-book
typescript-book copied to clipboard
Questions about section "Index Signatures"
This chapter talks about: Using an intersection type to slove combine properties into index signature,but this is not useful. I have a question, Why not use Union Types(|) to combine this properties? And, Why TS is not infer "never" type, when you use intersection type(&) to merge two types that cannot possibly intersect.
type FieldState = {
value: string
}
type FormState =
{ isValid: boolean }
& { [fieldName: string]: FieldState }