jazz-tools 0.8.14 → 0.8.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. package/CHANGELOG.md +281 -268
  2. package/dist/native/coValues/account.js +3 -6
  3. package/dist/native/coValues/account.js.map +1 -1
  4. package/dist/native/coValues/coList.js +3 -7
  5. package/dist/native/coValues/coList.js.map +1 -1
  6. package/dist/native/coValues/coMap.js +8 -14
  7. package/dist/native/coValues/coMap.js.map +1 -1
  8. package/dist/native/coValues/coStream.js +7 -12
  9. package/dist/native/coValues/coStream.js.map +1 -1
  10. package/dist/native/coValues/deepLoading.js +6 -3
  11. package/dist/native/coValues/deepLoading.js.map +1 -1
  12. package/dist/native/coValues/extensions/imageDef.js.map +1 -1
  13. package/dist/native/coValues/group.js +3 -6
  14. package/dist/native/coValues/group.js.map +1 -1
  15. package/dist/native/coValues/interfaces.js +4 -3
  16. package/dist/native/coValues/interfaces.js.map +1 -1
  17. package/dist/native/exports.js +3 -9
  18. package/dist/native/exports.js.map +1 -1
  19. package/dist/native/implementation/createContext.js +7 -0
  20. package/dist/native/implementation/createContext.js.map +1 -1
  21. package/dist/native/implementation/devtoolsFormatters.js +5 -25
  22. package/dist/native/implementation/devtoolsFormatters.js.map +1 -1
  23. package/dist/native/implementation/refs.js +1 -2
  24. package/dist/native/implementation/refs.js.map +1 -1
  25. package/dist/native/implementation/schema.js +1 -1
  26. package/dist/native/implementation/schema.js.map +1 -1
  27. package/dist/native/implementation/subscriptionScope.js +2 -4
  28. package/dist/native/implementation/subscriptionScope.js.map +1 -1
  29. package/dist/native/index.native.js +1 -1
  30. package/dist/native/index.native.js.map +1 -1
  31. package/dist/native/lib/cache.js.map +1 -1
  32. package/dist/native/lib/cache.test.js +1 -1
  33. package/dist/native/lib/cache.test.js.map +1 -1
  34. package/dist/web/coValues/account.js +3 -6
  35. package/dist/web/coValues/account.js.map +1 -1
  36. package/dist/web/coValues/coList.js +3 -7
  37. package/dist/web/coValues/coList.js.map +1 -1
  38. package/dist/web/coValues/coMap.js +8 -14
  39. package/dist/web/coValues/coMap.js.map +1 -1
  40. package/dist/web/coValues/coStream.js +7 -12
  41. package/dist/web/coValues/coStream.js.map +1 -1
  42. package/dist/web/coValues/deepLoading.js +6 -3
  43. package/dist/web/coValues/deepLoading.js.map +1 -1
  44. package/dist/web/coValues/extensions/imageDef.js.map +1 -1
  45. package/dist/web/coValues/group.js +3 -6
  46. package/dist/web/coValues/group.js.map +1 -1
  47. package/dist/web/coValues/interfaces.js +4 -3
  48. package/dist/web/coValues/interfaces.js.map +1 -1
  49. package/dist/web/exports.js +3 -9
  50. package/dist/web/exports.js.map +1 -1
  51. package/dist/web/implementation/createContext.js +7 -0
  52. package/dist/web/implementation/createContext.js.map +1 -1
  53. package/dist/web/implementation/devtoolsFormatters.js +5 -25
  54. package/dist/web/implementation/devtoolsFormatters.js.map +1 -1
  55. package/dist/web/implementation/refs.js +1 -2
  56. package/dist/web/implementation/refs.js.map +1 -1
  57. package/dist/web/implementation/schema.js +1 -1
  58. package/dist/web/implementation/schema.js.map +1 -1
  59. package/dist/web/implementation/subscriptionScope.js +2 -4
  60. package/dist/web/implementation/subscriptionScope.js.map +1 -1
  61. package/dist/web/lib/cache.js.map +1 -1
  62. package/dist/web/lib/cache.test.js +1 -1
  63. package/dist/web/lib/cache.test.js.map +1 -1
  64. package/package.json +5 -9
  65. package/src/coValues/account.ts +330 -339
  66. package/src/coValues/coList.ts +474 -495
  67. package/src/coValues/coMap.ts +584 -604
  68. package/src/coValues/coStream.ts +624 -650
  69. package/src/coValues/deepLoading.ts +184 -200
  70. package/src/coValues/extensions/imageDef.ts +44 -44
  71. package/src/coValues/group.ts +196 -210
  72. package/src/coValues/interfaces.ts +197 -199
  73. package/src/exports.ts +38 -25
  74. package/src/implementation/createContext.ts +210 -204
  75. package/src/implementation/devtoolsFormatters.ts +80 -100
  76. package/src/implementation/refs.ts +127 -139
  77. package/src/implementation/schema.ts +124 -128
  78. package/src/implementation/subscriptionScope.ts +111 -121
  79. package/src/index.native.ts +3 -3
  80. package/src/lib/cache.test.ts +48 -48
  81. package/src/lib/cache.ts +9 -9
  82. package/src/tests/coList.test.ts +264 -283
  83. package/src/tests/coMap.test.ts +741 -761
  84. package/src/tests/coStream.test.ts +405 -438
  85. package/src/tests/deepLoading.test.ts +251 -256
  86. package/src/tests/groupsAndAccounts.test.ts +70 -74
  87. package/src/tests/schema.test.ts +198 -198
  88. package/src/tests/subscribe.test.ts +312 -299
  89. package/tsconfig.json +2 -4
  90. package/tsconfig.native.json +4 -10
  91. package/tsconfig.web.json +4 -10
  92. package/.eslintrc.cjs +0 -24
  93. package/.prettierrc.js +0 -9
@@ -1,91 +1,87 @@
1
- import { expect, describe, test } from "vitest";
2
- import { Account, CoMap, co, Group, WasmCrypto } from "../index.web.js";
1
+ import { describe, expect, test } from "vitest";
2
+ import { Account, CoMap, Group, WasmCrypto, co } from "../index.web.js";
3
3
 
4
4
  const Crypto = await WasmCrypto.create();
5
5
 
6
6
  describe("Custom accounts and groups", async () => {
7
- class CustomProfile extends CoMap {
8
- name = co.string;
9
- color = co.string;
7
+ class CustomProfile extends CoMap {
8
+ name = co.string;
9
+ color = co.string;
10
+ }
11
+
12
+ class CustomAccount extends Account {
13
+ profile = co.ref(CustomProfile);
14
+ root = co.ref(CoMap);
15
+
16
+ migrate(this: CustomAccount, creationProps?: { name: string }) {
17
+ if (creationProps) {
18
+ const profileGroup = Group.create({ owner: this });
19
+ profileGroup.addMember("everyone", "reader");
20
+ this.profile = CustomProfile.create(
21
+ { name: creationProps.name, color: "blue" },
22
+ { owner: this },
23
+ );
24
+ }
10
25
  }
26
+ }
11
27
 
12
- class CustomAccount extends Account {
13
- profile = co.ref(CustomProfile);
14
- root = co.ref(CoMap);
15
-
16
- migrate(this: CustomAccount, creationProps?: { name: string }) {
17
- if (creationProps) {
18
- const profileGroup = Group.create({ owner: this });
19
- profileGroup.addMember("everyone", "reader");
20
- this.profile = CustomProfile.create(
21
- { name: creationProps.name, color: "blue" },
22
- { owner: this },
23
- );
24
- }
25
- }
28
+ class CustomGroup extends Group {
29
+ profile = co.null;
30
+ root = co.null;
31
+ [co.members] = co.ref(CustomAccount);
32
+
33
+ get nMembers() {
34
+ return this.members.length;
26
35
  }
36
+ }
27
37
 
28
- class CustomGroup extends Group {
29
- profile = co.null;
30
- root = co.null;
31
- [co.members] = co.ref(CustomAccount);
38
+ test("Custom account and group", async () => {
39
+ const me = await CustomAccount.create({
40
+ creationProps: { name: "Hermes Puggington" },
41
+ crypto: Crypto,
42
+ });
32
43
 
33
- get nMembers() {
34
- return this.members.length;
35
- }
36
- }
44
+ expect(me.profile).toBeDefined();
45
+ expect(me.profile?.name).toBe("Hermes Puggington");
46
+ expect(me.profile?.color).toBe("blue");
37
47
 
38
- test("Custom account and group", async () => {
39
- const me = await CustomAccount.create({
40
- creationProps: { name: "Hermes Puggington" },
41
- crypto: Crypto,
42
- });
48
+ const group = new CustomGroup({ owner: me });
49
+ group.addMember("everyone", "reader");
43
50
 
44
- expect(me.profile).toBeDefined();
45
- expect(me.profile?.name).toBe("Hermes Puggington");
46
- expect(me.profile?.color).toBe("blue");
47
-
48
- const group = new CustomGroup({ owner: me });
49
- group.addMember("everyone", "reader");
50
-
51
- expect(group.members).toMatchObject([
52
- { id: me.id, role: "admin" },
53
- { id: "everyone", role: "reader" },
54
- ]);
55
-
56
- expect(group.nMembers).toBe(2);
57
-
58
- await new Promise<void>((resolve) => {
59
- group.subscribe({}, (update) => {
60
- const meAsMember = update.members.find((member) => {
61
- return member.id === me.id && member.account?.profile;
62
- });
63
- if (meAsMember) {
64
- expect(meAsMember.account?.profile?.name).toBe(
65
- "Hermes Puggington",
66
- );
67
- expect(meAsMember.account?.profile?.color).toBe("blue");
68
- resolve();
69
- }
70
- });
71
- });
51
+ expect(group.members).toMatchObject([
52
+ { id: me.id, role: "admin" },
53
+ { id: "everyone", role: "reader" },
54
+ ]);
72
55
 
73
- class MyMap extends CoMap {
74
- name = co.string;
56
+ expect(group.nMembers).toBe(2);
57
+
58
+ await new Promise<void>((resolve) => {
59
+ group.subscribe({}, (update) => {
60
+ const meAsMember = update.members.find((member) => {
61
+ return member.id === me.id && member.account?.profile;
62
+ });
63
+ if (meAsMember) {
64
+ expect(meAsMember.account?.profile?.name).toBe("Hermes Puggington");
65
+ expect(meAsMember.account?.profile?.color).toBe("blue");
66
+ resolve();
75
67
  }
68
+ });
69
+ });
76
70
 
77
- const map = MyMap.create({ name: "test" }, { owner: group });
71
+ class MyMap extends CoMap {
72
+ name = co.string;
73
+ }
78
74
 
79
- const meAsCastMember = map._owner
80
- .castAs(CustomGroup)
81
- .members.find((member) => member.id === me.id);
82
- expect(meAsCastMember?.account?.profile?.name).toBe(
83
- "Hermes Puggington",
84
- );
85
- expect(meAsCastMember?.account?.profile?.color).toBe("blue");
75
+ const map = MyMap.create({ name: "test" }, { owner: group });
86
76
 
87
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
88
- expect((map._owner as any).nMembers).toBeUndefined();
89
- expect(map._owner.castAs(CustomGroup).nMembers).toBe(2);
90
- });
77
+ const meAsCastMember = map._owner
78
+ .castAs(CustomGroup)
79
+ .members.find((member) => member.id === me.id);
80
+ expect(meAsCastMember?.account?.profile?.name).toBe("Hermes Puggington");
81
+ expect(meAsCastMember?.account?.profile?.color).toBe("blue");
82
+
83
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
84
+ expect((map._owner as any).nMembers).toBeUndefined();
85
+ expect(map._owner.castAs(CustomGroup).nMembers).toBe(2);
86
+ });
91
87
  });
@@ -3,203 +3,203 @@ import { CoMap, co } from "../index.web.js";
3
3
  import { co as valueWithCoMarker } from "../internal.js";
4
4
 
5
5
  describe("co.json TypeScript validation", () => {
6
- it("should accept serializable types", async () => {
7
- type ValidType = { str: string; num: number; bool: boolean };
8
-
9
- class ValidPrimitiveMap extends CoMap {
10
- data = co.json<ValidType>();
11
- }
12
-
13
- expectTypeOf(ValidPrimitiveMap.create<ValidPrimitiveMap>)
14
- .parameter(0)
15
- .toEqualTypeOf<{
16
- data: valueWithCoMarker<ValidType>;
17
- }>();
18
- });
19
-
20
- it("should accept nested serializable types", async () => {
21
- type NestedType = {
22
- outer: {
23
- inner: {
24
- value: string;
25
- };
26
- };
27
- }
28
-
29
- class ValidNestedMap extends CoMap {
30
- data = co.json<NestedType>();
31
- }
32
-
33
- expectTypeOf(ValidNestedMap.create<ValidNestedMap>)
34
- .parameter(0)
35
- .toEqualTypeOf<{
36
- data: valueWithCoMarker<NestedType>;
37
- }>();
38
- });
39
-
40
- it("should accept types with optional attributes", async () => {
41
- type TypeWithOptional = {
42
- value: string;
43
- optional?: string | null;
44
- }
45
-
46
- class ValidMap extends CoMap {
47
- data = co.json<TypeWithOptional>();
48
- }
49
-
50
- expectTypeOf(ValidMap.create<ValidMap>)
51
- .parameter(0)
52
- .toEqualTypeOf<{
53
- data: valueWithCoMarker<TypeWithOptional>;
54
- }>();
55
- });
56
-
57
- it("should accept nested serializable interfaces", async () => {
58
- interface InnerInterface {
59
- value: string;
60
- }
61
-
62
- interface NestedInterface {
63
- outer: {
64
- inner: InnerInterface;
65
- };
66
- }
67
-
68
- class ValidNestedMap extends CoMap {
69
- data = co.json<NestedInterface>();
70
- }
71
-
72
- expectTypeOf(ValidNestedMap.create<ValidNestedMap>)
73
- .parameter(0)
74
- .toEqualTypeOf<{
75
- data: valueWithCoMarker<NestedInterface>;
76
- }>();
77
- });
78
-
79
- it("should accept arrays of serializable types", async () => {
80
- interface ArrayInterface {
81
- numbers: number[];
82
- objects: { id: number; name: string }[];
83
- }
84
-
85
- class ValidArrayMap extends CoMap {
86
- data = co.json<ArrayInterface>();
87
- }
88
-
89
- expectTypeOf(ValidArrayMap.create<ValidArrayMap>)
90
- .parameter(0)
91
- .toEqualTypeOf<{
92
- data: valueWithCoMarker<ArrayInterface>;
93
- }>();
94
- });
95
-
96
- it("should flag interfaces with functions as invalid", async () => {
97
- interface InvalidInterface {
98
- func: () => void;
99
- }
100
-
101
- class InvalidFunctionMap extends CoMap {
102
- // @ts-expect-error Should not be considered valid
103
- data = co.json<InvalidInterface>();
104
- }
105
-
106
- expectTypeOf(InvalidFunctionMap.create<InvalidFunctionMap>)
107
- .parameter(0)
108
- .toEqualTypeOf<{
109
- data: valueWithCoMarker<InvalidInterface>;
110
- }>();
111
- });
112
-
113
- it("should flag types with functions as invalid", async () => {
114
- type InvalidType = { func: () => void };
115
-
116
- class InvalidFunctionMap extends CoMap {
117
- // @ts-expect-error Should not be considered valid
118
- data = co.json<InvalidType>();
119
- }
120
-
121
- expectTypeOf(InvalidFunctionMap.create<InvalidFunctionMap>)
122
- .parameter(0)
123
- .toEqualTypeOf<{
124
- data: valueWithCoMarker<InvalidType>;
125
- }>();
126
- });
127
-
128
- it("should flag types with non-serializable constructors as invalid", async () => {
129
- type InvalidType = { date: Date; regexp: RegExp; symbol: symbol };
130
-
131
- class InvalidFunctionMap extends CoMap {
132
- // @ts-expect-error Should not be considered valid
133
- data = co.json<InvalidType>();
134
- }
135
-
136
- expectTypeOf(InvalidFunctionMap.create<InvalidFunctionMap>)
137
- .parameter(0)
138
- .toEqualTypeOf<{
139
- data: valueWithCoMarker<InvalidType>;
140
- }>();
141
- });
142
-
143
- it("should apply the same validation to optional json", async () => {
144
- type ValidType = {
145
- value: string;
6
+ it("should accept serializable types", async () => {
7
+ type ValidType = { str: string; num: number; bool: boolean };
8
+
9
+ class ValidPrimitiveMap extends CoMap {
10
+ data = co.json<ValidType>();
11
+ }
12
+
13
+ expectTypeOf(ValidPrimitiveMap.create<ValidPrimitiveMap>)
14
+ .parameter(0)
15
+ .toEqualTypeOf<{
16
+ data: valueWithCoMarker<ValidType>;
17
+ }>();
18
+ });
19
+
20
+ it("should accept nested serializable types", async () => {
21
+ type NestedType = {
22
+ outer: {
23
+ inner: {
24
+ value: string;
146
25
  };
147
-
148
- type InvalidType = {
149
- value: () => string;
150
- };
151
-
152
- class MapWithOptionalJSON extends CoMap {
153
- data = co.optional.json<ValidType>();
154
- // @ts-expect-error Should not be considered valid
155
- data2 = co.optional.json<InvalidType>();
156
- }
157
-
158
- expectTypeOf(MapWithOptionalJSON.create<MapWithOptionalJSON>)
159
- .parameter(0)
160
- .toEqualTypeOf<{
161
- data?: valueWithCoMarker<ValidType> | null;
162
- data2?: valueWithCoMarker<InvalidType> | null;
163
- }>();
164
- });
165
-
166
- it("should not accept functions", async () => {
167
- class InvalidFunctionMap extends CoMap {
168
- // @ts-expect-error Should not be considered valid
169
- data = co.json<() => void>();
170
- }
171
-
172
- expectTypeOf(InvalidFunctionMap.create<InvalidFunctionMap>)
173
- .parameter(0)
174
- .toEqualTypeOf<{
175
- data: valueWithCoMarker<() => void>;
176
- }>();
177
- });
178
-
179
- it("should not accept RegExp", async () => {
180
- class InvalidFunctionMap extends CoMap {
181
- // @ts-expect-error Should not be considered valid
182
- data = co.json<RegExp>();
183
- }
184
-
185
- expectTypeOf(InvalidFunctionMap.create<InvalidFunctionMap>)
186
- .parameter(0)
187
- .toEqualTypeOf<{
188
- data: valueWithCoMarker<RegExp>;
189
- }>();
190
- });
191
-
192
- it("should accept strings and numbers", async () => {
193
- class InvalidFunctionMap extends CoMap {
194
- str = co.json<string>();
195
- num = co.json<number>();
196
- }
197
-
198
- expectTypeOf(InvalidFunctionMap.create<InvalidFunctionMap>)
199
- .parameter(0)
200
- .toEqualTypeOf<{
201
- str: valueWithCoMarker<string>;
202
- num: valueWithCoMarker<number>;
203
- }>();
204
- });
26
+ };
27
+ };
28
+
29
+ class ValidNestedMap extends CoMap {
30
+ data = co.json<NestedType>();
31
+ }
32
+
33
+ expectTypeOf(ValidNestedMap.create<ValidNestedMap>)
34
+ .parameter(0)
35
+ .toEqualTypeOf<{
36
+ data: valueWithCoMarker<NestedType>;
37
+ }>();
38
+ });
39
+
40
+ it("should accept types with optional attributes", async () => {
41
+ type TypeWithOptional = {
42
+ value: string;
43
+ optional?: string | null;
44
+ };
45
+
46
+ class ValidMap extends CoMap {
47
+ data = co.json<TypeWithOptional>();
48
+ }
49
+
50
+ expectTypeOf(ValidMap.create<ValidMap>)
51
+ .parameter(0)
52
+ .toEqualTypeOf<{
53
+ data: valueWithCoMarker<TypeWithOptional>;
54
+ }>();
55
+ });
56
+
57
+ it("should accept nested serializable interfaces", async () => {
58
+ interface InnerInterface {
59
+ value: string;
60
+ }
61
+
62
+ interface NestedInterface {
63
+ outer: {
64
+ inner: InnerInterface;
65
+ };
66
+ }
67
+
68
+ class ValidNestedMap extends CoMap {
69
+ data = co.json<NestedInterface>();
70
+ }
71
+
72
+ expectTypeOf(ValidNestedMap.create<ValidNestedMap>)
73
+ .parameter(0)
74
+ .toEqualTypeOf<{
75
+ data: valueWithCoMarker<NestedInterface>;
76
+ }>();
77
+ });
78
+
79
+ it("should accept arrays of serializable types", async () => {
80
+ interface ArrayInterface {
81
+ numbers: number[];
82
+ objects: { id: number; name: string }[];
83
+ }
84
+
85
+ class ValidArrayMap extends CoMap {
86
+ data = co.json<ArrayInterface>();
87
+ }
88
+
89
+ expectTypeOf(ValidArrayMap.create<ValidArrayMap>)
90
+ .parameter(0)
91
+ .toEqualTypeOf<{
92
+ data: valueWithCoMarker<ArrayInterface>;
93
+ }>();
94
+ });
95
+
96
+ it("should flag interfaces with functions as invalid", async () => {
97
+ interface InvalidInterface {
98
+ func: () => void;
99
+ }
100
+
101
+ class InvalidFunctionMap extends CoMap {
102
+ // @ts-expect-error Should not be considered valid
103
+ data = co.json<InvalidInterface>();
104
+ }
105
+
106
+ expectTypeOf(InvalidFunctionMap.create<InvalidFunctionMap>)
107
+ .parameter(0)
108
+ .toEqualTypeOf<{
109
+ data: valueWithCoMarker<InvalidInterface>;
110
+ }>();
111
+ });
112
+
113
+ it("should flag types with functions as invalid", async () => {
114
+ type InvalidType = { func: () => void };
115
+
116
+ class InvalidFunctionMap extends CoMap {
117
+ // @ts-expect-error Should not be considered valid
118
+ data = co.json<InvalidType>();
119
+ }
120
+
121
+ expectTypeOf(InvalidFunctionMap.create<InvalidFunctionMap>)
122
+ .parameter(0)
123
+ .toEqualTypeOf<{
124
+ data: valueWithCoMarker<InvalidType>;
125
+ }>();
126
+ });
127
+
128
+ it("should flag types with non-serializable constructors as invalid", async () => {
129
+ type InvalidType = { date: Date; regexp: RegExp; symbol: symbol };
130
+
131
+ class InvalidFunctionMap extends CoMap {
132
+ // @ts-expect-error Should not be considered valid
133
+ data = co.json<InvalidType>();
134
+ }
135
+
136
+ expectTypeOf(InvalidFunctionMap.create<InvalidFunctionMap>)
137
+ .parameter(0)
138
+ .toEqualTypeOf<{
139
+ data: valueWithCoMarker<InvalidType>;
140
+ }>();
141
+ });
142
+
143
+ it("should apply the same validation to optional json", async () => {
144
+ type ValidType = {
145
+ value: string;
146
+ };
147
+
148
+ type InvalidType = {
149
+ value: () => string;
150
+ };
151
+
152
+ class MapWithOptionalJSON extends CoMap {
153
+ data = co.optional.json<ValidType>();
154
+ // @ts-expect-error Should not be considered valid
155
+ data2 = co.optional.json<InvalidType>();
156
+ }
157
+
158
+ expectTypeOf(MapWithOptionalJSON.create<MapWithOptionalJSON>)
159
+ .parameter(0)
160
+ .toEqualTypeOf<{
161
+ data?: valueWithCoMarker<ValidType> | null;
162
+ data2?: valueWithCoMarker<InvalidType> | null;
163
+ }>();
164
+ });
165
+
166
+ it("should not accept functions", async () => {
167
+ class InvalidFunctionMap extends CoMap {
168
+ // @ts-expect-error Should not be considered valid
169
+ data = co.json<() => void>();
170
+ }
171
+
172
+ expectTypeOf(InvalidFunctionMap.create<InvalidFunctionMap>)
173
+ .parameter(0)
174
+ .toEqualTypeOf<{
175
+ data: valueWithCoMarker<() => void>;
176
+ }>();
177
+ });
178
+
179
+ it("should not accept RegExp", async () => {
180
+ class InvalidFunctionMap extends CoMap {
181
+ // @ts-expect-error Should not be considered valid
182
+ data = co.json<RegExp>();
183
+ }
184
+
185
+ expectTypeOf(InvalidFunctionMap.create<InvalidFunctionMap>)
186
+ .parameter(0)
187
+ .toEqualTypeOf<{
188
+ data: valueWithCoMarker<RegExp>;
189
+ }>();
190
+ });
191
+
192
+ it("should accept strings and numbers", async () => {
193
+ class InvalidFunctionMap extends CoMap {
194
+ str = co.json<string>();
195
+ num = co.json<number>();
196
+ }
197
+
198
+ expectTypeOf(InvalidFunctionMap.create<InvalidFunctionMap>)
199
+ .parameter(0)
200
+ .toEqualTypeOf<{
201
+ str: valueWithCoMarker<string>;
202
+ num: valueWithCoMarker<number>;
203
+ }>();
204
+ });
205
205
  });