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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "type-fest",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "description": "A collection of essential TypeScript types",
5
5
  "license": "(MIT OR CC0-1.0)",
6
6
  "repository": "sindresorhus/type-fest",
@@ -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<S extends string, D extends string> =
22
- S extends `${infer T}${D}${infer U}`
23
- ? [T, ...Split<U, D>]
24
- : [S];
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];