whamcloud / flow-highland Goto Github PK
View Code? Open in Web Editor NEWflow type files for highland.js
flow type files for highland.js
Importing Readable, Writable, and Duplex stream types is still causing flow to not work correctly. Instead of importing these types, we should use the following internal types:
stream$Readable
stream$Writable
stream$Duplex
Can you add the concat
method to HighlandStream<T>
class?
concat(ys: HighlandStream<T> | Array<T>): HighlandStream<T>,
.parallel is currently returning HighlandStream, but it should return T. For example:
var readFile = _.wrapCallback(fs.readFile);
var filenames = _(['foo.txt', 'bar.txt', 'baz.txt']);
// read from up to 10 files at once
filenames.map(readFile)
.parallel(3)
.map((x:HighlandStreamT<Buffer>) => x.toString('utf8'))
Should be:
var readFile = _.wrapCallback(fs.readFile);
var filenames = _(['foo.txt', 'bar.txt', 'baz.txt']);
// read from up to 10 files at once
filenames.map(readFile)
.parallel(3)
.map((x:Buffer) => x.toString('utf8'))
We are doing:
import type { Writable, Readable, Duplex } from 'stream';
outside of the module declaration. This causes these types to be lost. For example, say I add the following line in the .flowconfig file of a different repo:
[libs]
node_modules/@mfl/flow-highland/flow-typed
Now, I add the following line in a source file:
import { Readable, Writable } from 'stream';
I will now receive the following flow error:'
Named import from module `stream`. This module has no named export called `Readable`.
To avoid this problem we can instead import these types within the module declaration.
Add a type for through with a Duplex stream.
Also fixup tests and add them + eslint travis check.
Update the module function overloads to add a case for stream handling.
Also, add a type for the invoke
method.
Finally, Update consume
so that what is pushed becomes the new return type.
The otherwise
method needs to be added.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.