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

Type spread doesn't work correctly with optional properties #7697

mrtnzlml opened this issue May 3, 2019 · 0 comments


None yet
2 participants
Copy link

commented May 3, 2019

Hi, I am using the latest Flow version and I am getting unexpected behavior. Example:

type AAA = { headers?: boolean }
type BBB = { ...$Exact<AAA>, headers?: string }

({ headers: true }: BBB) // string and boolean are allowed here ❌, I expected only string

type CCC = { headers: boolean }
type DDD = { ...$Exact<CCC>, headers: string }

({ headers: 'true' }: DDD) // only string is allowed here ✅

The $Exact is not significant, I just wasn't sure if it's related to this issue (seems like it's not). Why is the behavior different with optional props? Am I missing something? 🤔 Thanks for checking it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.