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

Support TS 3.8 with full type safety #20

Closed
nicojs opened this issue Mar 21, 2020 · 0 comments · Fixed by #43
Closed

Support TS 3.8 with full type safety #20

nicojs opened this issue Mar 21, 2020 · 0 comments · Fixed by #43

Comments

@nicojs
Copy link
Owner

nicojs commented Mar 21, 2020

Due to microsoft/TypeScript#37400 it is allowed to assign a parent injector to a child injector.

const fooInjector: Injector<{foo: string}> = rootInjector;
// ERROR in TS <3.8
// OK According to TS >= 3.8

fooInjector.resolve('foo'); // Breaks at runtime!!

I'll close this issue once it's fixed at TS side.

nicojs added a commit that referenced this issue Dec 14, 2021
TS variance check finally solved! 🎅

```ts
// Error below: Property 'foo' is missing in type '{}' but required in type '{ foo: string; }
const fooInjector: Injector<{ foo: string }> = createInjector();
```

closes #20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant