Comments (7)
Thanks @marudor!
This set of PRs has been really helpful in fleshing out the process of review. Here are some thoughts so far:
Reviewing Test Files
- Every definition file should have at least one
test_
file that exercises it. - Each def file should be tested in at least the following ways
- Import all declared modules (make sure the act of merely using a libdef doesn't cause flow errors)
- Verify that all globals expected to be declared are visible in the test file
- Include both positive and negative tests to ensure that type checking is actually happening (AKA: Use
// $ExpectError
in at least a few places to ensure that we're getting type errors in a few critical places we would expect them) - Include type assertions about at least a few items declared by the definition file (i.e. positive test:
(new Widget().install(): void);
and negative test:// $ExpectError \n (new Widget().install(): number)
Reviewing Library Definitions
- I've been looking closely at the docs for the library being defined and comparing that with the libdef
- In general definitions should avoid using
any
types (which also includesFunction
andObject
) unless strictly necessary. In many places, usingmixed
in place ofany
in definition files will work and is a bit safer because it means that if the type ever leaks out of the definition somehow, it will need to be explicitly refined by the user before it can be used. I've opened #49 to track adding a feature tovalidate-defs
that comments on a PR when it introduces anany
type explaining that this should be avoided if at all possible. We don't want to banany
types completely (sometimes they are strictly necessary), only discourage their use if there is an alternative.
I think that's all the patterns/thoughts I've noticed so far, so let's add more here as things progress and eventually put them into the readme!
from flow-typed.
Good idea, @chrisbolin. Thanks for posting those!
I'll link another one in here, the immutable.js definitions that are in progress:
immutable-js/immutable-js#203
Specifically, this one by @halletj
immutable-js/immutable-js#203
from flow-typed.
I think it would be also a good idea too move/copy the react definitions from the flow repository itself to here. Although a lot of people probably rely on them currently, so there should be some strategy on how to clever move them without breaking flow for a large group of people. Maybe a deprecation warning if one uses the react definitions from flow itself and how a short message to migrate to this repository.
from flow-typed.
FWIW: I think it would be great to start pulling these libdefs in now.
Most of the remaining work on flow-typed is related to building out the CLI to make it easier to acquire the libdefs -- but seeding the repo (and having a nicely central place for people to come and find them manually) would still be very useful.
from flow-typed.
+1, especially @marudor if you have time.
from flow-typed.
As you can see by the PRs I've put my libdefs in here. Now it's time to review them.
from flow-typed.
I close this issue, since there is an established process and a list of definitions now :-)
from flow-typed.
Related Issues (20)
- rimraf is missing v4/5 HOT 1
- Workspace key is missing in the v4 docs
- Defintion koa-path-match
- Jest missing test case timeout HOT 2
- Dependency's dependency definitions should only consider `dependencies` HOT 1
- base-64
- add definition for body-scroll-lock-upgrade
- Add use-debounce definition
- [Question]: How to fix flowgen test after flow update HOT 1
- webpack v5 missing ProgressPlugin
- Jest support node api functions
- react-native loaded into test runner HOT 2
- use-debounced useDebounceCallback needs improvement
- body-scroll-lock-upgrade is declared wrong
- axios is missing signal property in config HOT 1
- new definition module-alias
- faker needs to add `person` from v8 onwards
- Add `worker_threads` to node environment
- Axios missing `instance.interceptors.request.clear()`
- Jest is missing toHaveBeenNthCalledWith HOT 1
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-typed.