From 75167db9a830c9b523057d12cd551b0ee897a88c Mon Sep 17 00:00:00 2001 From: Eugene Daragan Date: Mon, 25 Mar 2024 21:53:09 +0100 Subject: [PATCH] Update README.md --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index ec5e798..d29589d 100644 --- a/README.md +++ b/README.md @@ -224,14 +224,14 @@ const container = new Container(); const child = container.childContainer(); class Land { - static scope = Scopes.Singleton(); + static scope = Scopes.Container(); } // register Land in the parent container container.inject(Land); class Garage { - // Land resolves to the singleton in the parent container + // Land resolves to the singleton from the the parent container constructor(private land = child.inject(Land)) {} open() { @@ -308,7 +308,7 @@ Please note that async injection has an undefined behavior when used with `Scope ## TypeScript -Dioma is written in TypeScript and provides type safety out of the box. It also supports generics: +Dioma is written in TypeScript and provides type safety out of the box: ```typescript import { inject, Scopes, Injectable } from "dioma"; @@ -324,12 +324,12 @@ class Database implements Injectable { static scope = Scopes.Singleton(); } -// bad, scope is not specified +// error, scope is not specified class Repository implements Injectable { constructor(private db = inject(Database)) {} } -inject(Repository); // type error +inject(Repository); // type error, scope is not specified ``` ## Author