Rename TSInjex to TSinjex and Add Jest Setup in README

Renamed all instances of 'TSInjex' to 'TSinjex' for consistency across the codebase, including interfaces, classes, and test files. Updated the version in `package.json` from 0.0.5 to 0.0.6. Added Jest setup example to the `README.md` to guide developers on initial configuration for testing.
This commit is contained in:
2024-08-14 23:10:44 +02:00
parent ad4a8fd8c6
commit 771b810419
13 changed files with 222 additions and 200 deletions

View File

@@ -0,0 +1,70 @@
/**
* Static TSInjex Interface
*/
export interface ITSinjex_ extends ITSinjexRegister, ITSinjexResolve {
/**
* Get the **singleton** TSInjex instance.
*/
getInstance(): ITSinjex;
}
/**
* Register method for static and instance Dependency Injection Container.
*/
export interface ITSinjexRegister {
/**
* Register a dependency.
* @param identifier The identifier of the dependency.
* @param dependency The dependency to register.
* @param deprecated If true, the dependency is deprecated => a warning
* is logged when the dependency is resolved.
*/
register<T>(identifier: string, dependency: T, deprecated?: boolean): void;
/**
* Register a deprecated dependency.
* @param identifier The identifier of the dependency.
* @param dependency The dependency to register.
* @param deprecated A warning is logged when the dependency is resolved.
*/
register<T>(identifier: string, dependency: T, deprecated?: true): void;
/**
* Register a dependency.
* @param identifier The identifier of the dependency.
* @param dependency The dependency to register.
* @param deprecated No warning is logged when the dependency is resolved.
*/
register<T>(identifier: string, dependency: T, deprecated?: false): void;
}
/**
* Resolve method for static and instance Dependency Injection Container.
*/
export interface ITSinjexResolve {
/**
* Resolve a dependency
* @param identifier The identifier of the dependency
* @param necessary If true, throws an error if the dependency is not found
* @returns The resolved dependency or undefined if the dependency is not found
*/
resolve<T>(identifier: string, necessary?: boolean): T | undefined;
/**
* Resolve a necessary dependency.
* @param identifier The identifier of the dependency.
* @param necessary If true, throws an error if the dependency is not found.
* @returns The resolved dependency.
* @throws Error if the dependency is not found.
*/
resolve<T>(identifier: string, necessary?: true): T;
/**
* Resolve a non necessary dependency
* @param identifier The identifier of the dependency
* @param necessary Not necessary, does not throw an error if the dependency is not found.
* @returns The resolved dependency or undefined if the dependency is not found
*/
resolve<T>(identifier: string, necessary?: false): T | undefined;
}
/**
* TSInjex Interface
*/
export interface ITSinjex extends ITSinjexRegister, ITSinjexResolve {}