diff --git a/src/index.d.ts b/src/index.d.ts index aae1255..57cf79d 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -31,11 +31,7 @@ type ObjectLike = Record; * All the dependencies of the declared injectables on a registry */ export type FlatDependencyTree = - UnionToIntersection< - { - [key in keyof Registry]: Dependencies; - }[keyof Registry] - >; + UnionToIntersection>; /** * All the Injectables defined by a registry diff --git a/src/test.ts b/src/test.ts index 9b0e24f..e24c11b 100644 --- a/src/test.ts +++ b/src/test.ts @@ -260,6 +260,20 @@ createProvider: { // @ts-expect-error provideMissing({}); + const provideDeepMissing = createProvider({ + injectables: { + foo: ({ service }: { service: number }) => service, + service: ({ nonTypedDep }) => nonTypedDep, + bar: ({ typedDep }: { typedDep: string }) => typedDep, + }, + api: ['foo', 'bar'], + }); + provideDeepMissing({ typedDep: 'toto', nonTypedDep: 42 }); + // @ts-expect-error typedDep & nonTypedDep is missing here + provideDeepMissing(); + // @ts-expect-error typedDep & nonTypedDep is missing here + provideDeepMissing({}); + const provideWrongType = createProvider({ injectables: { foo: ({ val }: { val: number }) => val,