Skip to content
Myr

fix(test): faulty .flowconfig

Before adoption: this commit came in with the history the project adopted, so no landing records it.

The .js.flow tests were not working, because of a faulty config file.

authored by aleclarson · committed by Alec Larson · parent a0bfaa6 · Browse files · 5 files+10 added−108 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

5 files+10 added−108 removed

  • tests:+9 added−99 removed
  • other:+1 added−9 removed

5 files+10 added−108 removed

added:__tests__/flow/.flowconfig+8 added
1[include]2../../dist34[lints]5untyped-import=error67[options]8suppress_comment= \\(.\\|\n\\)*\\$ExpectError
modified:__tests__/flow/flow.js.flow+1 added-1 removed
4 unmodified lines
5 produce as produce2,6 applyPatches,7 Patch,8 original9} from "../../src/index.js"9} from "../../dist/immer.js"1011setAutoFreeze(true)12setUseProxies(true)13
120 unmodified lines
deleted:__tests__/flow/ts.ts-98 removed
1import produce, {setAutoFreeze, setUseProxies, original} from "../../src/index"23setAutoFreeze(true)4setUseProxies(true)56// we really don't want this code to actually execute..7const result = produce({x: 3}, draft => {8 draft.x = 4910 // $ExpectError11 console.log(draft.y)12})1314console.log(result.x)1516const f2 = produce(draft => {})17f2({x: 3})1819// $ExpectError20setAutoFreeze(3)2122// $ExpectError23console.log(result.y)2425// $ExpectError26produce()2728// $ExpectError29produce({x: 3})3031// $ExpectError32produce({x: 3}, [])3334{35 // curried & initial arg36 const f = produce(37 (state, increment: number) => {38 state.x += increment39 },40 {x: 3}41 )4243 // $ExpectError Too few arguments44 f({x: 5})4546 // $ExpectError47 f({x: 5}, "test")4849 f({x: 5}, 3)5051 f(undefined, 3)52}5354{55 // curried f & no initial arg56 const f2 = produce((state: {x: number}, increment: number) => {57 state.x += increment58 })5960 f2({x: 5}, 3)6162 // $ExpectError63 f2(undefined, 3)64}6566{67 // Issue #12968 const handlers = {69 ["TEST"]: (draft: {}, {id, value}: {id: string; value: string}) => {70 draft[id] = {...draft[id], value}71 return draft72 }73 }7475 const reducer = (state = {}, {type, payload}: any): any =>76 handlers[type]77 ? produce<any, any>(handlers[type])(state, payload)78 : state79}8081produce({x: 3, z: {}}, draftState => {82 const a = draftState8384 if (a) {85 a.x86 // $ExpectError87 a.y88 }89})9091produce([1], draftState => {92 const a = original(draftState)93 if (a) {94 // $ExpectError95 const b: string = a[0]96 const c: number = a[0]97 }98})
deleted:.flowconfig-8 removed
1[ignore]2.*/node_modules34[include]5__tests__/flow67[options]8suppress_comment= \\(.\\|\n\\)*\\$ExpectError
modified:package.json+1 added-1 removed