Cannot use exact object type with [[call]]
- Dominant language
- Rust
- Stars
- 22.3k
- Forks
- 1.9k
- PR merge metrics
- No merged PRs in 30d
Description
```js
type LoggerType = {|
[[call]]: () => void,
+debug: () => void
|};
const createLogger = (): LoggerType => {
const log = () => {};
log.debug = () => {
};
return log;
};
```
https://flow.org/try/#0C4TwDgpgBAMg9gcwRATgFXNAvFA3gHwCgooBtUgYwEMAbGgXXoC4oAKASiiwD4oA3OAEsAJgBpiUANTCIAIwCuCFhy68BIwvgC+AbkKEKcAHYBnYFAooIVYBHhJUXNuxb3k6TKrwTDp8zUQnFR48XX0SAIQAOhkFBCDOENwJEgkwiStgeRQjKEi9XSA
Error:
```
13: return log;
^ Cannot return `log` because inexact function [1] is incompatible with exact `LoggerType` [2].
References:
7: const log = () => {};
^ [1]
6: const createLogger = (): LoggerType => {
^ [2]
```
Expected result:
I should be able to define exact object with [[call]] interface.
Contributor guide
Assessment
This issue has not been assessed yet.