Standardize file naming and improve typings export

Renamed functions files to follow consistent camelCase convention. Added a missing type export for ITSInjex interface in the main index file, enabling better TypeScript type support and ensuring interfaces are available for external modules.
This commit is contained in:
2024-08-14 21:39:59 +02:00
parent c1a4dc7bd0
commit 3c308635dd
3 changed files with 1 additions and 2 deletions

33
src/functions/resolve.ts Normal file
View File

@@ -0,0 +1,33 @@
import { DependencyResolutionError } from '../interfaces/Exceptions';
import { TSInjex } from '../TSInjex';
/**
* Resolve a dependency.
* @param identifier The identifier of the dependency.
* @returns The resolved dependency.
* @throws A {@link DependencyResolutionError} if the dependency is not found.
*/
export function resolve<T>(identifier: string): T;
/**
* Resolve a dependency
* @param identifier The identifier of the dependency.
* @param necessary The dependency is **not** necessary.
* @returns The resolved dependency or undefined if the dependency is not found.
*/
export function resolve<T>(identifier: string, necessary: false): T | undefined;
/**
* 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 necessary
* and not found, or throws an error if the dependency is necessary and not found.
* @throws A {@link DependencyResolutionError} if the dependency is not found and necessary.
*/
export function resolve<T>(
identifier: string,
necessary?: boolean,
): T | undefined {
return TSInjex.getInstance().resolve<T>(identifier, necessary);
}