-
-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathtypes.js
727 lines (660 loc) · 22.9 KB
/
types.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils");
const typedArrayTypes = new Set([
"Int8Array", "Int16Array", "Int32Array", "Uint8Array", "Uint16Array", "Uint32Array",
"Uint8ClampedArray", "Float32Array", "Float64Array"
]);
const arrayBufferViewTypes = new Set([...typedArrayTypes, "DataView"]);
const bufferSourceTypes = new Set([...arrayBufferViewTypes, "ArrayBuffer"]);
const stringTypes = new Set(["DOMString", "ByteString", "USVString"]);
const integerTypes = new Set([
"byte", "octet", "short", "unsigned short", "long", "unsigned long",
"long long", "unsigned long long"
]);
const numericTypes = new Set([
...integerTypes, "float", "unrestricted float", "double", "unrestricted double"
]);
const resolvedMap = new WeakMap();
function mergeExtAttrs(a = [], b = []) {
return [...a, ...b];
}
// Types of types that generate an output file.
const resolvedTypes = new Set([
"callback",
"callback interface",
"dictionary",
"enumeration",
"interface",
"webidl2js:imported"
]);
function resolveType(ctx, idlType, stack = []) {
if (resolvedMap.has(idlType)) {
return resolvedMap.get(idlType);
}
const original = idlType;
idlType = deepClone(idlType);
resolvedMap.set(original, idlType);
if (idlType.union) {
const types = [];
for (let type of idlType.idlType) {
type = resolveType(ctx, type, stack);
idlType.nullable = idlType.nullable || type.nullable;
// Only the outermost union is nullable
type.nullable = false;
if (type.union) {
types.push(...type.idlType);
} else {
types.push(type);
}
}
for (const type of types) {
type.extAttrs = deepClone(mergeExtAttrs(type.extAttrs, idlType.extAttrs));
}
idlType.idlType = types;
return idlType;
} else if (idlType.generic) {
idlType.idlType = idlType.idlType.map(t => resolveType(ctx, t, stack));
return idlType;
} else if (resolvedTypes.has(ctx.typeOf(idlType.idlType))) {
// already resolved
return idlType;
} else if (ctx.typedefs.has(idlType.idlType)) {
const out = deepClone(ctx.typedefs.get(idlType.idlType).resolve(stack));
resolvedMap.set(original, out);
out.nullable = out.nullable || idlType.nullable;
out.extAttrs = deepClone(mergeExtAttrs(out.extAttrs, idlType.extAttrs));
if (out.union) {
for (const type of out.idlType) {
type.extAttrs = deepClone(mergeExtAttrs(type.extAttrs, idlType.extAttrs));
}
}
return out;
} else if (conversions[idlType.idlType]) {
// already resolved
return idlType;
}
// unknown
return idlType;
}
function deepClone(obj) {
return JSON.parse(JSON.stringify(obj));
}
function generateTypeConversion(ctx, name, idlType, argAttrs = [], parentName, errPrefix = '"The provided value"') {
const requires = new utils.RequiresMap(ctx);
let str = "";
idlType = resolveType(ctx, idlType);
const extAttrs = idlType.extAttrs !== undefined ? [...idlType.extAttrs, ...argAttrs] : argAttrs;
if (idlType.nullable) {
const callbackFunction = ctx.callbackFunctions.get(idlType.idlType);
if (callbackFunction !== undefined && callbackFunction.legacyTreatNonObjectAsNull) {
str += `
if (!utils.isObject(${name})) {
${name} = null;
} else {
`;
} else {
str += `
if (${name} === null || ${name} === undefined) {
${name} = null;
} else {
`;
}
}
let typeKind;
if (idlType.union) {
// union type
generateUnion();
} else if (idlType.generic === "sequence") {
// sequence type
generateSequence();
} else if (idlType.generic === "record") {
// record type
generateRecord();
} else if (idlType.generic === "Promise") {
// Promise type
generatePromise();
} else if (idlType.generic === "FrozenArray") {
// frozen array type
generateFrozenArray();
} else if (
// TODO: Revert once `Function` and `VoidFunction` are removed from `webidl-conversions`:
idlType.idlType !== "Function" &&
idlType.idlType !== "VoidFunction" &&
conversions[idlType.idlType]
) {
// string or number type compatible with webidl-conversions
generateGeneric(`conversions["${idlType.idlType}"]`);
} else if (resolvedTypes.has(typeKind = ctx.typeOf(idlType.idlType))) {
// callback functions, callback interfaces, dictionaries, enumerations, and interfaces
let fn;
// Avoid requiring the interface itself
if (idlType.idlType !== parentName) {
// webidl2js:imported types can't use `convert`, as we'd have no way
// to convert them back to their wrappers.
if (typeKind === "webidl2js:imported") {
const { path, property } = ctx.importedTypes.get(idlType.idlType);
fn = `${requires.add(path, property)}.validate`;
} else {
fn = `${idlType.idlType}.convert`;
requires.addRelative(idlType.idlType);
}
} else {
fn = `exports.convert`;
}
generateGeneric(fn);
} else {
// unknown
// Try to get the impl anyway.
str += `
${name} = utils.tryImplForWrapper(${name});
`;
}
if (idlType.nullable) {
str += "}";
}
return {
requires,
body: str
};
function generateUnion() {
const union = extractUnionInfo(ctx, idlType, errPrefix);
const output = [];
if (union.unknown) {
// Oh well, what do we know...
str += `${name} = utils.tryImplForWrapper(${name});`;
return;
}
if (!idlType.nullable && union.dictionary) {
const conv = generateTypeConversion(ctx, name, union.dictionary, [], parentName, errPrefix);
requires.merge(conv.requires);
output.push(`
if (${name} === null || ${name} === undefined) {
${conv.body}
}
`);
}
if (union.object) {
output.push(`if (utils.isObject(${name}) && ${name}[utils.implSymbol]) {
${name} = utils.implForWrapper(${name});
}`);
} else if (union.interfaces.size > 0) {
const exprs = [...union.interfaces].map(iface => {
let fn;
// Avoid requiring the interface itself
if (iface !== parentName) {
fn = `${iface}.is`;
requires.addRelative(iface);
} else {
fn = "exports.is";
}
return `${fn}(${name})`;
});
output.push(`
if (${exprs.join(" || ")}) {
${name} = utils.implForWrapper(${name});
}
`);
}
// Do not convert buffer source types as the impl code can either "get a reference" or "get a copy" to the bytes.
if (union.ArrayBuffer || union.object) {
output.push(`if (utils.isArrayBuffer(${name})) {}`);
}
if (union.ArrayBufferViews.size > 0 || union.object) {
let condition = `ArrayBuffer.isView(${name})`;
// Skip specific type check if all ArrayBufferView member types are allowed.
if (union.ArrayBufferViews.size !== arrayBufferViewTypes.size) {
const exprs = [...union.ArrayBufferViews].map(a => `${name}.constructor.name === "${a}"`);
condition += ` && (${exprs.join(" || ")})`;
}
output.push(`if (${condition}) {}`);
}
if (union.callbackFunction || union.object) {
let code = `if (typeof ${name} === "function") {`;
if (union.callbackFunction) {
const conv = generateTypeConversion(ctx, name, union.callbackFunction, [], parentName,
`${errPrefix} + " callback function"`);
requires.merge(conv.requires);
code += conv.body;
} else if (union.object) {
// noop
}
code += "}";
output.push(code);
}
if (union.sequenceLike || union.dictionary || union.record || union.object || union.callbackInterface) {
let code = `if (utils.isObject(${name})) {`;
if (union.sequenceLike) {
code += `if (${name}[Symbol.iterator] !== undefined) {`;
const conv = generateTypeConversion(ctx, name, union.sequenceLike, [], parentName,
`${errPrefix} + " sequence"`);
requires.merge(conv.requires);
code += conv.body;
code += `} else {`;
}
if (union.dictionary) {
const conv = generateTypeConversion(ctx, name, union.dictionary, [], parentName,
`${errPrefix} + " dictionary"`);
requires.merge(conv.requires);
code += conv.body;
} else if (union.record) {
const conv = generateTypeConversion(ctx, name, union.record, [], parentName,
`${errPrefix} + " record"`);
requires.merge(conv.requires);
code += conv.body;
} else if (union.callbackInterface) {
const conv = generateTypeConversion(ctx, name, union.callbackInterface, [], parentName,
`${errPrefix} + " callback interface"`);
requires.merge(conv.requires);
code += conv.body;
} else if (union.object) {
// noop
}
if (union.sequenceLike) {
code += "}";
}
code += "}";
output.push(code);
}
if (union.boolean) {
output.push(`
if (typeof ${name} === "boolean") {
${generateTypeConversion(ctx, name, union.boolean, [], parentName, errPrefix).body}
}
`);
}
if (union.numeric) {
output.push(`
if (typeof ${name} === "number") {
${generateTypeConversion(ctx, name, union.numeric, [], parentName, errPrefix).body}
}
`);
}
{
let code = "{";
const type = union.string || union.numeric || union.boolean;
if (type) {
const conv = generateTypeConversion(ctx, name, type, [], parentName, errPrefix);
code += conv.body;
requires.merge(conv.requires);
} else {
code += `throw new TypeError(${errPrefix} + " is not of any supported type.")`;
}
code += "}";
output.push(code);
}
str += output.join(" else ");
}
function generateSequence() {
const conv = generateTypeConversion(ctx, "nextItem", idlType.idlType[0], [], parentName,
`${errPrefix} + "'s element"`);
requires.merge(conv.requires);
str += `
if (!utils.isObject(${name})) {
throw new TypeError(${errPrefix} + " is not an iterable object.");
} else {
const V = [];
const tmp = ${name};
for (let nextItem of tmp) {
${conv.body}
V.push(nextItem);
}
${name} = V;
}
`;
}
function generateRecord() {
const keyConv = generateTypeConversion(ctx, "typedKey", idlType.idlType[0], [], parentName,
`${errPrefix} + "'s key"`);
requires.merge(keyConv.requires);
const valConv = generateTypeConversion(ctx, "typedValue", idlType.idlType[1], [], parentName,
`${errPrefix} + "'s value"`);
requires.merge(valConv.requires);
str += `
if (!utils.isObject(${name})) {
throw new TypeError(${errPrefix} + " is not an object.");
} else {
const result = Object.create(null);
for (const key of Reflect.ownKeys(${name})) {
const desc = Object.getOwnPropertyDescriptor(${name}, key);
if (desc && desc.enumerable) {
let typedKey = key;
${keyConv.body}
let typedValue = ${name}[key];
${valConv.body}
result[typedKey] = typedValue;
}
}
${name} = result;
}
`;
}
function generatePromise() {
str += `${name} = new Promise(resolve => resolve(${name}));`;
}
function generateFrozenArray() {
generateSequence();
str += `${name} = Object.freeze(${name});`;
}
function generateGeneric(conversionFn) {
const enforceRange = utils.getExtAttr(extAttrs, "EnforceRange");
const clamp = utils.getExtAttr(extAttrs, "Clamp");
const nullToEmptyString = utils.getExtAttr(extAttrs, "LegacyNullToEmptyString");
let optString = `context: ${errPrefix},`;
if (clamp) {
optString += "clamp: true,";
}
if (enforceRange) {
optString += "enforceRange: true,";
}
if (nullToEmptyString) {
optString += "treatNullAsEmptyString: true,";
}
if (idlType.array) {
str += `
for (let i = 0; i < ${name}.length; ++i) {
${name}[i] = ${conversionFn}(${name}[i], { ${optString} });
}
`;
} else {
str += `
${name} = ${conversionFn}(${name}, { ${optString} });
`;
}
}
}
// Condense the member types of a union to a more consumable structured object. At the same time, check for the validity
// of the union type (no forbidden types, no indistinguishable member types). Duplicated types are allowed for now
// though.
function extractUnionInfo(ctx, idlType, errPrefix) {
const seen = {
sequenceLike: null,
record: null,
get dictionaryLike() {
return this.dictionary !== null || this.record !== null || this.callbackInterface !== null;
},
ArrayBuffer: false,
ArrayBufferViews: new Set(),
get BufferSource() {
return this.ArrayBuffer || this.ArrayBufferViews.size > 0;
},
object: false,
string: null,
numeric: null,
boolean: null,
callbackFunction: null,
dictionary: null,
callbackInterface: null,
interfaces: new Set(),
get interfaceLike() {
return this.interfaces.size > 0 || this.BufferSource;
},
unknown: false
};
for (const item of idlType.idlType) {
if (item.generic === "sequence" || item.generic === "FrozenArray") {
if (seen.sequenceLike) {
error("There can only be one sequence-like type in a union type");
}
seen.sequenceLike = item;
} else if (item.generic === "record") {
if (seen.object) {
error("Dictionary-like types are not distinguishable with object type");
}
if (seen.callbackFunction) {
error("Dictionary-like types are not distinguishable with callback functions");
}
if (seen.dictionaryLike) {
error("There can only be one dictionary-like type in a union type");
}
seen.record = item;
} else if (item.generic === "Promise") {
error("Promise types are not supported in union types");
} else if (item.generic) {
error(`Unknown generic type ${item.generic}`);
} else if (item.idlType === "any") {
error("any type is not allowed in a union type");
} else if (item.idlType === "ArrayBuffer") {
if (seen.object) {
error("ArrayBuffer is not distinguishable with object type");
}
seen.ArrayBuffer = true;
} else if (arrayBufferViewTypes.has(item.idlType)) {
if (seen.object) {
error(`${item.idlType} is not distinguishable with object type`);
}
seen.ArrayBufferViews.add(item.idlType);
} else if (stringTypes.has(item.idlType) || ctx.enumerations.has(item.idlType)) {
if (seen.string) {
error("There can only be one string type in a union type");
}
seen.string = item;
} else if (numericTypes.has(item.idlType)) {
if (seen.numeric) {
error("There can only be one numeric type in a union type");
}
seen.numeric = item;
} else if (item.idlType === "object") {
if (seen.interfaceLike) {
error("Object type is not distinguishable with interface-like types");
}
if (seen.callbackFunction) {
error("Object type is not distinguishable with callback functions");
}
if (seen.dictionaryLike) {
error("Object type is not distinguishable with dictionary-like types");
}
if (seen.sequenceLike) {
error("Object type is not distinguishable with sequence-like types");
}
seen.object = true;
} else if (item.idlType === "boolean") {
seen.boolean = item;
} else if (ctx.callbackFunctions.has(item.idlType)) {
if (seen.object) {
error("Callback functions are not distinguishable with object type");
}
if (seen.dictionaryLike) {
error("Callback functions are not distinguishable with dictionary-like types");
}
seen.callbackFunction = item.idlType;
} else if (ctx.dictionaries.has(item.idlType)) {
if (seen.object) {
error("Dictionary-like types are not distinguishable with object type");
}
if (seen.callbackFunction) {
error("Dictionary-like types are not distinguishable with callback functions");
}
if (seen.dictionaryLike) {
error("There can only be one dictionary-like type in a union type");
}
seen.dictionary = item;
} else if (ctx.callbackInterfaces.has(item.idlType)) {
if (seen.object) {
error("Dictionary-like types are not distinguishable with object type");
}
if (seen.callbackFunction) {
error("Dictionary-like types are not distinguishable with callback functions");
}
if (seen.dictionaryLike) {
error("There can only be one dictionary-like type in a union type");
}
seen.callbackInterface = item.idlType;
} else if (ctx.interfaces.has(item.idlType)) {
if (seen.object) {
error("Interface types are not distinguishable with object type");
}
seen.interfaces.add(item.idlType);
} else {
seen.unknown = true;
}
}
return seen;
function error(msg) {
throw new Error(`${msg}\n When compiling "${eval(errPrefix)}"`); // eslint-disable-line no-eval
}
}
// https://heycam.github.io/webidl/#dfn-includes-a-nullable-type
function includesNullableType(ctx, idlType) {
idlType = resolveType(ctx, idlType);
if (idlType.nullable) {
return true;
}
if (!idlType.union) {
return false;
}
for (const type of idlType.idlType) {
if (type.nullable) {
return true;
}
}
return false;
}
function includesDictionaryType(ctx, idlType) {
idlType = resolveType(ctx, idlType);
if (typeof idlType.idlType === "string" && ctx.dictionaries.has(idlType.idlType)) {
return true;
}
if (!idlType.union) {
return false;
}
for (const type of idlType.idlType) {
if (includesDictionaryType(ctx, type)) {
return true;
}
}
return false;
}
function sameType(ctx, type1, type2) {
if (type1 === type2) {
return true;
}
type1 = resolveType(ctx, type1);
type2 = resolveType(ctx, type2);
if (type1.generic !== type2.generic) {
return false;
}
if (type1.union !== type2.union) {
return false;
}
if (includesNullableType(ctx, type1) !== includesNullableType(ctx, type2)) {
return false;
}
// TODO: check extended attributes
if (typeof type1.idlType === "string" || typeof type2.idlType === "string") {
return type1.idlType === type2.idlType;
}
if (type1.generic === "sequence" || type1.generic === "FrozenArray") {
return sameType(ctx, type1.idlType, type2.idlType);
}
if (type1.generic === "record") {
return sameType(ctx, type1.idlType[0], type2.idlType[0]) &&
sameType(ctx, type2.idlType[1], type2.idlType[1]);
}
if (!type1.union) {
// This branch should never be taken.
return false;
}
const extracted1 = extractUnionInfo(ctx, type1, `""`);
const extracted2 = extractUnionInfo(ctx, type2, `""`);
return sameType(ctx, extracted1.sequenceLike, extracted2.sequenceLike) &&
sameType(ctx, extracted1.record, extracted2.record) &&
extracted1.ArrayBuffer !== extracted2.ArrayBuffer &&
JSON.stringify([...extracted1.ArrayBufferViews].sort()) ===
JSON.stringify([...extracted2.ArrayBufferViews].sort()) &&
extracted1.object === extracted2.object &&
sameType(ctx, extracted1.string, extracted2.string) &&
sameType(ctx, extracted1.numeric, extracted2.numeric) &&
sameType(ctx, extracted1.boolean, extracted2.boolean) &&
extracted1.callback === extracted2.callback &&
sameType(ctx, extracted1.dictionary, extracted2.dictionary) &&
JSON.stringify([...extracted1.interfaces].sort()) ===
JSON.stringify([...extracted2.interfaces].sort()) &&
extracted1.callbackInterface === extracted2.callbackInterface &&
extracted1.unknown === extracted2.unknown;
}
function areDistinguishable(ctx, type1, type2) {
const resolved1 = resolveType(ctx, type1);
const resolved2 = resolveType(ctx, type2);
const effectivelyNullable1 = includesNullableType(ctx, resolved1) || includesDictionaryType(ctx, resolved1);
const effectivelyNullable2 = includesNullableType(ctx, resolved2) || includesDictionaryType(ctx, resolved2);
if (includesNullableType(ctx, resolved1) && effectivelyNullable2 ||
effectivelyNullable1 && includesNullableType(ctx, resolved2)) {
return false;
}
if (resolved1.union && resolved2.union) {
for (const i of resolved1.idlType) {
for (const j of resolved2.idlType) {
if (!areDistinguishable(ctx, i, j)) {
return false;
}
}
}
return true;
}
function inner(inner1, inner2) {
if (inner1.union) {
for (const i of inner1.idlType) {
if (!areDistinguishable(ctx, i, inner2)) {
return false;
}
}
return true;
}
if (inner1.idlType === "boolean") {
return inner2.idlType !== "boolean";
}
if (numericTypes.has(inner1.idlType)) {
return !numericTypes.has(inner2.idlType);
}
if (stringTypes.has(inner1.idlType) || ctx.enumerations.has(inner1.idlType)) {
return !stringTypes.has(inner2.idlType) && !ctx.enumerations.has(inner2.idlType);
}
const isInterfaceLike1 = ctx.interfaces.has(inner1.idlType) ||
bufferSourceTypes.has(inner1.idlType);
const isInterfaceLike2 = ctx.interfaces.has(inner2.idlType) ||
bufferSourceTypes.has(inner2.idlType);
const isDictionaryLike1 = ctx.dictionaries.has(inner1.idlType) ||
ctx.callbackInterfaces.has(inner1.idlType) ||
inner1.generic === "record";
const isDictionaryLike2 = ctx.dictionaries.has(inner2.idlType) ||
ctx.callbackInterfaces.has(inner2.idlType) ||
inner2.generic === "record";
const isSequenceLike1 = inner1.generic === "sequence" || inner1.generic === "FrozenArray";
const isSequenceLike2 = inner2.generic === "sequence" || inner2.generic === "FrozenArray";
if (inner1.idlType === "object") {
return inner2.idlType !== "object" &&
!isInterfaceLike2 &&
!isDictionaryLike2 &&
!isSequenceLike2;
}
if (inner1.idlType === "symbol") {
return inner2.idlType !== "symbol";
}
if (isInterfaceLike1) {
return inner2.idlType !== "object" &&
(!isInterfaceLike2 ||
(!ctx.interfaces.has(inner2.idlType) ||
!new Set(ctx.interfaces.get(inner2.idlType).allInterfaces()).has(inner1.idlType)));
}
if (isDictionaryLike1) {
return inner2.idlType !== "object" && !isDictionaryLike2;
}
if (isSequenceLike1) {
return inner2.idlType !== "object" && !isSequenceLike2;
}
return true;
}
return inner(resolved1, resolved2) && inner(resolved2, resolved1);
}
module.exports = {
arrayBufferViewTypes,
stringTypes,
numericTypes,
generateTypeConversion,
resolveType,
includesNullableType,
includesDictionaryType,
areDistinguishable,
sameType
};