First check-in of the code from the Obsidian Prj project.
This commit is contained in:
12
src/types/GenericContructor.ts
Normal file
12
src/types/GenericContructor.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* Generic constructor type.
|
||||
*/
|
||||
export type GenericConstructor<
|
||||
T extends abstract new (...args: unknown[]) => InstanceType<T>,
|
||||
> = new (...args: ConstructorParameters<T>) => T;
|
||||
|
||||
/**
|
||||
* Force generic constructor type.
|
||||
* This type is used to force a class to be a constructor.
|
||||
*/
|
||||
export type ForceConstructor<T> = new (...args: unknown[]) => T;
|
9
src/types/InitDelegate.ts
Normal file
9
src/types/InitDelegate.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* A function type representing an initializer that transforms an input of type `T`
|
||||
* into an output of type `U`.
|
||||
* @template T - The type of the input parameter.
|
||||
* @template U - The type of the output parameter.
|
||||
* @param x - The input parameter of type `T`.
|
||||
* @returns The transformed output of type `U`.
|
||||
*/
|
||||
export type InitDelegate<T, U> = (x: T) => U;
|
Reference in New Issue
Block a user