Skip to content
Myr

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 file

Take it

test(ts): use spec.tsAlec Larsonbefore adoptionb5abaed

line 1why, one step back
1import {assert, _} from "spec.ts"

Merge branch 'master' into map-fixesMichel Weststratebefore adoptioncb63fb0

line 2why, one step back
2import {Immutable} from "../src/index"

fix(ts): ensure produce returns an immutable typealeclarsonbefore adoptiondd25143

line 3why, one step back
3

Merge branch 'master' into map-fixesMichel Weststratebefore adoptioncb63fb0

lines 4–9why, one step back
4test("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 back
10

Merge branch 'master' into map-fixesMichel Weststratebefore adoptioncb63fb0

lines 11–15why, one step back
11 // tuple in array
12 {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 back
16

Merge branch 'master' into map-fixesMichel Weststratebefore adoptioncb63fb0

lines 17–21why, one step back
17 // tuple in tuple
18 {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 back
22

Merge branch 'master' into map-fixesMichel Weststratebefore adoptioncb63fb0

lines 23–27why, one step back
23 // array in array
24 {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 back
28

Merge branch 'master' into map-fixesMichel Weststratebefore adoptioncb63fb0

lines 29–33why, one step back
29 // tuple in object
30 {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 back
34

Merge branch 'master' into map-fixesMichel Weststratebefore adoptioncb63fb0

lines 35–39why, one step back
35 // object in tuple
36 {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 back
40

Merge branch 'master' into map-fixesMichel Weststratebefore adoptioncb63fb0

lines 41–45why, one step back
41 // array in object
42 {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 back
46

Merge branch 'master' into map-fixesMichel Weststratebefore adoptioncb63fb0

lines 47–51why, one step back
47 // object in array
48 {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 back
52

Merge branch 'master' into map-fixesMichel Weststratebefore adoptioncb63fb0

lines 53–60why, one step back
53 // object in object
54 {55 let val = _ as Immutable<{a: {b: string}}>56 assert(val, _ as {readonly a: {readonly b: string}})57 }5859 expect(true).toBe(true)60})