Merge branch 'flow-fixes'
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Michel Weststrate · committed by Michel Weststrate · parents 18eb760, ecee9e4 · Browse files · 6 files·+48 added−4 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
6 files+48 added−4 removed
- tests:+32 added−0 removed
- other:+16 added−4 removed
Provenance
- Commit
c8b61f6- Tree
500143f- Author
Michel Weststrate <mweststrate@gmail.com>- Committer
Michel Weststrate <mweststrate@gmail.com>- Parent 1
18eb760- Parent 2
ecee9e4
6 files changed+48 added−4 removed
added:__tests__/flow/flow.js+32 added
1234567891011121314151617181920212223242526272829303132// @flowimport produce, {setAutoFreeze, setUseProxies} from "../../src/immer"
setAutoFreeze(true)setUseProxies(true)
const result = produce({x: 3}, draft => { draft.x = 4
// $ExpectError console.log(draft.y)})
console.log(result.x)
const f2 = produce(draft => {})f2({x: 3})
// $ExpectErrorsetAutoFreeze(3)
// $ExpectErrorconsole.log(result.y)
// $ExpectErrorproduce()
// $ExpectErrorproduce({x: 3})
// $ExpectErrorproduce({x: 3}, [])modified:src/immer.js.flow-2 removed
1 // @flow2 3-declare export function extendShallowObservable(target: any): any4-3 /**4 * Immer takes a state, and runs a function against it.5 * That function can freely mutate the state, as it will create copies-on-write.6 * This means that the original state will stay unchanged, and once the function finishes, the modified state is returned39 unmodified linesadded:.flowconfig+8 added
1+[ignore]2+.*/node_modules3+4+[include]5+__tests__/flow6+7+[options]8+suppress_comment= \\(.\\|\n\\)*\\$ExpectErrormodified:.travis.yml+1 added-1 removed
4 unmodified lines5678994 unmodified lines - NODE_ENV=TESTcache: directories: - "node_modules"script: yarn coverallsscript: yarn coveralls && yarn test:flowmodified:package.json+3 added-1 removed
9 unmodified lines10111213141516171853 unmodified lines7273747575767778799 unmodified lines "types": "./dist/immer.d.ts", "scripts": { "test": "jest", "test:perf": "yarn-or-npm build && node --expose-gc node_modules/jest-cli/bin/jest.js --verbose --testRegex '__performance_tests__/.*?js$'", "test:flow": "yarn-or-npm flow check", "coveralls": "jest --coverage && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage", "build": "rimraf dist/ && cross-env NODE_ENV=production rollup -c && cpx \"src/immer.{d.ts,js.flow}\" dist", "prettier": "prettier \"*/**/*.js\" --ignore-path ./.prettierignore --write", "prepublish": "yarn-or-npm run build"53 unmodified lines "^.+\\.jsx?$": "babel-jest" } }, "dependencies": { "cpx": "^1.5.0" "cpx": "^1.5.0", "flow-bin": "^0.64.0" }}modified:yarn.lock+4 added
1371 unmodified lines1372 resolved "https://registry.yarnpkg.com/find-up/-/find-up-2.1.0.tgz#45d1b7e506c717ddd482775a2b77920a3c0c57a7"1373 dependencies:1374 locate-path "^2.0.0"1375 1376+flow-bin@^0.64.0:1377+ version "0.64.0"1378+ resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.64.0.tgz#ddd3fb3b183ab1ab35a5d5dec9caf5ebbcded167"1379+1380 for-in@^1.0.1:1381 version "1.0.2"1382 resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80"1383 2155 unmodified lines