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

fix: Using container.get/set methods with abstract class id #237

Open
dilame opened this issue Feb 24, 2021 · 7 comments
Open

fix: Using container.get/set methods with abstract class id #237

dilame opened this issue Feb 24, 2021 · 7 comments
Labels
status: fixed Issues with merged PRs, but not released yet. type: fix Issues describing a broken feature.

Comments

@dilame
Copy link

dilame commented Feb 24, 2021

Description

Here is the error message

TS2769: No overload matches this call.
  The last overload gave the following error.
    Argument of type 'typeof IgpapiHttp' is not assignable to parameter of type 'ServiceIdentifier<unknown>'.
      Type 'typeof IgpapiHttp' is not assignable to type 'Constructable<unknown>'.
        Cannot assign an abstract constructor type to a non-abstract constructor type.
src/igpapi.ts (56:24)

56     this.container.set(IgpapiHttp, http);
                          ~~~~~~~~~~

  ../../node_modules/typedi/types/container-instance.class.d.ts:50:5
    50     set<T = unknown>(token: ServiceIdentifier, instance: T): this;
           ~~~
    The last overload is declared here.

Here is the same error screenshot (maybe it's more comfortable to read the colored text for someone)

Снимок экрана 2021-02-24 в 20 05 58

Minimal code-snippet showcasing the problem

abstract class Foo {}

const container = new ContainerInstance('');

container.set(Foo, 1)

It doesn't work for TypeScript "strict": true mode,

@dilame dilame added status: needs triage Issues which needs to be reproduced to be verified report. type: fix Issues describing a broken feature. labels Feb 24, 2021
@NoNameProvided NoNameProvided added status: needs triage Issues which needs to be reproduced to be verified report. type: fix Issues describing a broken feature. and removed status: needs triage Issues which needs to be reproduced to be verified report. type: fix Issues describing a broken feature. labels Mar 9, 2021
@NoNameProvided
Copy link
Member

Hmm, this should work. I will need to take a look. Thanks for the report.

@NoNameProvided NoNameProvided removed the status: needs triage Issues which needs to be reproduced to be verified report. label Mar 9, 2021
@NoNameProvided
Copy link
Member

Fixed in aff2542. It will be included in the next release.

@NoNameProvided NoNameProvided added the status: fixed Issues with merged PRs, but not released yet. label Mar 9, 2021
@dilame
Copy link
Author

dilame commented Mar 19, 2021

Thank you!
When are you planning the next release?

@finwo
Copy link

finwo commented Nov 22, 2022

@NoNameProvided Is there any update on the next release?

@NoNameProvided
Copy link
Member

Hi! I am focusing on class-validator currently, but I will try to pick up the reins here as well and see what will be released and make it happen.

@viict
Copy link

viict commented May 25, 2023

@NoNameProvided hey, any update on this release? I just hit the same issue

@finwo
Copy link

finwo commented May 25, 2023

I eventually abandoned the library in favor of writing my own.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: fixed Issues with merged PRs, but not released yet. type: fix Issues describing a broken feature.
Development

No branches or pull requests

4 participants