Skip to content

Super constructor is not inspected for type info #277

Description

@emilefokkema

Describe the bug
When resolving a token that is a constructor, the base constructor is ignored

To Reproduce

import 'reflect-metadata'
import { container, injectable } from 'tsyringe'

class B {
    name = 'b'
}
class A {
    constructor(b: B) {
        if(!b){
            throw new Error('there should always be a b!')
        }
    }
}

@injectable()
class C extends A { }

container.resolve(C) // Throws 'there should always be a b!'

Expected behavior
No error should be thrown.

Version: 4.10.0

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions