question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Typings issue in v3.3.0

See original GitHub issue

When using Listr2 in a TypeScript project I am getting the following TSC error when using v3.3.0:

../../node_modules/listr2/dist/lib/task-wrapper.d.ts:27:5 - error TS2416: Property 'run' in type 'TaskWrapper<Ctx, Renderer>' is not assignable to the same property in base type 'ListrTaskWrapper<Ctx, Renderer>'.
  Type '(ctx: Ctx) => Promise<void>' is not assignable to type '(ctx?: Ctx | undefined, task?: ListrTaskWrapper<Ctx, Renderer> | undefined) => Promise<void>'.
    Types of parameters 'ctx' and 'ctx' are incompatible.
      Type 'Ctx | undefined' is not assignable to type 'Ctx'.
        'Ctx' could be instantiated with an arbitrary type which could be unrelated to 'Ctx | undefined'.
          Type 'undefined' is not assignable to type 'Ctx'.
            'Ctx' could be instantiated with an arbitrary type which could be unrelated to 'undefined'.

27     run(ctx: Ctx): Promise<void>;

It compiles fine with the previous v3.2.3.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:14 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
cenk1cenk2commented, Jan 31, 2021

Mr. @appkaiju, I tried that some other way setting the default context to any | undefined because it gets injected from the main class to the task wrapper, but the combination of that with converting run from arrow function seems to solve the issue. I will merge it to the main branch now.

https://repl.it/@CenkKl/List2-repro#index.js

Sorry this took a little bit more than expected, I had some computer problems.

1reaction
gamekaijucommented, Jan 30, 2021

Hi, @cenk1cenk2. Do you think that changing TaskWrapper.d.ts to run(ctx: Ctx | undefined): Promise<void>;. would be enough? I don’t see any issues with it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeScript v 3.0.3: Cannot find global type 'Promise' #2244
I am seeing the following error while trying to compile using TypesScript v3.0.3. There is no context other than what you see below....
Read more >
Documentation - TypeScript 3.0
TypeScript 3.0 introduces a new concept of project references. Project references allow TypeScript projects to depend on other TypeScript projects ...
Read more >
angular - typings install permission error
This is already answered at. npm install error unable to read typings. Try few options available there. the last one worked for me....
Read more >
Small issue with new version v3.3.0 (linked scripts) - Get help
Following the update (Web version) quite a few of my scripts fell over! in particular some (not all) references were suddenly dropped (even...
Read more >
Support for type hints — Python 3.11.1 documentation
Source code: Lib/typing.py This module provides runtime support for type hints. ... The problem with this approach is that a class had to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found