Models unit; session model; generalize session classes/interfaces
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import Instantiable from './Instantiable.ts'
|
||||
import {StaticClass} from './StaticClass.ts'
|
||||
const DEPENDENCY_KEYS_METADATA_KEY = 'daton:di:dependencyKeys.ts'
|
||||
type DependencyKey = Instantiable<any> | StaticClass<any> | string
|
||||
type DependencyKey = Instantiable<any> | StaticClass<any, any> | string
|
||||
export { DependencyKey, DEPENDENCY_KEYS_METADATA_KEY }
|
||||
|
||||
@@ -2,7 +2,7 @@ export default interface Instantiable<T> {
|
||||
new(...args: any[]): T
|
||||
}
|
||||
|
||||
const isInstantiable = (what: any): what is Instantiable<any> => {
|
||||
const isInstantiable = <T>(what: any): what is Instantiable<T> => {
|
||||
return (typeof what === 'object' || typeof what === 'function') && 'constructor' in what && typeof what.constructor === 'function'
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
export type StaticClass<T> = Function & {prototype: T}
|
||||
export type StaticClass<T, T2> = Function & {prototype: T} & T2
|
||||
|
||||
export function isStaticClass<T>(something: any): something is StaticClass<T> {
|
||||
export function isStaticClass<T, T2>(something: any): something is StaticClass<T, T2> {
|
||||
return typeof something === 'function' && typeof something.prototype !== 'undefined'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user