immutable.ts
This file
Path
__tests__/immutable.ts
60 lines · 1.2 KiB · TypeScript
Last changed by
Merge branch 'master' into map-fixesMichel Weststratebefore adoptioncb63fb0
History of this fileTake it
test(ts): use spec.tsAlec Larsonbefore adoptionb5abaed
line 1why, one step back1import {assert, _} from "spec.ts"Merge branch 'master' into map-fixesMichel Weststratebefore adoptioncb63fb0
line 2why, one step back2import {Immutable} from "../src/index"fix(ts): ensure produce returns an immutable typealeclarsonbefore adoptiondd25143
line 3why, one step back3Merge branch 'master' into map-fixesMichel Weststratebefore adoptioncb63fb0
lines 4–9why, one step back4test("types are ok", () => {5 // array in tuple6 {7 let val = _ as Immutable<[string[], 1]>8 assert(val, _ as readonly [ReadonlyArray<string>, 1])9 }fix(ts): ensure produce returns an immutable typealeclarsonbefore adoptiondd25143
line 10why, one step back10Merge branch 'master' into map-fixesMichel Weststratebefore adoptioncb63fb0
lines 11–15why, one step back11 // tuple in array12 {13 let val = _ as Immutable<[string, 1][]>14 assert(val, _ as ReadonlyArray<readonly [string, 1]>)15 }fix(ts): ensure produce returns an immutable typealeclarsonbefore adoptiondd25143
line 16why, one step back16Merge branch 'master' into map-fixesMichel Weststratebefore adoptioncb63fb0
lines 17–21why, one step back17 // tuple in tuple18 {19 let val = _ as Immutable<[[string, 1], 1]>20 assert(val, _ as readonly [readonly [string, 1], 1])21 }fix(ts): ensure produce returns an immutable typealeclarsonbefore adoptiondd25143
line 22why, one step back22Merge branch 'master' into map-fixesMichel Weststratebefore adoptioncb63fb0
lines 23–27why, one step back23 // array in array24 {25 let val = _ as Immutable<string[][]>26 assert(val, _ as ReadonlyArray<ReadonlyArray<string>>)27 }fix(ts): ensure produce returns an immutable typealeclarsonbefore adoptiondd25143
line 28why, one step back28Merge branch 'master' into map-fixesMichel Weststratebefore adoptioncb63fb0
lines 29–33why, one step back29 // tuple in object30 {31 let val = _ as Immutable<{a: [string, 1]}>32 assert(val, _ as {readonly a: readonly [string, 1]})33 }fix(ts): ensure produce returns an immutable typealeclarsonbefore adoptiondd25143
line 34why, one step back34Merge branch 'master' into map-fixesMichel Weststratebefore adoptioncb63fb0
lines 35–39why, one step back35 // object in tuple36 {37 let val = _ as Immutable<[{a: string}, 1]>38 assert(val, _ as readonly [{readonly a: string}, 1])39 }fix(ts): ensure produce returns an immutable typealeclarsonbefore adoptiondd25143
line 40why, one step back40Merge branch 'master' into map-fixesMichel Weststratebefore adoptioncb63fb0
lines 41–45why, one step back41 // array in object42 {43 let val = _ as Immutable<{a: string[]}>44 assert(val, _ as {readonly a: ReadonlyArray<string>})45 }fix(ts): ensure produce returns an immutable typealeclarsonbefore adoptiondd25143
line 46why, one step back46Merge branch 'master' into map-fixesMichel Weststratebefore adoptioncb63fb0
lines 47–51why, one step back47 // object in array48 {49 let val = _ as Immutable<Array<{a: string}>>50 assert(val, _ as ReadonlyArray<{readonly a: string}>)51 }fix(ts): ensure produce returns an immutable typealeclarsonbefore adoptiondd25143
line 52why, one step back52Merge branch 'master' into map-fixesMichel Weststratebefore adoptioncb63fb0
lines 53–60why, one step back53 // object in object54 {55 let val = _ as Immutable<{a: {b: string}}>56 assert(val, _ as {readonly a: {readonly b: string}})57 }5859 expect(true).toBe(true)60})