Mirror: 🎩 A tiny but capable push & pull stream library for TypeScript and Flow
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix up Flow types and add check script (#68)

authored by

Phil Plückthun and committed by
GitHub
9c914d86 afde108f

+47 -14
+11
.flowconfig
··· 1 + [ignore] 2 + 3 + [include] 4 + 5 + [libs] 6 + 7 + [lints] 8 + 9 + [options] 10 + 11 + [strict]
+4 -1
package.json
··· 24 24 "scripts": { 25 25 "docs:dev": "gatsby develop", 26 26 "docs:build": "gatsby build", 27 - "check": "tsc --noEmit", 27 + "check:ts": "tsc --noEmit", 28 + "check:flow": "flow focus-check ./src/helpers/Wonka_flow_test.js", 29 + "check": "run-s check:ts check:flow", 28 30 "bs:clean": "bsb -clean-world", 29 31 "bs:build": "bsb -make-world", 30 32 "bs:watch": "bsb -make-world -w", ··· 72 74 "callbag-iterate": "^1.0.0", 73 75 "callbag-take": "^1.4.0", 74 76 "coveralls": "^3.0.9", 77 + "flow-bin": "^0.115.0", 75 78 "flowgen": "^1.10.0", 76 79 "gatsby": "^2.18.17", 77 80 "gatsby-plugin-netlify": "^2.1.30",
+2 -1
scripts/generate-flow-files.js
··· 53 53 const basename = path.basename(fullpath, '.d.ts'); 54 54 const filepath = path.dirname(fullpath); 55 55 const newpath = path.join(filepath, basename + '.js.flow'); 56 - return writeFile(newpath, preamble + flowdef); 56 + const definition = flowdef.replace(/import/g, 'import type'); 57 + return writeFile(newpath, preamble + definition); 57 58 }); 58 59 59 60 return Promise.all([...write, genEntry()]);
+16 -12
src/helpers/Wonka_deriving.ts
··· 1 1 import { __ as block } from 'bs-platform/lib/es6/block'; 2 2 import { talkbackPlaceholder } from './Wonka_helpers.bs'; 3 - import * as types from '../Wonka_types.gen'; 4 3 5 - type talkbackCb = (tb: types.talkbackT) => void; 4 + import { 5 + talkbackT, 6 + signalT 7 + } from '../Wonka_types.gen'; 6 8 7 - export const pull = (0 as any as types.talkbackT); 8 - export const close = (1 as any as types.talkbackT); 9 + type talkbackCb = (tb: talkbackT) => void; 9 10 10 - export const start = <a>(tb: talkbackCb): types.signalT<a> => block(0, [tb]) as any; 11 - export const push = <a>(x: a): types.signalT<a> => block(1, [x]) as any; 12 - export const end = <a>(): types.signalT<a> => 0 as any; 11 + export const pull = (0 as any as talkbackT); 12 + export const close = (1 as any as talkbackT); 13 13 14 - export const isStart = <a>(s: types.signalT<a>) => 14 + export const start = <a>(tb: talkbackCb): signalT<a> => block(0, [tb]) as any; 15 + export const push = <a>(x: a): signalT<a> => block(1, [x]) as any; 16 + export const end = <a>(): signalT<a> => 0 as any; 17 + 18 + export const isStart = <a>(s: signalT<a>) => 15 19 typeof s !== 'number' && (s as any).tag === 0; 16 - export const isPush = <a>(s: types.signalT<a>) => 20 + export const isPush = <a>(s: signalT<a>) => 17 21 typeof s !== 'number' && (s as any).tag === 1; 18 - export const isEnd = <a>(s: types.signalT<a>) => 22 + export const isEnd = <a>(s: signalT<a>) => 19 23 typeof s === 'number' && (s as any) === 0; 20 24 21 - export const unboxPush = <a>(s: types.signalT<a>): a | null => 25 + export const unboxPush = <a>(s: signalT<a>): a | null => 22 26 isPush(s) ? (s as any)[0] : null; 23 - export const unboxStart = <a>(s: types.signalT<a>): talkbackCb => 27 + export const unboxStart = <a>(s: signalT<a>): talkbackCb => 24 28 isStart(s) ? (s as any)[0] : (talkbackPlaceholder as any);
+9
src/helpers/Wonka_flow_test.js
··· 1 + // @flow 2 + 3 + import * as Wonka from '../../'; 4 + 5 + Wonka.pipe( 6 + Wonka.fromArray([1, 2, 3]), 7 + Wonka.map(x => x * 2), 8 + Wonka.publish 9 + );
+5
yarn.lock
··· 6131 6131 resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.1.tgz#69e57caa8f0eacbc281d2e2cb458d46fdb449e08" 6132 6132 integrity sha512-a1hQMktqW9Nmqr5aktAux3JMNqaucxGcjtjWnZLHX7yyPCmlSV3M54nGYbqT8K+0GhF3NBgmJCc3ma+WOgX8Jg== 6133 6133 6134 + flow-bin@^0.115.0: 6135 + version "0.115.0" 6136 + resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.115.0.tgz#22e3ad9e5c7198967de80138ba8a9154ff387960" 6137 + integrity sha512-xW+U2SrBaAr0EeLvKmXAmsdnrH6x0Io17P6yRJTNgrrV42G8KXhBAD00s6oGbTTqRyHD0nP47kyuU34zljZpaQ== 6138 + 6134 6139 flowgen@^1.10.0: 6135 6140 version "1.10.0" 6136 6141 resolved "https://registry.yarnpkg.com/flowgen/-/flowgen-1.10.0.tgz#a041ae31d543d22166e7ba7c296b8445deb3c2e4"