Skip to content

Commit 3b333d1

Browse files
committed
fixed fromObject
1 parent 1479ef2 commit 3b333d1

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

src/Container.ts

+3-12
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,8 @@
11
import type { Memoized } from "./memoize";
22
import { isMemoized, memoize } from "./memoize";
33
import { PartialContainer } from "./PartialContainer";
4-
import type {
5-
AddService,
6-
AddServices,
7-
MapTokensToTypes,
8-
InjectableFunction,
9-
TokenType,
10-
ValidTokens,
11-
ServicesFromTokenizedParams,
12-
} from "./types";
4+
import type { AddService, AddServices, MapTokensToTypes, InjectableFunction, TokenType, ValidTokens } from "./types";
135
import { ConcatInjectable, Injectable } from "./Injectable";
14-
import { entries } from "./entries";
156

167
type MaybeMemoizedFactories<Services> = {
178
[K in keyof Services]: (() => Services[K]) | Memoized<() => Services[K]>;
@@ -150,8 +141,8 @@ export class Container<Services = {}> {
150141
* defines the initial set of services to be contained within the new Container instance.
151142
* @returns A new Container instance populated with the provided services.
152143
*/
153-
static fromObject<Services extends { [s: string]: any }>(services: Services): Container<Services> {
154-
return entries(services).reduce(
144+
static fromObject<Services extends { [s: TokenType]: any }>(services: Services): Container<Services> {
145+
return Object.entries(services).reduce(
155146
(container, [token, value]) => container.providesValue(token, value),
156147
new Container({})
157148
) as Container<Services>;

0 commit comments

Comments
 (0)