@eslinted/core 8.0.0 → 9.0.0-rc.1
Sign up to get free protection for your applications and to get access to all the features.
- package/.github/workflows/RELEASE.yml +36 -36
- package/.github/workflows/rc.yml +36 -36
- package/.markdownlint.jsonc +122 -122
- package/LICENSE +21 -21
- package/README.md +5 -5
- package/SECURITY.md +9 -9
- package/eslint.config.js +3 -3
- package/package.json +96 -96
- package/src/factory/files.ts +26 -26
- package/src/factory/index.ts +27 -27
- package/src/factory/options/html.ts +18 -18
- package/src/factory/options/index.ts +21 -21
- package/src/factory/options/js.ts +13 -13
- package/src/factory/options/json.ts +18 -18
- package/src/factory/options/jsonc.ts +18 -18
- package/src/factory/options/mocha.ts +28 -28
- package/src/factory/options/option/index.ts +91 -91
- package/src/factory/options/option/template/globals.ts +5 -5
- package/src/factory/options/option/template/index.ts +26 -26
- package/src/factory/options/option/template/language/ecma.ts +3 -3
- package/src/factory/options/option/template/language/index.ts +21 -21
- package/src/factory/options/option/template/language/source.ts +4 -4
- package/src/factory/options/option/template/linter.ts +8 -8
- package/src/factory/options/option/template/plugins.ts +1 -1
- package/src/factory/options/svelte.ts +32 -32
- package/src/factory/options/ts.ts +24 -24
- package/src/factory/options/yml.ts +18 -18
- package/src/factory/rulesets/index.ts +24 -24
- package/src/factory/rulesets/ruleset.ts +25 -25
- package/src/index.ts +77 -77
- package/src/input/files.ts +6 -6
- package/src/input/imports/parsers.ts +10 -10
- package/src/input/imports/plugins.ts +9 -9
- package/src/input/index.ts +23 -23
- package/src/input/parsers.ts +3 -3
- package/src/input/plugins.ts +3 -3
- package/src/input/rules/entry/index.ts +7 -7
- package/src/input/rules/entry/record/index.ts +3 -3
- package/src/input/rules/entry/record/state.ts +5 -5
- package/src/input/rules/index.ts +14 -14
- package/src/output.ts +24 -24
- package/src/scopes.spec.ts +37 -37
- package/src/scopes.ts +11 -11
- package/tsconfig.json +163 -163
- package/typings/common/literals/number/bases/base32.d.ts +19 -19
- package/typings/common/literals/number/bases/base64.d.ts +35 -35
- package/typings/common/literals/number/bases/binary.d.ts +4 -4
- package/typings/common/literals/number/bases/decimal.d.ts +5 -5
- package/typings/common/literals/number/bases/hex.d.ts +10 -10
- package/typings/common/literals/number/bases/octal.d.ts +7 -7
- package/typings/common/literals/number/bases/quatral.d.ts +4 -4
- package/typings/common/literals/number/bases/ternary.d.ts +4 -4
- package/typings/common/literals/string/letter/digit/extended/base64/index.d.ts +13 -13
- package/typings/common/literals/string/letter/digit/extended/hex/index.d.ts +9 -9
- package/typings/common/literals/string/letter/digit/index.d.ts +12 -12
- package/typings/common/literals/string/letter/index.d.ts +35 -35
- package/typings/common/primitive/index.d.ts +5 -5
- package/typings/common/safe/index.d.ts +2 -2
- package/typings/common/safe/numbers/finite/index.d.ts +2 -2
- package/typings/common/safe/numbers/fint.d.ts +1 -1
- package/typings/common/safe/numbers/integer/index.d.ts +2 -2
- package/typings/common/safe/numbers/integer/numberful/index.d.ts +1 -1
- package/typings/common/safe/numbers/polarity/negative.d.ts +4 -4
- package/typings/common/safe/numbers/polarity/pole/index.d.ts +18 -18
- package/typings/common/safe/numbers/polarity/positive.d.ts +4 -4
- package/typings/common/safe/strings/char.d.ts +1 -1
- package/typings/common/safe/strings/stringful/index.d.ts +1 -1
- package/typings/common/safe/strings/stringful/length/index.d.ts +3 -3
- package/typings/common/utility/interface/build/particord/index.d.ts +1 -1
- package/typings/common/utility/interface/build/properties/Field.d.ts +1 -1
- package/typings/common/utility/interface/build/properties/Flag.d.ts +1 -1
- package/typings/common/utility/interface/build/properties/Limit.d.ts +8 -8
- package/typings/common/utility/interface/build/properties/List.d.ts +1 -1
- package/typings/common/utility/interface/build/properties/Listish.d.ts +1 -1
- package/typings/common/utility/interface/build/properties/Scalar.d.ts +1 -1
- package/typings/common/utility/interface/build/properties/property/index.d.ts +8 -8
- package/typings/common/utility/interface/build/recordful/index.d.ts +5 -5
- package/typings/common/utility/interface/build/tables/FieldTable.d.ts +1 -1
- package/typings/common/utility/interface/build/tables/FlagTable.d.ts +1 -1
- package/typings/common/utility/interface/build/tables/ListTable.d.ts +1 -1
- package/typings/common/utility/interface/build/tables/ListishTable.d.ts +1 -1
- package/typings/common/utility/interface/build/tables/ScalarTable.d.ts +1 -1
- package/typings/common/utility/interface/build/tables/table/index.d.ts +3 -3
- package/typings/common/utility/interface/identity/interface/index.d.ts +80 -80
- package/typings/common/utility/interface/identity/keys/index.d.ts +71 -71
- package/typings/common/utility/interface/transform/partial/unrequire/index.d.ts +45 -45
- package/typings/common/utility/iterable/build/arrays/array/index.d.ts +11 -11
- package/typings/common/utility/iterable/build/arrays/index.d.ts +2 -2
- package/typings/common/utility/iterable/build/tuples/index.d.ts +10 -10
- package/typings/common/utility/iterable/build/tuples/tuple/index.d.ts +26 -26
- package/typings/common/utility/iterable/identity/array/index.d.ts +65 -65
- package/typings/common/utility/iterable/identity/array/length/index.d.ts +16 -16
- package/typings/common/utility/iterable/identity/dyad.d.ts +3 -3
- package/typings/common/utility/iterable/identity/monad.d.ts +48 -48
- package/typings/common/utility/iterable/identity/triad.d.ts +3 -3
- package/typings/common/utility/iterable/transform/flat/index.d.ts +3 -3
- package/typings/common/utility/iterable/transform/flat/unflat/index.d.ts +3 -3
- package/typings/common/utility/iterable/transform/string/index.d.ts +30 -30
- package/typings/common/utility/iterable/transform/string/stringify/index.d.ts +27 -27
- package/typings/common/utility/nullable/index.d.ts +1 -1
- package/typings/common/utility/nullable/index.spec.d.ts +13 -13
- package/typings/common/utility/nullable/null/index.d.ts +1 -1
- package/typings/common/utility/nullable/null/index.spec.d.ts +13 -13
- package/typings/common/utility/object/build/index.d.ts +3 -3
- package/typings/common/utility/primitive/boolean/true/index.d.ts +30 -30
- package/typings/common/utility/primitive/index.d.ts +42 -42
- package/typings/common/utility/primitive/number/length/index.d.ts +35 -35
- package/typings/common/utility/primitive/number/length/numbered/index.d.ts +35 -35
- package/typings/common/utility/primitive/string/fake/index.d.ts +1 -1
- package/typings/common/utility/primitive/string/literalful/index.d.ts +28 -28
- package/typings/common/utility/primitive/string/literalful/literal/index.d.ts +22 -22
- package/typings/common/utility/test.d.ts +2 -2
- package/typings/common/valid/index.d.ts +7 -7
- package/typings/common/valid/string/index.d.ts +1 -1
@@ -1,2 +1,2 @@
|
|
1
|
-
declare const p: unique symbol;
|
2
|
-
declare type Safe<P extends primitive, Check> = P & { [p]: Check };
|
1
|
+
declare const p: unique symbol;
|
2
|
+
declare type Safe<P extends primitive, Check> = P & { [p]: Check };
|
@@ -1,2 +1,2 @@
|
|
1
|
-
declare const finite: unique symbol;
|
2
|
-
declare type finite<N extends number = numberful> = N & { [finite]: true };
|
1
|
+
declare const finite: unique symbol;
|
2
|
+
declare type finite<N extends number = numberful> = N & { [finite]: true };
|
@@ -1 +1 @@
|
|
1
|
-
declare type fint = finite<int>;
|
1
|
+
declare type fint = finite<int>;
|
@@ -1,2 +1,2 @@
|
|
1
|
-
declare const int: unique symbol;
|
2
|
-
declare type int = numberful & { [int]: true };
|
1
|
+
declare const int: unique symbol;
|
2
|
+
declare type int = numberful & { [int]: true };
|
@@ -1 +1 @@
|
|
1
|
-
declare type numberful = Safe<number, "numberful">;
|
1
|
+
declare type numberful = Safe<number, "numberful">;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
declare type Negative<
|
2
|
-
N extends number = numberful,
|
3
|
-
Zero = true,
|
4
|
-
> = pole<"-", N, Zero>;
|
1
|
+
declare type Negative<
|
2
|
+
N extends number = numberful,
|
3
|
+
Zero = true,
|
4
|
+
> = pole<"-", N, Zero>;
|
@@ -1,18 +1,18 @@
|
|
1
|
-
declare const pole: unique symbol,
|
2
|
-
min: unique symbol;
|
3
|
-
declare type pole<
|
4
|
-
P extends
|
5
|
-
| "-"
|
6
|
-
| "+"
|
7
|
-
,
|
8
|
-
N extends number,
|
9
|
-
Zero,
|
10
|
-
> =
|
11
|
-
& N
|
12
|
-
& {
|
13
|
-
[pole]: P;
|
14
|
-
[min]: Zero extends false
|
15
|
-
? P extends "+" ? 1 : -1
|
16
|
-
: 0;
|
17
|
-
}
|
18
|
-
;
|
1
|
+
declare const pole: unique symbol,
|
2
|
+
min: unique symbol;
|
3
|
+
declare type pole<
|
4
|
+
P extends
|
5
|
+
| "-"
|
6
|
+
| "+"
|
7
|
+
,
|
8
|
+
N extends number,
|
9
|
+
Zero,
|
10
|
+
> =
|
11
|
+
& N
|
12
|
+
& {
|
13
|
+
[pole]: P;
|
14
|
+
[min]: Zero extends false
|
15
|
+
? P extends "+" ? 1 : -1
|
16
|
+
: 0;
|
17
|
+
}
|
18
|
+
;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
declare type Positive<
|
2
|
-
N extends number = numberful,
|
3
|
-
Zero = true,
|
4
|
-
> = pole<"+", N, Zero>;
|
1
|
+
declare type Positive<
|
2
|
+
N extends number = numberful,
|
3
|
+
Zero = true,
|
4
|
+
> = pole<"+", N, Zero>;
|
@@ -1 +1 @@
|
|
1
|
-
declare type char = stringful & StringLength<1>;
|
1
|
+
declare type char = stringful & StringLength<1>;
|
@@ -1 +1 @@
|
|
1
|
-
declare type stringful = Safe<string, "stringful"> & { 0: stringful & StringLength<1> };
|
1
|
+
declare type stringful = Safe<string, "stringful"> & { 0: stringful & StringLength<1> };
|
@@ -1,3 +1,3 @@
|
|
1
|
-
declare type StringLength<L extends number> = LengthValue<L> extends never
|
2
|
-
? never
|
3
|
-
: { length: LengthValue<L> };
|
1
|
+
declare type StringLength<L extends number> = LengthValue<L> extends never
|
2
|
+
? never
|
3
|
+
: { length: LengthValue<L> };
|
@@ -1 +1 @@
|
|
1
|
-
declare type Particord<K extends string, V> = Partial<Recordful<K, V>>;
|
1
|
+
declare type Particord<K extends string, V> = Partial<Recordful<K, V>>;
|
@@ -1 +1 @@
|
|
1
|
-
declare type Field<K extends string, OK extends string = never> = Property<K, OK, string>;
|
1
|
+
declare type Field<K extends string, OK extends string = never> = Property<K, OK, string>;
|
@@ -1 +1 @@
|
|
1
|
-
declare type Flag<OK extends string, K extends string = never> = Property<K, OK, boolean>;
|
1
|
+
declare type Flag<OK extends string, K extends string = never> = Property<K, OK, boolean>;
|
@@ -1,8 +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
|
-
>;
|
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
|
+
>;
|
@@ -1 +1 @@
|
|
1
|
-
declare type List<K extends string, OK extends string = never> = Property<K, OK, readonly string[]>;
|
1
|
+
declare type List<K extends string, OK extends string = never> = Property<K, OK, readonly string[]>;
|
@@ -1 +1 @@
|
|
1
|
-
declare type Listish<K extends string, OK extends string = never> = Property<K, OK, Unflat>;
|
1
|
+
declare type Listish<K extends string, OK extends string = never> = Property<K, OK, Unflat>;
|
@@ -1 +1 @@
|
|
1
|
-
declare type Scalar<K extends string, OK extends string = never> = Property<K, OK, number>;
|
1
|
+
declare type Scalar<K extends string, OK extends string = never> = Property<K, OK, number>;
|
@@ -1,8 +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
|
-
? Recordful<K, V>
|
7
|
-
: Particord<OK, V>
|
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
|
+
? Recordful<K, V>
|
7
|
+
: Particord<OK, V>
|
8
|
+
);
|
@@ -1,5 +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>;
|
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>;
|
@@ -1 +1 @@
|
|
1
|
-
declare type FieldTable = Table<string>;
|
1
|
+
declare type FieldTable = Table<string>;
|
@@ -1 +1 @@
|
|
1
|
-
declare type FlagTable = Table<boolean>;
|
1
|
+
declare type FlagTable = Table<boolean>;
|
@@ -1 +1 @@
|
|
1
|
-
declare type ListTable = Table<readonly string[]>;
|
1
|
+
declare type ListTable = Table<readonly string[]>;
|
@@ -1 +1 @@
|
|
1
|
-
declare type ListishTable = Table<Unflat>;
|
1
|
+
declare type ListishTable = Table<Unflat>;
|
@@ -1 +1 @@
|
|
1
|
-
declare type ScalarTable = Table<number>;
|
1
|
+
declare type ScalarTable = Table<number>;
|
@@ -1,3 +1,3 @@
|
|
1
|
-
declare type Table<V = unknown> = [V] extends [never]
|
2
|
-
? never
|
3
|
-
: Record<string, V>;
|
1
|
+
declare type Table<V = unknown> = [V] extends [never]
|
2
|
+
? never
|
3
|
+
: Record<string, V>;
|
@@ -1,80 +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[]>;
|
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[]>;
|
@@ -1,71 +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
|
-
}
|
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
|
+
}
|
@@ -1,45 +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
|
-
}
|
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
|
+
}
|
@@ -1,11 +1,11 @@
|
|
1
|
-
declare type ArrayN<N extends number = 0, I = string> = [I] extends [never]
|
2
|
-
? never
|
3
|
-
: N extends number
|
4
|
-
? N extends 0 /* TODO: constrain posint */
|
5
|
-
? [...I[]]
|
6
|
-
: ArrayBuilder<N, I>
|
7
|
-
: never;
|
8
|
-
|
9
|
-
type ArrayBuilder<N extends number, I, H extends I[] = []> = H["length"] extends N
|
10
|
-
? [...H, ...I[]]
|
11
|
-
: ArrayBuilder<N, I, [...H, I]>;
|
1
|
+
declare type ArrayN<N extends number = 0, I = string> = [I] extends [never]
|
2
|
+
? never
|
3
|
+
: N extends number
|
4
|
+
? N extends 0 /* TODO: constrain posint */
|
5
|
+
? [...I[]]
|
6
|
+
: ArrayBuilder<N, I>
|
7
|
+
: never;
|
8
|
+
|
9
|
+
type ArrayBuilder<N extends number, I, H extends I[] = []> = H["length"] extends N
|
10
|
+
? [...H, ...I[]]
|
11
|
+
: ArrayBuilder<N, I, [...H, I]>;
|
@@ -1,2 +1,2 @@
|
|
1
|
-
declare type Arrayful<I = string> = ArrayN<1, I>;
|
2
|
-
declare type Arrayfully<I = string> = ArrayN<2, I>;
|
1
|
+
declare type Arrayful<I = string> = ArrayN<1, I>;
|
2
|
+
declare type Arrayfully<I = string> = ArrayN<2, I>;
|