Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(assert-injector): add assertInjector #17

Merged
merged 1 commit into from
Sep 11, 2023
Merged

Commits on Sep 11, 2023

  1. feat(assert-injector): add assertInjector

    closes #15
    
    This PR adds a utility function `assertInjector` that abstracts `assertInInjectionContext` and guarantees an `Injector` after the utility is invoked
    
    ```ts
    function injectDummy(injector?: Injector) {
      injector = assertInjector(injectDummy, injector);
      // ^ injector is guaranteed to be an Injector
      runInInjectionContext(injector, () => {
        // always run in a particular Injector's context
      })
    }
    ```
    nartc committed Sep 11, 2023
    Configuration menu
    Copy the full SHA
    16a3724 View commit details
    Browse the repository at this point in the history