Refactor DI container for better structure and clarity
- Moved `TSinjex` class to `classes` directory for better organization. - Updated imports across the codebase to reflect the new location of `TSinjex`. - Introduced `Identifier` type to standardize dependency identifiers. - Enhanced JSDoc comments for improved clarity and consistency. - Adjusted error messages for `DependencyResolutionError` to provide clearer information. - Updated and expanded decorator and function types to use `Identifier` type.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
/**
|
||||
* Generic constructor type.
|
||||
* This type is used to define a constructor of a class.
|
||||
*/
|
||||
export type GenericConstructor<
|
||||
T extends abstract new (...args: unknown[]) => InstanceType<T>,
|
||||
@@ -7,6 +8,6 @@ export type GenericConstructor<
|
||||
|
||||
/**
|
||||
* Force generic constructor type.
|
||||
* This type is used to force a class to be a constructor.
|
||||
* This type is used to force a class to has a constructor.
|
||||
*/
|
||||
export type ForceConstructor<T> = new (...args: unknown[]) => T;
|
||||
|
11
src/types/Identifier.ts
Normal file
11
src/types/Identifier.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* The dependency identifier.
|
||||
* You can use any string as identifier.
|
||||
* To create order, it is also possible to
|
||||
* provide these with a separator: `GroupA.ClassZ`.
|
||||
* The convection for naming is as follows:
|
||||
* The name should generally correspond to the interface that is relevant.
|
||||
* I.e. a class `ClassA` that implements the interface `IClassA` and is
|
||||
* registered as a dependent class is registered under the interface name `IClassA`.
|
||||
*/
|
||||
export type Identifier = string;
|
Reference in New Issue
Block a user