Skip to content

Commit

Permalink
fix: scope of Build()
Browse files Browse the repository at this point in the history
  • Loading branch information
exuanbo committed Oct 17, 2024
1 parent 5ad98fc commit dad478b
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,21 +107,21 @@ export class Registry {
export function Build<Value>(factory: (...args: []) => Value): Type<Value> {
const typeName = getTypeName(factory);
const token = Type<Value>(`Build<${typeName}>`);
const provider = {
useFactory: factory,
scope: Scope.Transient,
const registration = {
provider: {useFactory: factory},
options: {scope: Scope.Transient},
};
internals.set(token, {provider});
internals.set(token, registration);
return token;
}

export function Value<T>(value: T): Type<T> {
const typeName = getTypeName(value);
const token = Type<T>(`Value<${typeName}>`);
const provider = {
useValue: value,
const registration = {
provider: {useValue: value},
};
internals.set(token, {provider});
internals.set(token, registration);
return token;
}

Expand Down

0 comments on commit dad478b

Please sign in to comment.