Comments (1)
This happens because we can only reliably/safely check functions with annotations, otherwise there would be so many failures as to make the library totally impractical. This is also how flow does it in scenarios where it can't infer return types - it accepts Any<Function>
. To get around this, you'll need to add your annotation to the function directly:
type StrFunType = () => string;
const strFun: StrFunType = (): string => 'abc'; // this is fine
const numFun: StrFunType = (): number => 123; // should throw
from flow-runtime.
Related Issues (20)
- How do I get a list of class properties? HOT 1
- Array.from breaks on older browsers
- Feature request: opt-in Assert<T> type for arguments
- How to configure with create react app without ejecting ?
- Howto get function annotations HOT 5
- Function inside generic function doesn't work
- Configuration for React Native HOT 4
- Type spread on imported types doesn't work HOT 3
- Outdated flow-runtime on npm HOT 2
- Evaluate discontinuing development/ support of the non-core packages HOT 2
- Type Destructors current status
- Migrate site to Webpack 2, 3 or 4 HOT 1
- flow-runtime ParameterType remember doesn't work with arrays HOT 1
- Runtime types generated when not used HOT 4
- Support arbitrary conversions with a Type#convert method HOT 1
- import t from 'flow-runtime' doesn't get transpiled when sourceType = unambiguous
- Export Flow types as part of the module
- Dictionary objects checks are not consistent with flow behavoiur
- Problem with Literal Types extracted from an object using $Values<typeof OBJECT> HOT 1
- With recent versions of babel, type imports don't get correctly converted to runtime type imports [working on a fix]
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flow-runtime.