@eslinted/core 0.0.1-rc.0 → 0.0.1-rc.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (156) hide show
  1. package/dist/index.d.ts +6 -0
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +65 -1
  4. package/dist/index.js.map +1 -1
  5. package/dist/options/HtmlOption.d.ts +5 -0
  6. package/dist/options/HtmlOption.d.ts.map +1 -0
  7. package/dist/options/HtmlOption.js +16 -0
  8. package/dist/options/HtmlOption.js.map +1 -0
  9. package/dist/options/JsOption.d.ts +5 -0
  10. package/dist/options/JsOption.d.ts.map +1 -0
  11. package/dist/options/JsOption.js +19 -0
  12. package/dist/options/JsOption.js.map +1 -0
  13. package/dist/options/JsonOption.d.ts +5 -0
  14. package/dist/options/JsonOption.d.ts.map +1 -0
  15. package/dist/options/JsonOption.js +16 -0
  16. package/dist/options/JsonOption.js.map +1 -0
  17. package/dist/options/JsoncOption.d.ts +5 -0
  18. package/dist/options/JsoncOption.d.ts.map +1 -0
  19. package/dist/options/JsoncOption.js +16 -0
  20. package/dist/options/JsoncOption.js.map +1 -0
  21. package/dist/options/MdOption.d.ts +5 -0
  22. package/dist/options/MdOption.d.ts.map +1 -0
  23. package/dist/options/MdOption.js +16 -0
  24. package/dist/options/MdOption.js.map +1 -0
  25. package/dist/options/SvelteOption.d.ts +10 -0
  26. package/dist/options/SvelteOption.d.ts.map +1 -0
  27. package/dist/options/SvelteOption.js +28 -0
  28. package/dist/options/SvelteOption.js.map +1 -0
  29. package/dist/options/TsOption.d.ts +8 -0
  30. package/dist/options/TsOption.d.ts.map +1 -0
  31. package/dist/options/TsOption.js +25 -0
  32. package/dist/options/TsOption.js.map +1 -0
  33. package/dist/options/YmlOption.d.ts +5 -0
  34. package/dist/options/YmlOption.d.ts.map +1 -0
  35. package/dist/options/YmlOption.js +16 -0
  36. package/dist/options/YmlOption.js.map +1 -0
  37. package/dist/options/option/Option.d.ts +5 -0
  38. package/dist/options/option/Option.d.ts.map +1 -0
  39. package/dist/options/option/Option.js +7 -0
  40. package/dist/options/option/Option.js.map +1 -0
  41. package/dist/options.d.ts +18 -0
  42. package/dist/options.d.ts.map +1 -0
  43. package/dist/options.js +17 -0
  44. package/dist/options.js.map +1 -0
  45. package/dist/rulesets/ruleset/Ruleset.d.ts +12 -0
  46. package/dist/rulesets/ruleset/Ruleset.d.ts.map +1 -0
  47. package/dist/rulesets/ruleset/Ruleset.js +27 -0
  48. package/dist/rulesets/ruleset/Ruleset.js.map +1 -0
  49. package/dist/rulesets/ruleset/rule/Rule.d.ts +6 -0
  50. package/dist/rulesets/ruleset/rule/Rule.d.ts.map +1 -0
  51. package/dist/rulesets/ruleset/rule/Rule.js +9 -0
  52. package/dist/rulesets/ruleset/rule/Rule.js.map +1 -0
  53. package/dist/scopes.d.ts +3 -0
  54. package/dist/scopes.d.ts.map +1 -0
  55. package/dist/scopes.js +11 -0
  56. package/dist/scopes.js.map +1 -0
  57. package/interface/IConfig.d.ts +21 -0
  58. package/interface/files/IFiles.d.ts +1 -0
  59. package/interface/option/IOption.d.ts +25 -0
  60. package/interface/option/language/IOLanguage.d.ts +15 -0
  61. package/interface/option/language/ecma/IOLanguageEcma.d.ts +20 -0
  62. package/interface/option/language/globals/IOLanguageGlobals.d.ts +3 -0
  63. package/interface/option/language/parser/IOLanguageParser.d.ts +3 -0
  64. package/interface/option/language/parserOptions/IOLanguageParserOptions.d.ts +5 -0
  65. package/interface/option/language/source/IOLanguageSource.d.ts +12 -0
  66. package/interface/option/linter/IOLinter.d.ts +30 -0
  67. package/interface/option/name/IOName.d.ts +3 -0
  68. package/interface/option/plugins/IOPlugins.d.ts +3 -0
  69. package/interface/option/processor/IOProcessor.d.ts +3 -0
  70. package/interface/rules/IRules.d.ts +1 -0
  71. package/interface/rules/rule/IRule.d.ts +1 -0
  72. package/interface/rules/rule/state/RuleSeverity.d.ts +5 -0
  73. package/package.json +2 -2
  74. package/src/Scope.d.ts +9 -0
  75. package/src/index.ts +113 -0
  76. package/src/options/HtmlOption.ts +31 -0
  77. package/src/options/JsOption.ts +27 -0
  78. package/src/options/JsonOption.ts +31 -0
  79. package/src/options/JsoncOption.ts +31 -0
  80. package/src/options/MdOption.ts +31 -0
  81. package/src/options/SvelteOption.ts +47 -0
  82. package/src/options/TsOption.ts +40 -0
  83. package/src/options/YmlOption.ts +31 -0
  84. package/src/options/option/Option.ts +25 -0
  85. package/src/options.ts +17 -0
  86. package/src/plugins.d.ts +24 -0
  87. package/src/rulesets/ruleset/Ruleset.ts +50 -0
  88. package/src/rulesets/ruleset/rule/Rule.ts +6 -0
  89. package/src/scopes.ts +11 -0
  90. package/tsconfig.json +4 -2
  91. package/types/literal/number/base32.d.ts +19 -0
  92. package/types/literal/number/base64.d.ts +35 -0
  93. package/types/literal/number/binary.d.ts +4 -0
  94. package/types/literal/number/decimal.d.ts +5 -0
  95. package/types/literal/number/hex.d.ts +10 -0
  96. package/types/literal/number/octal.d.ts +7 -0
  97. package/types/literal/number/quatral.d.ts +4 -0
  98. package/types/literal/number/ternary.d.ts +4 -0
  99. package/types/literal/string/base64char.d.ts +13 -0
  100. package/types/literal/string/digit.d.ts +12 -0
  101. package/types/literal/string/hexchar.d.ts +9 -0
  102. package/types/literal/string/letter.d.ts +35 -0
  103. package/types/safe/Safe.d.ts +2 -0
  104. package/types/safe/numbers/finite/Finite.d.ts +2 -0
  105. package/types/safe/numbers/finite.d.ts +1 -0
  106. package/types/safe/numbers/fint.d.ts +1 -0
  107. package/types/safe/numbers/int/Int.d.ts +2 -0
  108. package/types/safe/numbers/int.d.ts +1 -0
  109. package/types/safe/numbers/numberful.d.ts +1 -0
  110. package/types/safe/numbers/polarity/Negative.d.ts +4 -0
  111. package/types/safe/numbers/polarity/Positive.d.ts +4 -0
  112. package/types/safe/numbers/polarity/pole/Pole.d.ts +18 -0
  113. package/types/safe/primitive.d.ts +5 -0
  114. package/types/safe/strings/char.d.ts +1 -0
  115. package/types/safe/strings/length/PropLength.d.ts +3 -0
  116. package/types/safe/strings/stringful.d.ts +1 -0
  117. package/types/utility/interface/construct/Particord.d.ts +1 -0
  118. package/types/utility/interface/construct/Property.d.ts +8 -0
  119. package/types/utility/interface/construct/Recordful.d.ts +5 -0
  120. package/types/utility/interface/construct/Table.d.ts +3 -0
  121. package/types/utility/interface/construct/properties/Field.d.ts +1 -0
  122. package/types/utility/interface/construct/properties/Flag.d.ts +1 -0
  123. package/types/utility/interface/construct/properties/Limit.d.ts +8 -0
  124. package/types/utility/interface/construct/properties/List.d.ts +1 -0
  125. package/types/utility/interface/construct/properties/Listish.d.ts +1 -0
  126. package/types/utility/interface/construct/properties/Scalar.d.ts +1 -0
  127. package/types/utility/interface/construct/tables/FieldTable.d.ts +1 -0
  128. package/types/utility/interface/construct/tables/FlagTable.d.ts +1 -0
  129. package/types/utility/interface/construct/tables/ListTable.d.ts +1 -0
  130. package/types/utility/interface/construct/tables/ListishTable.d.ts +1 -0
  131. package/types/utility/interface/construct/tables/ScalarTable.d.ts +1 -0
  132. package/types/utility/interface/identity/Interface.d.ts +80 -0
  133. package/types/utility/interface/identity/Keys.d.ts +71 -0
  134. package/types/utility/interface/transform/Unrequire.d.ts +45 -0
  135. package/types/utility/iterable/construct/ArrayN.d.ts +12 -0
  136. package/types/utility/iterable/construct/Tuple.d.ts +27 -0
  137. package/types/utility/iterable/construct/arrays/Arrays.d.ts +1 -0
  138. package/types/utility/iterable/construct/tuples/Tuples.d.ts +9 -0
  139. package/types/utility/iterable/identity/DyadType.d.ts +3 -0
  140. package/types/utility/iterable/identity/MonadType.d.ts +48 -0
  141. package/types/utility/iterable/identity/TriadType.d.ts +3 -0
  142. package/types/utility/iterable/identity/array/ArrayType.d.ts +65 -0
  143. package/types/utility/iterable/identity/array/length/ArrayLength.d.ts +16 -0
  144. package/types/utility/iterable/transform/Join.d.ts +19 -0
  145. package/types/utility/iterable/transform/Unflat.d.ts +3 -0
  146. package/types/utility/iterable/transform/stringarray/Chain.d.ts +30 -0
  147. package/types/utility/iterable/transform/stringarray/PathN.d.ts +3 -0
  148. package/types/utility/iterable/transform/stringarray/stringify/Stringify.d.ts +5 -0
  149. package/types/utility/length/Length.d.ts +35 -0
  150. package/types/utility/null/null.d.ts +1 -0
  151. package/types/utility/null/nullable.d.ts +1 -0
  152. package/types/utility/primitive/Primeval.d.ts +42 -0
  153. package/types/utility/primitive/boolean/True.d.ts +30 -0
  154. package/types/utility/primitive/number/Numbered.d.ts +35 -0
  155. package/types/utility/primitive/string/literal.d.ts +22 -0
  156. package/types/utility/primitive/string/literalful.d.ts +28 -0
@@ -0,0 +1,19 @@
1
+ declare type base32 =
2
+ | hex
3
+ | 16
4
+ | 17
5
+ | 18
6
+ | 19
7
+ | 20
8
+ | 21
9
+ | 22
10
+ | 23
11
+ | 24
12
+ | 25
13
+ | 26
14
+ | 27
15
+ | 28
16
+ | 29
17
+ | 30
18
+ | 31
19
+ ;
@@ -0,0 +1,35 @@
1
+ declare type base64 =
2
+ | base32
3
+ | 32
4
+ | 33
5
+ | 34
6
+ | 35
7
+ | 36
8
+ | 37
9
+ | 38
10
+ | 39
11
+ | 40
12
+ | 41
13
+ | 42
14
+ | 43
15
+ | 44
16
+ | 45
17
+ | 46
18
+ | 47
19
+ | 48
20
+ | 49
21
+ | 50
22
+ | 51
23
+ | 52
24
+ | 53
25
+ | 54
26
+ | 55
27
+ | 56
28
+ | 57
29
+ | 58
30
+ | 59
31
+ | 60
32
+ | 61
33
+ | 62
34
+ | 63
35
+ ;
@@ -0,0 +1,4 @@
1
+ declare type binary =
2
+ | 0
3
+ | 1
4
+ ;
@@ -0,0 +1,5 @@
1
+ declare type decimal =
2
+ | octal
3
+ | 8
4
+ | 9
5
+ ;
@@ -0,0 +1,10 @@
1
+ declare type hex =
2
+ | decimal
3
+ | 9
4
+ | 10
5
+ | 11
6
+ | 12
7
+ | 13
8
+ | 14
9
+ | 15
10
+ ;
@@ -0,0 +1,7 @@
1
+ declare type octal =
2
+ | quatral
3
+ | 4
4
+ | 5
5
+ | 6
6
+ | 7
7
+ ;
@@ -0,0 +1,4 @@
1
+ declare type quatral =
2
+ | ternary
3
+ | 3
4
+ ;
@@ -0,0 +1,4 @@
1
+ declare type ternary =
2
+ | binary
3
+ | 2
4
+ ;
@@ -0,0 +1,13 @@
1
+ declare type base64char =
2
+ | letter
3
+ | digit
4
+ | "+"
5
+ | "/"
6
+ ;
7
+
8
+ declare type base64pad = "=";
9
+
10
+ declare type base64paddedchar =
11
+ | base64char
12
+ | base64pad
13
+ ;
@@ -0,0 +1,12 @@
1
+ declare type digit =
2
+ | "0"
3
+ | "1"
4
+ | "2"
5
+ | "3"
6
+ | "4"
7
+ | "5"
8
+ | "6"
9
+ | "7"
10
+ | "8"
11
+ | "9"
12
+ ;
@@ -0,0 +1,9 @@
1
+ declare type hexchar =
2
+ | digit
3
+ | "A"
4
+ | "B"
5
+ | "C"
6
+ | "D"
7
+ | "E"
8
+ | "F"
9
+ ;
@@ -0,0 +1,35 @@
1
+ declare type letter =
2
+ | lower
3
+ | upper
4
+ ;
5
+
6
+ declare type lower = Lowercase<upper>;
7
+
8
+ declare type upper =
9
+ | "A"
10
+ | "B"
11
+ | "C"
12
+ | "D"
13
+ | "E"
14
+ | "F"
15
+ | "G"
16
+ | "H"
17
+ | "I"
18
+ | "J"
19
+ | "K"
20
+ | "L"
21
+ | "M"
22
+ | "N"
23
+ | "O"
24
+ | "P"
25
+ | "Q"
26
+ | "R"
27
+ | "S"
28
+ | "T"
29
+ | "U"
30
+ | "V"
31
+ | "W"
32
+ | "X"
33
+ | "Y"
34
+ | "Z"
35
+ ;
@@ -0,0 +1,2 @@
1
+ declare const p: unique symbol;
2
+ declare type Safe<P extends primitive, Check> = P & { [p]: Check };
@@ -0,0 +1,2 @@
1
+ declare const finite: unique symbol;
2
+ declare type Finite<N extends number> = N & { [finite]: 1 };
@@ -0,0 +1 @@
1
+ declare type finite = Finite<numberful>;
@@ -0,0 +1 @@
1
+ declare type fint = Finite<int>;
@@ -0,0 +1,2 @@
1
+ declare const int: unique symbol;
2
+ declare type Int<N extends number> = N & { [int]: 1 };
@@ -0,0 +1 @@
1
+ declare type int = Int<numberful>;
@@ -0,0 +1 @@
1
+ declare type numberful = Safe<number, "numberful">;
@@ -0,0 +1,4 @@
1
+ declare type Negative<
2
+ N extends number,
3
+ Zero = true,
4
+ > = Pole<N, "-", Zero>;
@@ -0,0 +1,4 @@
1
+ declare type Positive<
2
+ N extends number,
3
+ Zero = true,
4
+ > = Pole<N, "+", Zero>;
@@ -0,0 +1,18 @@
1
+ declare const pole: unique symbol;
2
+ declare const min: unique symbol;
3
+ declare type Pole<
4
+ N extends number,
5
+ P extends
6
+ | "-"
7
+ | "+"
8
+ ,
9
+ Zero,
10
+ > =
11
+ & N
12
+ & {
13
+ [pole]: P;
14
+ [min]: Zero extends false
15
+ ? P extends "+" ? 1 : -1
16
+ : 0;
17
+ }
18
+ ;
@@ -0,0 +1,5 @@
1
+ declare type primitive =
2
+ | string
3
+ | number
4
+ | boolean
5
+ ;
@@ -0,0 +1 @@
1
+ declare type char = stringful & PropLength<1>;
@@ -0,0 +1,3 @@
1
+ declare type PropLength<L extends number> = Length<L> extends never
2
+ ? never
3
+ : { length: Length<L> };
@@ -0,0 +1 @@
1
+ declare type stringful = Safe<string, "stringful"> & { 0: stringful & PropLength<1> };
@@ -0,0 +1 @@
1
+ declare type Particord<K extends string, V> = Partial<Recordful<K, V>>;
@@ -0,0 +1,8 @@
1
+ declare type Property<K extends string, OK extends string, V> = literalful<K> extends never
2
+ ? Particord<OK, V>
3
+ : Recordful<K, V>
4
+ & (
5
+ literalful<OK> extends never
6
+ ? object
7
+ : Particord<OK, V>
8
+ );
@@ -0,0 +1,5 @@
1
+ declare type Recordful<K extends string, V> = [V] extends [never]
2
+ ? never
3
+ : literalful<K> extends never
4
+ ? never
5
+ : Record<literalful<K>, V>;
@@ -0,0 +1,3 @@
1
+ declare type Table<V = unknown> = [V] extends [never]
2
+ ? never
3
+ : Record<string, V>;
@@ -0,0 +1 @@
1
+ declare type Field<K extends string, OK extends string = never> = Property<K, OK, string>;
@@ -0,0 +1 @@
1
+ declare type Flag<OK extends string, K extends string = never> = Property<K, OK, boolean>;
@@ -0,0 +1,8 @@
1
+ declare type Limit<K extends string, OK extends string = never> = Property<K, OK, Boundary>;
2
+
3
+ type Boundary = Recordful<
4
+ | "min"
5
+ | "max"
6
+ ,
7
+ number
8
+ >;
@@ -0,0 +1 @@
1
+ declare type List<K extends string, OK extends string = never> = Property<K, OK, readonly string[]>;
@@ -0,0 +1 @@
1
+ declare type Listish<K extends string, OK extends string = never> = Property<K, OK, Unflat>;
@@ -0,0 +1 @@
1
+ declare type Scalar<K extends string, OK extends string = never> = Property<K, OK, number>;
@@ -0,0 +1 @@
1
+ declare type FieldTable = Table<string>;
@@ -0,0 +1 @@
1
+ declare type FlagTable = Table<boolean>;
@@ -0,0 +1 @@
1
+ declare type ListTable = Table<readonly string[]>;
@@ -0,0 +1 @@
1
+ declare type ListishTable = Table<Unflat>;
@@ -0,0 +1 @@
1
+ declare type ScalarTable = Table<number>;
@@ -0,0 +1,80 @@
1
+ declare type Interface<R extends object> = [R] extends [object]
2
+ ? [Extract<R, readonly unknown[]>] extends [never]
3
+ ? Required<R> extends Record<infer K, unknown>
4
+ ? Exclude<K, string> extends never
5
+ ? literalful<K & string> extends never
6
+ ? never
7
+ : R
8
+ : never
9
+ : never
10
+ : never
11
+ : never;
12
+
13
+ declare namespace InterfaceTest {
14
+ export type T = Interface<{ a: 5 }>;
15
+ export type T0 = Interface<{
16
+ a: 1;
17
+ b?: 2;
18
+ }>;
19
+ export type T1 = Interface<{
20
+ a: 1;
21
+ b: 2;
22
+ }>;
23
+ export type T2 = Interface<Record<"a", unknown>>;
24
+ export type T3 = Interface<Record<"a" | "b", unknown>>;
25
+ }
26
+
27
+ declare namespace NotInterface {
28
+ export type N = Interface<never>;
29
+ export type N0 = Interface<object>;
30
+ export type N0a = Interface<Record<"a" | "b" | 5, unknown>>;
31
+ export type N0b = Interface<Record<"a" | "b" | number, unknown>>;
32
+ export type N0c = Interface<Record<string, unknown>>;
33
+ export type N0d = Interface<Record<string | number, unknown>>;
34
+ export type N0e = Interface<Record<stringful, string>>;
35
+ export type N0f = Interface<Record<stringful | "5", string>>;
36
+ export type N1 = Interface<[]>;
37
+ export type N1b = Interface<[1]>;
38
+ export type N1c = Interface<[1, 1]>;
39
+ export type N1d = Interface<number[]>;
40
+ export type N1e = Interface<readonly []>;
41
+ export type N1f = Interface<readonly [1]>;
42
+ export type N1g = Interface<readonly [1, 1]>;
43
+ export type N1h = Interface<readonly number[]>;
44
+ export type N2 = Interface<()=> void>;
45
+ export type N2a = Interface<(a: string)=> boolean>;
46
+ export type N2b = Interface<(a: string)=> string[]>;
47
+ export type N2c = Interface<(a: string)=> object>;
48
+ export type N5 = Interface<[] | { a: 1 }>;
49
+ export type N5a = Interface<[30] | { a: 1 }>;
50
+ export type N5b = Interface<object | []>;
51
+ export type N5c = Interface<
52
+ | {
53
+ a: 1;
54
+ b: 2;
55
+ }
56
+ | {
57
+ a: 1;
58
+ b: 2;
59
+ c: 2;
60
+ }
61
+ >;
62
+
63
+ // export type N3 = Interface<stringful>;
64
+ // export type N3b = Interface<numberful>;
65
+ // export type N13c = Interface<string>;
66
+ // export type N13d = Interface<"cool">;
67
+ // export type N13e = Interface<number>;
68
+ // export type N13f = Interface<0>;
69
+ // export type N13g = Interface<1>;
70
+ // export type N13h = Interface<true>;
71
+ // export type N13i = Interface<false>;
72
+ // export type N13j = Interface<boolean>;
73
+ // export type N14 = Interface<null>;
74
+ // export type N14a = Interface<undefined>;
75
+ // export type N14c = Interface<unknown>;
76
+ // export type N15 = Interface<string | { a: cool }>;
77
+ // export type N15b = Interface<Record<"a" | "b" | string, unknown>>;
78
+ }
79
+
80
+ type gg = Extract<{ a: 5 }, readonly unknown[]>;
@@ -0,0 +1,71 @@
1
+ declare type Keys<R extends object> = Interface<R> extends never
2
+ ? never
3
+ : keyof Interface<R>;
4
+
5
+ declare namespace Keys {
6
+ const RESULT: {
7
+ positive: typeof POSITIVE | 1;
8
+ negative: typeof NEGATIVE | 0;
9
+ };
10
+
11
+ export const POSITIVE: {
12
+ T: Keys<{ a: 5 }>;
13
+ T0: Keys<{
14
+ a: 1;
15
+ b?: 2;
16
+ }>;
17
+ T1: Keys<{
18
+ a: 1;
19
+ b: 2;
20
+ }>;
21
+ } extends Record<string, string> ? "PASS" : never;
22
+ const s: unique symbol;
23
+
24
+ export const NEGATIVE: {
25
+ N: Keys<never>;
26
+ N0: Keys<{ [s]: 1 }>;
27
+ N1: Keys<Record<string, 1>>;
28
+ N1b: Keys<Record<stringful, 1>>;
29
+ N1c: Keys<Record<"", 1>>;
30
+ N1d: Keys<Record<number, 1>>;
31
+ N2: Keys<Record<stringful | "30", 1>>;
32
+ N2b: Keys<Record<stringful | "", 1>>;
33
+ N2c: Keys<Record<number | "", 1>>;
34
+ N2d: Keys<Record<number | "c", 1>>;
35
+ N2e: Keys<object>;
36
+ N2f: Keys<{
37
+ a: 1;
38
+ [min]: 1;
39
+ }>;
40
+ N3: Keys<[]>;
41
+ N3a: Keys<readonly [1, 1]>;
42
+ N4: Keys<
43
+ | {
44
+ a: 1;
45
+ b: 1;
46
+ }
47
+ | object
48
+ >;
49
+ N5: Keys<[1] | { a: 1 }>;
50
+ N5a: Keys<
51
+ | {
52
+ a: 1;
53
+ b: 1;
54
+ }
55
+ | { c: 1 }
56
+ >;
57
+ N5b: Keys<
58
+ | {
59
+ a: 1;
60
+ b: 1;
61
+ }
62
+ | { c?: 1 }
63
+ >;
64
+
65
+ // N10: Keys<null>;
66
+ // N10a: Keys<undefined>;
67
+ // N10b: Keys<void>;
68
+ // N10c: Keys<unknown>;
69
+ // N11c: Keys<Record<string | "30", 1>>;
70
+ } extends Record<string, never> ? "PASS" : never;
71
+ }
@@ -0,0 +1,45 @@
1
+ declare type Unrequire<R extends object, OK extends string> = Interface<R> extends never
2
+ ? never
3
+ : literalful<OK> extends never
4
+ ? never
5
+ : OK extends keyof R
6
+ ? Omit<Interface<R>, literalful<OK>> & Partial<Pick<Interface<R>, literalful<OK>>>
7
+ : never;
8
+
9
+ declare namespace Unrequire {
10
+ export type T = Unrequire<{
11
+ a: 1;
12
+ b: 1;
13
+ c: 1;
14
+ }, "c">;
15
+ export type T1c = "a" extends keyof T ? true : false; // true
16
+ export type T1b = "b" extends keyof T ? true : false; // true
17
+ export type T1 = "c" extends keyof T ? true : false; // true
18
+ export type T2 = {
19
+ a: 1;
20
+ b: 1;
21
+ } extends T ? true : false; // true
22
+ export type T2b = {
23
+ a: 1;
24
+ b: 1;
25
+ c: 1;
26
+ } extends T ? true : false; // true
27
+ export type T2c = {
28
+ a: 1;
29
+ b: 1;
30
+ c: 1;
31
+ z: 9001;
32
+ } extends T ? true : false; // true
33
+ }
34
+
35
+ declare namespace NotUnrequire {
36
+ export type N_null = {
37
+ a: 1;
38
+ b: 1;
39
+ c: 1;
40
+ } extends Unrequire.T ? true : false; // true
41
+ export type N = {
42
+ b: 1;
43
+ c: 1;
44
+ } extends Unrequire.T ? true : false; // false
45
+ }
@@ -0,0 +1,12 @@
1
+ // TODO: constrain to positive integer
2
+ declare type ArrayN<I, N extends number = 0> = [I] extends [never]
3
+ ? never
4
+ : N extends number
5
+ ? N extends 0
6
+ ? [...I[]]
7
+ : ArrayBuilder<I, N>
8
+ : never;
9
+
10
+ type ArrayBuilder<I, N extends number, H extends I[] = []> = H["length"] extends N
11
+ ? [...H, ...I[]]
12
+ : ArrayBuilder<I, N, [...H, I]>;
@@ -0,0 +1,27 @@
1
+ // TODO: constrain to positive integer
2
+ declare type Tuple<I, N extends number = 2> = [I] extends [never]
3
+ ? never
4
+ : N extends number
5
+ ? N extends 0
6
+ ? readonly []
7
+ : TupleBuilder<I, Numbered<N>>
8
+ : never;
9
+
10
+ type TupleBuilder<I, N, H extends readonly I[] = readonly []> = H["length"] extends N
11
+ ? H
12
+ : TupleBuilder<I, N, readonly [...H, I]>;
13
+
14
+ declare namespace Tuple {
15
+ export type T = Tuple<string>;
16
+ export type T0 = Tuple<string, 0>;
17
+ export type T0a = Tuple<string, 1>;
18
+ export type T0b = Tuple<string, 3>;
19
+ export type T1 = Tuple<string | number>;
20
+ export type T2 = Tuple<string, 2 | 3>;
21
+ export type T3 = Tuple<string | number, 2 | 3>;
22
+ export type T4 = Tuple<string, never>;
23
+ export type T4a = Tuple<string, 0>;
24
+ export type T4b = Tuple<string, 0 | 1>;
25
+ }
26
+
27
+ type NN = Numbered<5 | 10>;
@@ -0,0 +1 @@
1
+ declare type Arrayful<I> = ArrayN<I, 1>;
@@ -0,0 +1,9 @@
1
+ declare type Monad<I> = Tuple<I, 1>;
2
+ declare type Triad<I> = Tuple<I, 3>;
3
+ declare type Quad<I> = Tuple<I, 4>;
4
+ declare type Pentad<I> = Tuple<I, 5>;
5
+ declare type Hexad<I> = Tuple<I, 6>;
6
+ declare type Heptad<I> = Tuple<I, 7>;
7
+ declare type Octad<I> = Tuple<I, 8>;
8
+ declare type Nonad<I> = Tuple<I, 9>;
9
+ declare type Decad<I> = Tuple<I, 10>;
@@ -0,0 +1,3 @@
1
+ declare type DyadType<A extends readonly unknown[]> = 1 extends ArrayLength<A>
2
+ ? never
3
+ : MonadType<A>;
@@ -0,0 +1,48 @@
1
+ declare type MonadType<A extends readonly unknown[]> = 0 extends ArrayLength<A>
2
+ ? never
3
+ : ArrayType<A>;
4
+
5
+ declare namespace MonadType {
6
+ export type T0 = MonadType<[1, 1]>;
7
+ export type T1 = MonadType<readonly [1, 1]>;
8
+ export type T2 = MonadType<readonly [1, 1?]>;
9
+ export type T3 = MonadType<readonly [1?, 1?]>;
10
+ export type T4 = MonadType<readonly [1?, 1?]>;
11
+ export type T5 = MonadType<[[]]>;
12
+ export type T6 = MonadType<string[] | int[]>;
13
+ export type T7 = MonadType<(string | int)[]>;
14
+ export type T18 = MonadType<[string] | [5, 10]>;
15
+ export type T8a = MonadType<Tuple<boolean>>;
16
+ export type T8b = MonadType<ArrayN<string, 3>>;
17
+ export type T8c = MonadType<
18
+ | ArrayN<string, 3>
19
+ | Tuple<boolean>
20
+ | [string]
21
+ | [5, 10]
22
+ | [5, 13]
23
+ | readonly [5, 10]
24
+ >;
25
+ }
26
+
27
+ declare namespace NotMonadType {
28
+ export type N12 = MonadType<never>;
29
+ export type N26 = MonadType<[]>;
30
+ export type N27 = MonadType<string[]>;
31
+ export type N28 = MonadType<readonly []>;
32
+ export type N29 = MonadType<readonly string[]>;
33
+ export type N30 = MonadType<[5] | []>;
34
+ export type N30a = MonadType<[5] | string[]>;
35
+ export type N30b = MonadType<[5] | readonly []>;
36
+ export type N30c = MonadType<[5] | readonly string[]>;
37
+ export type N30d = MonadType<
38
+ | []
39
+ | [5, 10]
40
+ | string []
41
+ | readonly []
42
+ | readonly [5, 10]
43
+ | readonly string[]
44
+ >;
45
+ export type N31 = MonadType<ArrayN<string>>;
46
+ export type N32 = MonadType<[string?]>;
47
+ export type N33 = MonadType<readonly [string?]>;
48
+ }
@@ -0,0 +1,3 @@
1
+ declare type TriadType<A extends readonly unknown[]> = 2 extends ArrayLength<A>
2
+ ? never
3
+ : DyadType<A>;