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

[DOCS] Improve docs about callable property #7790

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

wgao19
Copy link
Contributor

@wgao19 wgao19 commented Jun 5, 2019

Addressing #7777, this PR hopes to improve docs around callable property.

The content of these edits credits to the discussions at niieani/typescript-vs-flowtype#55, especially insights from @omninonsense and @goodmind. Would really appreciate your inputs on this revision to the docs as well.

@goodmind
Copy link
Contributor

goodmind commented Jun 5, 2019

Function statics isn't {}, or if you mean {} as unsealed object, then it is probably

https://flow.org/try/#0GYVwdgxgLglg9mABMAFASkQbwL4ChfAB0wccQA
#106

@wgao19
Copy link
Contributor Author

wgao19 commented Jun 5, 2019

Is it about function type statics? Because I read in this commit that function type statics has been changed to "an empty, inexact object type". I'm wondering if rephrasing it as follows will be more accurate and clearer:

Callable objects can be viewed equivalently as functions with static fields. Function type statics are initially {}. Flow will notice when you annotate a variable as function type and try to access its statics without annotation.

type F = () => void;

const f: F = () => {
  f.foo = 'bar'; // $ExpectError "missing in statics of function type"
}

@goodmind goodmind added the Stalled Issues and PRs that are stalled. label Jul 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Stalled Issues and PRs that are stalled. Website
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants