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
When you inject an object with a property of .then but its not a promise, it resolves to undefined. This is because when resolving it believes that its a promise when its not
Expected Behavior
This should pass...
import { expect } from "chai";
import { Container, inject, injectable } from "../../src/inversify";
describe("Issue", () => {
it("It should not return injected value as undefined if the value contains a .then property but it is not a promise", () => {
const container = new Container();
interface Injected {
myProperty: string;
then: () => number;
}
@injectable()
class ResolveMe {
constructor(@inject("Injected") public injected: Injected) {}
}
container.bind("Injected").toConstantValue({
myProperty: "myNewProperty",
then: () => 1
});
const me = container.resolve(ResolveMe);
expect(me.injected.myProperty).to.eql("myNewProperty");
});
});
When you inject an object with a property of
.then
but its not a promise, it resolves to undefined. This is because when resolving it believes that its apromise
when its notExpected Behavior
This should pass...
Current Behavior
injected
resolves to undefinedPossible Solution
I have linked a PR for a possible approach #1571
The text was updated successfully, but these errors were encountered: