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

Injected not working when disabled strictNullChecks #26

Open
skrylnikov opened this issue Sep 12, 2022 · 1 comment
Open

Injected not working when disabled strictNullChecks #26

skrylnikov opened this issue Sep 12, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@skrylnikov
Copy link

skrylnikov commented Sep 12, 2022

Injected not working when disabled strictNullChecks. Because injected expect optional token.

Example:
https://www.typescriptlang.org/play?strictNullChecks=false#code/JYWwDg9gTgLgBAbzsAdgKwKYGMYYCYA0cMEA1hinAL5wBmUEIcA5AEZQCGKewzA3AFgAUMKwAbDgGdJcAIKIqw0ROlwAQomFw4WCCkkwoAVxzQAFGCjAAbh1xwOALjkBKBIqEfReg3AAqZBQyALyaQtpOxIEoADyyAHxmzBzMLgRacKzOJOSxaolsqemeSiJCqJg4+GZqRAG5kgB0HC6CZUA

import { injected, token } from 'brandi';

class A {}

class B {
  constructor(private a: A){}
}

const Tokens = {
  a: token<A>('a'),
  b: token<B>('b'),
}

injected(B, Tokens.a);

Error:

Argument of type 'Token<A>' is not assignable to parameter of type 'OptionalToken<A>'.
  Types of property '__o' are incompatible.
    Type 'false' is not assignable to type 'true'.
@skrylnikov skrylnikov changed the title Injected not working when disable strictNullChecks Injected not working when disabled strictNullChecks Sep 12, 2022
@vovaspace vovaspace added the bug Something isn't working label Oct 14, 2022
@kormanowsky
Copy link

Got the same bug, in v5.0.0. In v4.0.2 it works fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants