Initial commit

This commit is contained in:
garrettmills
2020-06-15 20:35:30 -05:00
commit 6c4696227b
19 changed files with 3225 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
import Instantiable from './Instantiable.ts'
const DEPENDENCY_KEYS_METADATA_KEY = 'daton:di:dependencyKeys.ts'
type DependencyKey = Instantiable<any> | string
export { DependencyKey, DEPENDENCY_KEYS_METADATA_KEY }

View File

@@ -0,0 +1,9 @@
import { DependencyKey } from './DependencyKey.ts'
interface DependencyRequirement {
param_index: number,
key: DependencyKey,
overridden: boolean,
}
export { DependencyRequirement }

View File

@@ -0,0 +1,9 @@
export default interface Instantiable<T> {
new(...args: any[]): T
}
const isInstantiable = (what: any): what is Instantiable<any> => {
return (typeof what === 'object' || typeof what === 'function') && 'constructor' in what && typeof what.constructor === 'function'
}
export { isInstantiable }