composition-ts 0.1.1 → 0.1.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.
Files changed (2) hide show
  1. package/dist/index.d.ts +5 -2
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -1,6 +1,9 @@
1
1
  type Compose<Types extends readonly unknown[]> = Types extends readonly [infer Head, ...infer Tail]
2
2
  ? Head & Compose<Tail>
3
3
  : unknown;
4
+ type Mutable<T> = {
5
+ -readonly [P in keyof T]: T[P];
6
+ };
4
7
 
5
8
  /**
6
9
  * Instead of using class inheritance, we can compose prototypes from multiple objects. This function takes a constructor function and an array of objects, and returns a new class that creates instances with the combined prototype of all the objects.
@@ -13,13 +16,13 @@ type Compose<Types extends readonly unknown[]> = Types extends readonly [infer H
13
16
  * ## About
14
17
  * @package CompositionTs
15
18
  * @author Kasukabe Tsumugi <futami16237@gmail.com>
16
- * @version 0.1.1 (Last Update: 2026.03.26 11:24:23.847)
19
+ * @version 0.1.2 (Last Update: 2026.03.26 11:27:32.645)
17
20
  * @license MIT
18
21
  * @link git+https://github.com/baendlorel/kt-packages.git
19
22
  * @link https://baendlorel.github.io/ Welcome to my site!
20
23
  * @description Instead of inheritance, make it composition!
21
24
  * @copyright Copyright (c) 2026 Kasukabe Tsumugi. All rights reserved.
22
25
  */
23
- declare function compose<Protos extends readonly object[], Args extends any[], Instance extends Compose<Protos> = Compose<Protos>>(initializer: (this: Instance, ...args: Args) => any, ...parts: Protos): new (...args: Args) => Instance;
26
+ declare function compose<Protos extends readonly object[], Args extends any[], Instance extends Compose<Protos> = Compose<Protos>>(initializer: (this: Mutable<Instance>, ...args: Args) => any, ...parts: Protos): new (...args: Args) => Instance;
24
27
 
25
28
  export { compose };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "composition-ts",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "author": {
5
5
  "name": "Kasukabe Tsumugi",
6
6
  "email": "futami16237@gmail.com"