You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -303,6 +304,46 @@ Clears the cache of resolved factories. If you provide a type, that specific fac
303
304
304
305
Under the hood jpex converts types into strings for runtime resolution. If you want to get that calculated string for whatever reason, you can use `jpex.infer`
305
306
307
+
### Types
308
+
#### Jpex
309
+
This is the type definition for the jpex container
310
+
311
+
#### NodeModule
312
+
This is a special type that lets you automatically inject a node module with type inference.
313
+
314
+
For example:
315
+
```ts
316
+
importjpex, { NodeModule } from'jpex';
317
+
318
+
// this will resolve to the fs module without you having to explicitly register it as a dependency
319
+
constfs=jpex.resolve<NodeModule<'fs'>>();
320
+
```
321
+
322
+
The default return type will be `any` but you can specify one explicitly with the second type parameter:
Perhaps you hate typescript, or babel, or both. Or perhaps you don't have the luxury of a build pipeline in your application. That's fine because jpex supports vanilla js as well, you just have to explicitly state your dependencies up front:
0 commit comments