@markuplint/types 3.0.0-canary.5 → 3.0.0-dev.176

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/README.md +1 -1
  2. package/lib/check-multi-types.d.ts +4 -1
  3. package/lib/check-multi-types.js +5 -4
  4. package/lib/check.d.ts +6 -5
  5. package/lib/check.spec.js +64 -58
  6. package/lib/css-syntax.js +49 -47
  7. package/lib/css-syntax.spec.js +152 -149
  8. package/lib/defs.js +2 -2
  9. package/lib/enum.d.ts +2 -1
  10. package/lib/enum.js +1 -1
  11. package/lib/get-candidate.d.ts +4 -1
  12. package/lib/keyword-type.js +3 -2
  13. package/lib/list.d.ts +2 -1
  14. package/lib/list.js +2 -1
  15. package/lib/list.spec.js +118 -117
  16. package/lib/match-result.d.ts +21 -8
  17. package/lib/match-result.js +2 -1
  18. package/lib/number.d.ts +1 -1
  19. package/lib/primitive/index.spec.js +53 -52
  20. package/lib/primitive/is-quantity.d.ts +5 -1
  21. package/lib/primitive/is-uint.d.ts +6 -3
  22. package/lib/primitive/split-unit.d.ts +2 -2
  23. package/lib/primitive/split-unit.js +2 -2
  24. package/lib/rfc/is-bcp-47.spec.js +9 -8
  25. package/lib/token/token-collection.d.ts +71 -56
  26. package/lib/token/token-collection.js +30 -23
  27. package/lib/token/token-collection.spec.js +156 -134
  28. package/lib/token/token.d.ts +58 -52
  29. package/lib/token/token.js +19 -20
  30. package/lib/token/types.d.ts +3 -0
  31. package/lib/token/types.js +2 -0
  32. package/lib/types.d.ts +79 -55
  33. package/lib/types.schema.d.ts +1084 -31
  34. package/lib/w3c/check-serialized-permissions-policy.spec.js +30 -28
  35. package/lib/whatwg/check-autocomplete.js +6 -6
  36. package/lib/whatwg/check-autocomplete.spec.js +361 -360
  37. package/lib/whatwg/check-datetime/datetime-tokens.d.ts +21 -1
  38. package/lib/whatwg/check-datetime/datetime-tokens.js +9 -6
  39. package/lib/whatwg/check-datetime/duration-string.js +12 -2
  40. package/lib/whatwg/check-datetime/index.spec.js +277 -276
  41. package/lib/whatwg/check-datetime/local-date-and-time-string.js +6 -2
  42. package/lib/whatwg/check-datetime/time-zone-offset-string.d.ts +1 -1
  43. package/lib/whatwg/check-datetime/time-zone-offset-string.js +3 -2
  44. package/lib/whatwg/check-mime-type.d.ts +4 -4
  45. package/lib/whatwg/check-mime-type.js +1 -1
  46. package/lib/whatwg/check-mime-type.spec.js +53 -52
  47. package/lib/whatwg/is-abs-url.spec.js +6 -5
  48. package/lib/whatwg/is-itemprop-name.js +1 -1
  49. package/package.json +12 -10
  50. package/{src/check.spec.ts → test/check.spec.js} +7 -1
  51. package/{src/css-syntax.spec.ts → test/css-syntax.spec.js} +10 -12
  52. package/{src/list.spec.ts → test/list.spec.js} +7 -7
  53. package/{src/primitive/index.spec.ts → test/primitive/index.spec.js} +1 -1
  54. package/{src/rfc/is-bcp-47.spec.ts → test/rfc/is-bcp-47.spec.js} +1 -1
  55. package/{src/token/token-collection.spec.ts → test/token/token-collection.spec.js} +2 -3
  56. package/{src/w3c/check-serialized-permissions-policy.spec.ts → test/w3c/check-serialized-permissions-policy.spec.js} +1 -3
  57. package/{src/whatwg/check-autocomplete.spec.ts → test/whatwg/check-autocomplete.spec.js} +1 -1
  58. package/{src/whatwg/check-datetime/index.spec.ts → test/whatwg/check-datetime/index.spec.js} +18 -15
  59. package/{src/whatwg/check-mime-type.spec.ts → test/whatwg/check-mime-type.spec.js} +1 -1
  60. package/{src/whatwg/is-abs-url.spec.ts → test/whatwg/is-abs-url.spec.js} +1 -1
  61. package/types.schema.json +369 -318
  62. package/gen/specific-schema.json +0 -98
  63. package/gen/types.ts +0 -66
  64. package/src/check-multi-types.ts +0 -35
  65. package/src/check.ts +0 -48
  66. package/src/css-syntax.ts +0 -188
  67. package/src/debug.ts +0 -3
  68. package/src/defs.ts +0 -811
  69. package/src/enum.ts +0 -25
  70. package/src/get-candidate.ts +0 -24
  71. package/src/index.ts +0 -3
  72. package/src/keyword-type.ts +0 -64
  73. package/src/list.ts +0 -34
  74. package/src/match-result.ts +0 -49
  75. package/src/number.ts +0 -46
  76. package/src/primitive/index.ts +0 -7
  77. package/src/primitive/is-float.ts +0 -8
  78. package/src/primitive/is-int.ts +0 -8
  79. package/src/primitive/is-non-zero-uint.ts +0 -8
  80. package/src/primitive/is-quantity.ts +0 -38
  81. package/src/primitive/is-uint.ts +0 -15
  82. package/src/primitive/range.ts +0 -14
  83. package/src/primitive/split-unit.ts +0 -20
  84. package/src/rfc/is-bcp-47.ts +0 -13
  85. package/src/token/index.ts +0 -2
  86. package/src/token/token-collection.ts +0 -444
  87. package/src/token/token.ts +0 -144
  88. package/src/types.schema.ts +0 -1062
  89. package/src/types.ts +0 -118
  90. package/src/w3c/check-serialized-permissions-policy.ts +0 -303
  91. package/src/whatwg/check-autocomplete.ts +0 -380
  92. package/src/whatwg/check-datetime/date-string.ts +0 -44
  93. package/src/whatwg/check-datetime/datetime-tokens.ts +0 -600
  94. package/src/whatwg/check-datetime/duration-string.ts +0 -399
  95. package/src/whatwg/check-datetime/global-date-and-time-string.ts +0 -96
  96. package/src/whatwg/check-datetime/index.ts +0 -36
  97. package/src/whatwg/check-datetime/local-date-and-time-string.ts +0 -163
  98. package/src/whatwg/check-datetime/month-string.ts +0 -31
  99. package/src/whatwg/check-datetime/time-string.ts +0 -49
  100. package/src/whatwg/check-datetime/time-zone-offset-string.ts +0 -93
  101. package/src/whatwg/check-datetime/week-string.ts +0 -41
  102. package/src/whatwg/check-datetime/year-string.ts +0 -26
  103. package/src/whatwg/check-datetime/yearless-date-string.ts +0 -38
  104. package/src/whatwg/check-mime-type.ts +0 -46
  105. package/src/whatwg/is-abs-url.ts +0 -31
  106. package/src/whatwg/is-browser-context-name.ts +0 -16
  107. package/src/whatwg/is-custom-element-name.ts +0 -76
  108. package/src/whatwg/is-itemprop-name.ts +0 -17
  109. package/tsconfig.test.json +0 -3
  110. package/tsconfig.tsbuildinfo +0 -1
@@ -1,157 +1,160 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const css_syntax_1 = require("./css-syntax");
1
+ 'use strict';
2
+ // @ts-nocheck
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+ const css_syntax_1 = require('./css-syntax');
4
5
  test('CSS Standard', () => {
5
- expect((0, css_syntax_1.cssSyntaxMatch)('10px', '<length>').matched).toBe(true);
6
- expect((0, css_syntax_1.cssSyntaxMatch)('one-pixel', '<length>').matched).toBe(false);
7
- expect((0, css_syntax_1.cssSyntaxMatch)('(prefers-color-scheme: dark)', '<media-query-list>').matched).toBe(true);
6
+ expect((0, css_syntax_1.cssSyntaxMatch)('10px', '<length>').matched).toBe(true);
7
+ expect((0, css_syntax_1.cssSyntaxMatch)('one-pixel', '<length>').matched).toBe(false);
8
+ expect((0, css_syntax_1.cssSyntaxMatch)('(prefers-color-scheme: dark)', '<media-query-list>').matched).toBe(true);
8
9
  });
9
10
  test('Extends', () => {
10
- const sourceSizeList = {
11
- ref: 'https://html.spec.whatwg.org/multipage/images.html#sizes-attributes',
12
- syntax: {
13
- apply: '<source-size-list>',
14
- def: {
15
- 'source-size-list': '[ <source-size># , ]? <source-size-value>',
16
- 'source-size': '<media-condition> <source-size-value>',
17
- 'source-size-value': '<length>',
18
- },
19
- },
20
- };
21
- expect((0, css_syntax_1.cssSyntaxMatch)('50vw', sourceSizeList).matched).toBe(true);
22
- expect((0, css_syntax_1.cssSyntaxMatch)('(max-width: 600px) 200px, 50vw', sourceSizeList).matched).toBe(true);
23
- expect((0, css_syntax_1.cssSyntaxMatch)('print 300vw', sourceSizeList).matched).toBe(false);
24
- expect((0, css_syntax_1.cssSyntaxMatch)('(max-width: 600px) 200px', sourceSizeList).matched).toBe(false);
25
- expect((0, css_syntax_1.cssSyntaxMatch)('(max-width: 600px) 200px', {
26
- ...sourceSizeList,
27
- syntax: {
28
- ...sourceSizeList.syntax,
29
- apply: '<source-size>',
30
- },
31
- }).matched).toBe(true);
32
- const keyTimes = {
33
- ref: 'https://svgwg.org/specs/animations/#KeyTimesAttribute',
34
- syntax: {
35
- apply: '<key-times>',
36
- def: {
37
- 'key-times': '<number> [; <number>]* [;]?',
38
- },
39
- },
40
- };
41
- expect((0, css_syntax_1.cssSyntaxMatch)('20; 20; 30', keyTimes).matched).toBe(true);
42
- expect((0, css_syntax_1.cssSyntaxMatch)('20; 20; 30;', keyTimes).matched).toBe(true);
43
- expect((0, css_syntax_1.cssSyntaxMatch)('20; 20; abc;', keyTimes).matched).toBe(false);
44
- expect((0, css_syntax_1.cssSyntaxMatch)('20; 20; ;', keyTimes).matched).toBe(false);
45
- const SVGViewBox = {
46
- ref: 'https://svgwg.org/svg2-draft/coords.html#ViewBoxAttribute',
47
- syntax: {
48
- apply: '<view-box>',
49
- def: {
50
- 'view-box': '<min-x> [,]? <min-y> [,]? <width> [,]? <height>',
51
- 'min-x': '<number>',
52
- 'min-y': '<number>',
53
- width: '<number>',
54
- height: '<number>',
55
- },
56
- },
57
- };
58
- expect((0, css_syntax_1.cssSyntaxMatch)('0 0 30 10', SVGViewBox).matched).toBe(true);
59
- expect((0, css_syntax_1.cssSyntaxMatch)('0 0, 30, 10', SVGViewBox).matched).toBe(true);
60
- expect((0, css_syntax_1.cssSyntaxMatch)('0 0, 30', SVGViewBox).matched).toBe(false);
61
- const percentageList = {
62
- ref: 'https://developer.mozilla.org/en-US/docs/Web/SVG/Content_type#percentage',
63
- syntax: {
64
- apply: '<percentage-list>',
65
- def: {
66
- 'percentage-list': '[ <number> [,]? ]* <number>',
67
- },
68
- },
69
- };
70
- expect((0, css_syntax_1.cssSyntaxMatch)('0 0 30 10', percentageList).matched).toBe(true);
71
- expect((0, css_syntax_1.cssSyntaxMatch)('0, 0, 30 10', percentageList).matched).toBe(true);
72
- expect((0, css_syntax_1.cssSyntaxMatch)('0', percentageList).matched).toBe(true);
73
- expect((0, css_syntax_1.cssSyntaxMatch)('', percentageList).matched).toBe(false);
74
- const custom = {
75
- ref: 'n/a',
76
- syntax: {
77
- apply: '<custom>',
78
- def: {
79
- custom: '0 | 1 | .',
80
- },
81
- },
82
- };
83
- expect((0, css_syntax_1.cssSyntaxMatch)('0', custom).matched).toBe(true);
84
- expect((0, css_syntax_1.cssSyntaxMatch)('1', custom).matched).toBe(true);
85
- expect((0, css_syntax_1.cssSyntaxMatch)('.', custom).matched).toBe(true);
86
- expect((0, css_syntax_1.cssSyntaxMatch)('2', custom).matched).toBe(false);
87
- expect((0, css_syntax_1.cssSyntaxMatch)(':', custom).matched).toBe(false);
11
+ const sourceSizeList = {
12
+ ref: 'https://html.spec.whatwg.org/multipage/images.html#sizes-attributes',
13
+ syntax: {
14
+ apply: '<source-size-list>',
15
+ def: {
16
+ 'source-size-list': '[ <source-size># , ]? <source-size-value>',
17
+ 'source-size': '<media-condition> <source-size-value>',
18
+ 'source-size-value': '<length>',
19
+ },
20
+ },
21
+ };
22
+ expect((0, css_syntax_1.cssSyntaxMatch)('50vw', sourceSizeList).matched).toBe(true);
23
+ expect((0, css_syntax_1.cssSyntaxMatch)('(max-width: 600px) 200px, 50vw', sourceSizeList).matched).toBe(true);
24
+ expect((0, css_syntax_1.cssSyntaxMatch)('print 300vw', sourceSizeList).matched).toBe(false);
25
+ expect((0, css_syntax_1.cssSyntaxMatch)('(max-width: 600px) 200px', sourceSizeList).matched).toBe(false);
26
+ expect(
27
+ (0, css_syntax_1.cssSyntaxMatch)('(max-width: 600px) 200px', {
28
+ ...sourceSizeList,
29
+ syntax: {
30
+ ...sourceSizeList.syntax,
31
+ apply: '<source-size>',
32
+ },
33
+ }).matched,
34
+ ).toBe(true);
35
+ const keyTimes = {
36
+ ref: 'https://svgwg.org/specs/animations/#KeyTimesAttribute',
37
+ syntax: {
38
+ apply: '<key-times>',
39
+ def: {
40
+ 'key-times': '<number> [; <number>]* [;]?',
41
+ },
42
+ },
43
+ };
44
+ expect((0, css_syntax_1.cssSyntaxMatch)('20; 20; 30', keyTimes).matched).toBe(true);
45
+ expect((0, css_syntax_1.cssSyntaxMatch)('20; 20; 30;', keyTimes).matched).toBe(true);
46
+ expect((0, css_syntax_1.cssSyntaxMatch)('20; 20; abc;', keyTimes).matched).toBe(false);
47
+ expect((0, css_syntax_1.cssSyntaxMatch)('20; 20; ;', keyTimes).matched).toBe(false);
48
+ const SVGViewBox = {
49
+ ref: 'https://svgwg.org/svg2-draft/coords.html#ViewBoxAttribute',
50
+ syntax: {
51
+ apply: '<view-box>',
52
+ def: {
53
+ 'view-box': '<min-x> [,]? <min-y> [,]? <width> [,]? <height>',
54
+ 'min-x': '<number>',
55
+ 'min-y': '<number>',
56
+ width: '<number>',
57
+ height: '<number>',
58
+ },
59
+ },
60
+ };
61
+ expect((0, css_syntax_1.cssSyntaxMatch)('0 0 30 10', SVGViewBox).matched).toBe(true);
62
+ expect((0, css_syntax_1.cssSyntaxMatch)('0 0, 30, 10', SVGViewBox).matched).toBe(true);
63
+ expect((0, css_syntax_1.cssSyntaxMatch)('0 0, 30', SVGViewBox).matched).toBe(false);
64
+ const percentageList = {
65
+ ref: 'https://developer.mozilla.org/en-US/docs/Web/SVG/Content_type#percentage',
66
+ syntax: {
67
+ apply: '<percentage-list>',
68
+ def: {
69
+ 'percentage-list': '[ <number> [,]? ]* <number>',
70
+ },
71
+ },
72
+ };
73
+ expect((0, css_syntax_1.cssSyntaxMatch)('0 0 30 10', percentageList).matched).toBe(true);
74
+ expect((0, css_syntax_1.cssSyntaxMatch)('0, 0, 30 10', percentageList).matched).toBe(true);
75
+ expect((0, css_syntax_1.cssSyntaxMatch)('0', percentageList).matched).toBe(true);
76
+ expect((0, css_syntax_1.cssSyntaxMatch)('', percentageList).matched).toBe(false);
77
+ const custom = {
78
+ ref: 'n/a',
79
+ syntax: {
80
+ apply: '<custom>',
81
+ def: {
82
+ custom: '0 | 1 | .',
83
+ },
84
+ },
85
+ };
86
+ expect((0, css_syntax_1.cssSyntaxMatch)('0', custom).matched).toBe(true);
87
+ expect((0, css_syntax_1.cssSyntaxMatch)('1', custom).matched).toBe(true);
88
+ expect((0, css_syntax_1.cssSyntaxMatch)('.', custom).matched).toBe(true);
89
+ expect((0, css_syntax_1.cssSyntaxMatch)('2', custom).matched).toBe(false);
90
+ expect((0, css_syntax_1.cssSyntaxMatch)(':', custom).matched).toBe(false);
88
91
  });
89
92
  test('custom-type-checking', () => {
90
- const custom = {
91
- ref: 'n/a',
92
- caseSensitive: true,
93
- syntax: {
94
- apply: '<custom>',
95
- def: {
96
- custom: '<custom-type>',
97
- 'custom-type': token => {
98
- if (!token) {
99
- return 0;
100
- }
101
- return token.value === '1' ? 1 : 0;
102
- },
103
- },
104
- },
105
- };
106
- expect((0, css_syntax_1.cssSyntaxMatch)('1', custom).matched).toBe(true);
107
- expect((0, css_syntax_1.cssSyntaxMatch)('0', custom).matched).toBe(false);
93
+ const custom = {
94
+ ref: 'n/a',
95
+ caseSensitive: true,
96
+ syntax: {
97
+ apply: '<custom>',
98
+ def: {
99
+ custom: '<custom-type>',
100
+ 'custom-type': token => {
101
+ if (!token) {
102
+ return 0;
103
+ }
104
+ return token.value === '1' ? 1 : 0;
105
+ },
106
+ },
107
+ },
108
+ };
109
+ expect((0, css_syntax_1.cssSyntaxMatch)('1', custom).matched).toBe(true);
110
+ expect((0, css_syntax_1.cssSyntaxMatch)('0', custom).matched).toBe(false);
108
111
  });
109
112
  test('case-sensitive', () => {
110
- const custom = {
111
- ref: 'n/a',
112
- caseSensitive: true,
113
- syntax: {
114
- apply: '<custom>',
115
- def: {
116
- custom: 'CaSeS [a | B | aBc]',
117
- },
118
- },
119
- };
120
- expect((0, css_syntax_1.cssSyntaxMatch)('CaSeS a', custom).matched).toBe(true);
121
- expect((0, css_syntax_1.cssSyntaxMatch)('CaSeS B', custom).matched).toBe(true);
122
- expect((0, css_syntax_1.cssSyntaxMatch)('CaSeS aBc', custom).matched).toBe(true);
123
- expect((0, css_syntax_1.cssSyntaxMatch)('CaSeS A', custom)).toStrictEqual({
124
- column: 7,
125
- line: 1,
126
- matched: false,
127
- length: 1,
128
- offset: 6,
129
- partName: 'value',
130
- raw: 'A',
131
- reason: 'syntax-error',
132
- ref: 'n/a',
133
- expects: [
134
- {
135
- type: 'syntax',
136
- value: 'CaSeS [ a | B | aBc ]',
137
- },
138
- ],
139
- });
140
- expect((0, css_syntax_1.cssSyntaxMatch)('CaSeS abc', custom)).toStrictEqual({
141
- column: 7,
142
- line: 1,
143
- matched: false,
144
- length: 3,
145
- offset: 6,
146
- partName: 'value',
147
- raw: 'abc',
148
- reason: 'syntax-error',
149
- ref: 'n/a',
150
- expects: [
151
- {
152
- type: 'syntax',
153
- value: 'CaSeS [ a | B | aBc ]',
154
- },
155
- ],
156
- });
113
+ const custom = {
114
+ ref: 'n/a',
115
+ caseSensitive: true,
116
+ syntax: {
117
+ apply: '<custom>',
118
+ def: {
119
+ custom: 'CaSeS [a | B | aBc]',
120
+ },
121
+ },
122
+ };
123
+ expect((0, css_syntax_1.cssSyntaxMatch)('CaSeS a', custom).matched).toBe(true);
124
+ expect((0, css_syntax_1.cssSyntaxMatch)('CaSeS B', custom).matched).toBe(true);
125
+ expect((0, css_syntax_1.cssSyntaxMatch)('CaSeS aBc', custom).matched).toBe(true);
126
+ expect((0, css_syntax_1.cssSyntaxMatch)('CaSeS A', custom)).toStrictEqual({
127
+ column: 7,
128
+ line: 1,
129
+ matched: false,
130
+ length: 1,
131
+ offset: 6,
132
+ partName: 'value',
133
+ raw: 'A',
134
+ reason: 'syntax-error',
135
+ ref: 'n/a',
136
+ expects: [
137
+ {
138
+ type: 'syntax',
139
+ value: '<custom>',
140
+ },
141
+ ],
142
+ });
143
+ expect((0, css_syntax_1.cssSyntaxMatch)('CaSeS abc', custom)).toStrictEqual({
144
+ column: 7,
145
+ line: 1,
146
+ matched: false,
147
+ length: 3,
148
+ offset: 6,
149
+ partName: 'value',
150
+ raw: 'abc',
151
+ reason: 'syntax-error',
152
+ ref: 'n/a',
153
+ expects: [
154
+ {
155
+ type: 'syntax',
156
+ value: '<custom>',
157
+ },
158
+ ],
159
+ });
157
160
  });
package/lib/defs.js CHANGED
@@ -115,7 +115,7 @@ exports.types = {
115
115
  reason: 'unexpected-space',
116
116
  });
117
117
  }
118
- if (!tokens.length) {
118
+ if (tokens.length === 0) {
119
119
  return (0, match_result_1.unmatched)(value, 'empty-token');
120
120
  }
121
121
  return (0, match_result_1.matched)();
@@ -431,7 +431,7 @@ exports.types = {
431
431
  if (!height) {
432
432
  return sep.unmatched({ reason: 'unexpected-token' });
433
433
  }
434
- if (tail && tail.length) {
434
+ if (tail[0]) {
435
435
  return tail[0].unmatched({ reason: 'extra-token' });
436
436
  }
437
437
  if (!(0, primitive_1.isUint)(width.value)) {
package/lib/enum.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  import type { Result } from './types';
2
2
  import type { Enum } from './types.schema';
3
- export declare function checkEnum(value: string, type: Enum, ref?: string): Result;
3
+ import type { ReadonlyDeep } from 'type-fest';
4
+ export declare function checkEnum(value: string, type: ReadonlyDeep<Enum>, ref?: string): Result;
package/lib/enum.js CHANGED
@@ -9,7 +9,7 @@ function checkEnum(value, type, ref) {
9
9
  if (!disallowToSurroundBySpaces) {
10
10
  value = value.trim();
11
11
  }
12
- let values = type.enum;
12
+ let values = type.enum.slice();
13
13
  if (caseInsensitive) {
14
14
  value = value.toLowerCase();
15
15
  values = type.enum.map(v => v.toLowerCase());
@@ -1,3 +1,6 @@
1
1
  type NullableString = string | null | undefined;
2
- export declare function getCandidate(value: NullableString, ...candidates: (NullableString | NullableString[])[]): string | undefined;
2
+ export declare function getCandidate(
3
+ value: NullableString,
4
+ ...candidates: readonly (NullableString | readonly NullableString[])[]
5
+ ): string | undefined;
3
6
  export {};
@@ -33,6 +33,7 @@ function checkKeywordType(value, type, cache = true) {
33
33
  }
34
34
  exports.checkKeywordType = checkKeywordType;
35
35
  function _checkKeywordType(value, type) {
36
+ var _a, _b;
36
37
  const def = defs_1.types[type];
37
38
  if (!def) {
38
39
  (0, debug_1.log)('The "%s" type is not defined in custom type identifier markuplint specified', type);
@@ -51,8 +52,8 @@ function _checkKeywordType(value, type) {
51
52
  if (!matches.matched) {
52
53
  return {
53
54
  ...matches,
54
- ref: matches.ref || def.ref,
55
- expects: matches.expects || def.expects,
55
+ ref: (_a = matches.ref) !== null && _a !== void 0 ? _a : def.ref,
56
+ expects: (_b = matches.expects) !== null && _b !== void 0 ? _b : def.expects,
56
57
  };
57
58
  }
58
59
  return matches;
package/lib/list.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  import type { Result } from './types';
2
2
  import type { List } from './types.schema';
3
- export declare function checkList(value: string, type: List, ref?: string, cache?: boolean): Result;
3
+ import type { ReadonlyDeep } from 'type-fest';
4
+ export declare function checkList(value: string, type: ReadonlyDeep<List>, ref?: string, cache?: boolean): Result;
package/lib/list.js CHANGED
@@ -5,6 +5,7 @@ const check_1 = require("./check");
5
5
  const match_result_1 = require("./match-result");
6
6
  const token_1 = require("./token");
7
7
  function checkList(value, type, ref, cache = true) {
8
+ var _a;
8
9
  const tokens = new token_1.TokenCollection(value, type);
9
10
  const matches = tokens.check({ ref });
10
11
  if (!matches.matched) {
@@ -17,7 +18,7 @@ function checkList(value, type, ref, cache = true) {
17
18
  const { offset, line, column } = token_1.Token.shiftLocation(token, res.offset);
18
19
  return {
19
20
  ...res,
20
- partName: res.partName || 'the content of the list',
21
+ partName: (_a = res.partName) !== null && _a !== void 0 ? _a : 'the content of the list',
21
22
  offset,
22
23
  line,
23
24
  column,