type-fest 1.2.1 → 1.2.2
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.
- package/package.json +1 -1
- package/source/mutable.d.ts +1 -1
- package/ts41/split.d.ts +8 -4
package/package.json
CHANGED
package/source/mutable.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ type Foo = {
|
|
|
16
16
|
readonly c: boolean;
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
const mutableFoo: Mutable<Foo> = {a: 1, b: ['2']};
|
|
19
|
+
const mutableFoo: Mutable<Foo> = {a: 1, b: ['2'], c: true};
|
|
20
20
|
mutableFoo.a = 3;
|
|
21
21
|
mutableFoo.b[0] = 'new value'; // Will still fail as the value of property "b" is still a readonly type.
|
|
22
22
|
mutableFoo.b = ['something']; // Will work as the "b" property itself is no longer readonly.
|
package/ts41/split.d.ts
CHANGED
|
@@ -18,7 +18,11 @@ array = split(items, ',');
|
|
|
18
18
|
|
|
19
19
|
@category Template Literals
|
|
20
20
|
*/
|
|
21
|
-
export type Split<
|
|
22
|
-
S extends
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
export type Split<
|
|
22
|
+
S extends string,
|
|
23
|
+
Delimiter extends string
|
|
24
|
+
> = S extends `${infer Head}${Delimiter}${infer Tail}`
|
|
25
|
+
? [Head, ...Split<Tail, Delimiter>]
|
|
26
|
+
: S extends Delimiter
|
|
27
|
+
? []
|
|
28
|
+
: [S];
|