Skip to content

Implementing ts-mocha is throwing type errors in Inject #2764

@Navos

Description

@Navos

Description / Steps to reproduce / Feature proposal

I've been trying to implement ts-mocha instead of the built in lb-mocha for faster test running and while I have taken care of the main issues within my code, one problem remains related to when inject checks if a getter or setter is a function.

The issue stems from the following lines: https://github.com/strongloop/loopback-next/blob/master/packages/context/src/inject.ts#L551 and https://github.com/strongloop/loopback-next/blob/master/packages/context/src/inject.ts#L426

When modifying the code and trying to make working adjustments, typeof targetType === 'function' returns true, but the check against the interface Function does not.

Current Behavior

The type of AuthenticateActionProvider.constructor[1] (Object) is not Setter function

Expected Behavior

It understand the given object is a function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    IoC/Context@loopback/context: Dependency Injection, Inversion of Controldeveloper-experienceIssues affecting ease of use and overall experience of LB usershelp wantedstale

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions