-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Array<A|B> should be compatible with Array<A> #3425
Comments
Perhaps related: #2507 |
|
Can't because function func(things: Array<string | number>): void {
things.push(1);
}
var value: string[] = ['f'];
func(value);
console.log(typeof value[1]); // a number! |
@jesseschalken @omerzach Wow, thanks for the quick follow up! Is there a way to make flow allow this if the function doesn't mutate the array - e.g. using a readonly array? |
You can use |
See also #2333 |
@jesseschalken Sure enough! |
Closing in favor of #2333 |
This:
Gives:
The text was updated successfully, but these errors were encountered: