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'.
Injected not working when disabled strictNullChecks. Because injected expect optional token.
Example: https://www.typescriptlang.org/play?strictNullChecks=false#code/JYWwDg9gTgLgBAbzsAdgKwKYGMYYCYA0cMEA1hinAL5wBmUEIcA5AEZQCGKewzA3AFgAUMKwAbDgGdJcAIKIqw0ROlwAQomFw4WCCkkwoAVxzQAFGCjAAbh1xwOALjkBKBIqEfReg3AAqZBQyALyaQtpOxIEoADyyAHxmzBzMLgRacKzOJOSxaolsqemeSiJCqJg4+GZqRAG5kgB0HC6CZUA
Error: