Comparing version 4.0.0-rc-7 to 4.0.0-rc-8
@@ -6,4 +6,4 @@ "use strict"; | ||
const workWithDiSettings_js_1 = require("../workWithDiSettings.js"); | ||
function inject(...dependencies) { | ||
return (constructor, context) => { | ||
exports.inject = ((...dependencies) => { | ||
return (constructor) => { | ||
(0, workWithDiSettings_js_1.workWithDiSettings)(constructor, (settings) => { | ||
@@ -16,4 +16,3 @@ const metadata = (0, findMetadata_js_1.findOrCreateMetadata)(settings); | ||
}; | ||
} | ||
exports.inject = inject; | ||
}); | ||
//# sourceMappingURL=inject.js.map |
import { findOrCreateMetadata } from '../findMetadata.js'; | ||
import { workWithDiSettings } from '../workWithDiSettings.js'; | ||
export function inject(...dependencies) { | ||
return (constructor, context) => { | ||
export const inject = ((...dependencies) => { | ||
return (constructor) => { | ||
workWithDiSettings(constructor, (settings) => { | ||
@@ -12,3 +12,3 @@ const metadata = findOrCreateMetadata(settings); | ||
}; | ||
} | ||
}); | ||
//# sourceMappingURL=inject.js.map |
import { Constructor, SomeDependency } from '../types.js'; | ||
export declare function inject<TClass extends Constructor>(...dependencies: SomeDependency[]): (constructor: TClass, context?: ClassDecoratorContext) => TClass; | ||
export interface InjectDecorator { | ||
<TClass extends Constructor>(...dependencies: SomeDependency[]): (constructor: TClass, context: ClassDecoratorContext) => TClass; | ||
<TClass extends Constructor>(...dependencies: SomeDependency[]): (constructor: TClass) => TClass; | ||
} | ||
export declare const inject: InjectDecorator; |
@@ -11,3 +11,2 @@ export * from './cheapDiSymbol.js'; | ||
import { ContainerImpl } from './ContainerImpl.js'; | ||
import { inject } from './decorators/inject.js'; | ||
import { findMetadata, findOrCreateMetadata } from './findMetadata.js'; | ||
@@ -21,3 +20,3 @@ import { isSingleton } from './isSingleton.js'; | ||
ContainerImpl: typeof ContainerImpl; | ||
inject: typeof inject; | ||
inject: import("./decorators/inject.js").InjectDecorator; | ||
findMetadata: typeof findMetadata; | ||
@@ -24,0 +23,0 @@ findOrCreateMetadata: typeof findOrCreateMetadata; |
{ | ||
"name": "cheap-di", | ||
"description": "TypeScript dependency injection like Autofac in .Net", | ||
"version": "4.0.0-rc-7", | ||
"version": "4.0.0-rc-8", | ||
"scripts": { | ||
@@ -6,0 +6,0 @@ "compile": "tsc --build tsconfig.cjs.json ./tsconfig.esm.json ./tsconfig.types.json", |
@@ -103,2 +103,14 @@ # cheap-di | ||
To use stage 2 decorators you need to adjust your tsconfig.json like: | ||
```json | ||
{ | ||
"compilerOptions": { | ||
// ... | ||
"experimentalDecorators": true | ||
} | ||
} | ||
``` | ||
To use stage 3 decorators you don't need extra setup. | ||
## <a name="registration-variants"></a> Registration variants | ||
@@ -105,0 +117,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
226347
2249
209