Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions deno.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
},
"fmt": {
"indentWidth": 4,
"lineWidth": 100,
"useTabs": true,
"singleQuote": true,
"proseWrap": "never"
Expand Down
7 changes: 1 addition & 6 deletions skill/example/BaseModule.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
import type { Container } from '@needle-di/core';
import type { BaseOptions } from './index.ts';
import type {
General,
GeneralObject,
ModuleInput as MI,
Orchestratable,
} from './types.ts';
import type { General, GeneralObject, ModuleInput as MI, Orchestratable } from './types.ts';
import type { Hook } from './utilities.ts';

type ModuleInput = MI<GeneralModuleCtor>;
Expand Down
14 changes: 7 additions & 7 deletions skill/example/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ export type GeneralArray = ReadonlyArray<General>;
export type GeneralObject = object;
export type GeneralConstructor = new (...args: General[]) => General;

type UnionToIntersection<U> =
(U extends General ? (k: U) => void : never) extends (
k: infer I,
) => void ? I
: never;
type UnionToIntersection<U> = (U extends General ? (k: U) => void : never) extends (
k: infer I,
) => void ? I
: never;

type GeneralModuleInput =
| ReadonlyArray<GeneralConstructor>
Expand All @@ -19,8 +18,9 @@ export type ModuleInput<T extends GeneralConstructor> =
| ReadonlyArray<T>
| ReadonlyArray<InstanceType<T>>;

type Instances<T extends GeneralModuleInput> = T extends
ReadonlyArray<GeneralConstructor> ? InstanceType<T[number]> : T[number];
type Instances<T extends GeneralModuleInput> = T extends ReadonlyArray<GeneralConstructor>
? InstanceType<T[number]>
: T[number];

export type Orchestratable<
T extends GeneralModuleInput,
Expand Down
21 changes: 8 additions & 13 deletions skill/start.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,10 @@ export type GeneralArray = ReadonlyArray<General>;
export type GeneralObject = object;
export type GeneralConstructor = new (...args: General[]) => General;

type UnionToIntersection<U> =
(U extends General ? (k: U) => void : never) extends (
k: infer I,
) => void ? I
: never;
type UnionToIntersection<U> = (U extends General ? (k: U) => void : never) extends (
k: infer I,
) => void ? I
: never;

type GeneralModuleInput =
| ReadonlyArray<GeneralConstructor>
Expand All @@ -76,8 +75,9 @@ export type ModuleInput<T extends GeneralConstructor> =
| ReadonlyArray<T>
| ReadonlyArray<InstanceType<T>>;

type Instances<T extends GeneralModuleInput> = T extends
ReadonlyArray<GeneralConstructor> ? InstanceType<T[number]> : T[number];
type Instances<T extends GeneralModuleInput> = T extends ReadonlyArray<GeneralConstructor>
? InstanceType<T[number]>
: T[number];

export type Orchestratable<
T extends GeneralModuleInput,
Expand Down Expand Up @@ -170,12 +170,7 @@ Create `BaseModule.ts` per the file system convention and write following code,

```TypeScript
import type { BaseOptions } from './index.ts'; // change or delete this to the path to `index.ts` (the loader) according to real base orchestration needs
import type {
General,
GeneralObject,
ModuleInput as MI,
Orchestratable,
} from './types.ts'; // change this to the real path of `types.ts`
import type { General, GeneralObject, ModuleInput as MI, Orchestratable } from './types.ts'; // change this to the real path of `types.ts`
import type { Hook } from './utilities.ts'; // change this to the real hook type you are using (question 5)
import type { Container } from '@needle-di/core'; // change or delete this according to your DI container needs (question)

Expand Down
16 changes: 8 additions & 8 deletions whitepaper.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"\n",
"Highly modularized and extensible application often embodies poorly managed types, SynthKernel breaks the hell by declarative type orchestration via advanced generics.\n",
"\n",
"For example, it is common for a module to define some configurable fields that can change the module's runtime behavior. Traditional application often uses a centralized configuration file to store these fields, which breaks the modularity by forcing modules to depend on a centralized configuration file. In SynthKernel, each module contribute their own atomic slices of configuration declaratively to the loader. Then the it merges these slices into a single object.\n",
"For example, it is common for a module to define some configurable fields that can change the module's runtime behavior. Traditional application often uses a centralized configuration file to store these fields, which breaks the modularity by forcing modules to depend on a centralized configuration file. In SynthKernel, each module contribute their own atomic slices of configuration declaratively to the loader. Then it merges these slices into a single object.\n",
"\n",
"For example, module A can declare a configuration field like this:\n",
"\n",
Expand Down Expand Up @@ -208,11 +208,10 @@
"type GeneralObject = object;\n",
"type GeneralConstructor = new (...args: General[]) => General;\n",
"\n",
"type UnionToIntersection<U> =\n",
"\t(U extends General ? (k: U) => void : never) extends (\n",
"\t\tk: infer I,\n",
"\t) => void ? I\n",
"\t\t: never;\n",
"type UnionToIntersection<U> = (U extends General ? (k: U) => void : never) extends (\n",
"\tk: infer I,\n",
") => void ? I\n",
"\t: never;\n",
"\n",
"type GeneralModuleInput =\n",
"\t| ReadonlyArray<GeneralConstructor>\n",
Expand All @@ -222,8 +221,9 @@
"\t| ReadonlyArray<T>\n",
"\t| ReadonlyArray<InstanceType<T>>;\n",
"\n",
"type Instances<T extends GeneralModuleInput> = T extends\n",
"\tReadonlyArray<GeneralConstructor> ? InstanceType<T[number]> : T[number];\n",
"type Instances<T extends GeneralModuleInput> = T extends ReadonlyArray<GeneralConstructor>\n",
"\t? InstanceType<T[number]>\n",
"\t: T[number];\n",
"\n",
"type Orchestratable<\n",
"\tT extends GeneralModuleInput,\n",
Expand Down