Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Questions about section "Index Signatures" #620

Open
JerryFan626 opened this issue Jan 14, 2021 · 0 comments
Open

Questions about section "Index Signatures" #620

JerryFan626 opened this issue Jan 14, 2021 · 0 comments

Comments

@JerryFan626
Copy link

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 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant