t.throw flow type check is giving a false-positive (Callable signature not found in)
See original GitHub issueDescription
I am getting an “Callable signature not found in” when using t.throws
.
The type error originates in the node_modules/ava/index.js.flow
definition.
This could be simply me misunderstanding what the error is saying.
I’d expect Flow to pickup:
throws(value: Promise<mixed>, error?: ErrorValidator, message?: string): Promise<mixed>;
annotation and ignore:
throws(value: () => void, error?: ErrorValidator, message?: string): mixed;
I even explicitly cast the result to Promise<void>
.
If I remove the Promise<void>
cast, I am getting a different error, https://gist.github.com/gajus/5c42f0262874a2bae7842691eea28a60#file-ava-flow-sh-L2.
Test Source
test('timesout after 60 seconds', async (t): Promise<void> => {
const {
document
} = createDocument();
global.document = document;
const result: Promise<void> = loadScript('http://dailymail.co.uk/');
clock.tick(6e4 + 1);
t.throws(result, 'Script loading time has exceeded the maximum configured time limit.');
});
Error Message & Stack Trace
$ flow
node_modules/ava/index.js.flow:71
71: throws(value: () => void, error?: ErrorValidator, message?: string): mixed;
^^^^^^^^^^ function type. Callable signature not found in
94: t.throws(result, 'Script loading time has exceeded the maximum configured time limit.');
^^^^^^ Promise. See: test/utilities/loadScript.js:94
Found 1 error
Config
Copy the relevant section from package.json
:
{
"ava": {
"babel": {
"plugins": [
"transform-flow-strip-types",
"transform-async-to-generator",
"transform-es2015-modules-commonjs"
]
},
"require": [
"babel-register"
]
}
}
Command-Line Arguments
ava
Environment
Tell us which operating system you are using, as well as which versions of Node.js, npm, and AVA. Run the following to get it quickly:
Node.js v7.2.1
darwin 16.1.0
0.17.0
3.10.10
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
`Function` has no callable signature · Issue #3317 - GitHub
Function.prototype should be a callable property, currently flow complains that there is no "Callable signature".
Read more >Cannot call `data` because a callable signature is missing in ...
I am trying to declare the type of a function that can take function or object as a parameter, but the result is...
Read more >Types-First | Flow
Flow checks codebases by processing each file separately in dependency order. After a file has been checked, a signature is extracted and stored...
Read more >Advanced googletest Topics
This has the problem of not showing you the values of the parts of the expression, making it hard to understand what went...
Read more >Service | Android Developers
A Service is an application component representing either an application's desire to perform a longer-running operation while not interacting with the user ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
pinging @thejameskyle
A simpler repro case is simply:
Which yields: