oclif / command

oclif base command

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

tsc error: `PromiseLike<any> is not assignable to Promise<any>`

shazron opened this issue · comments

I was using v.1.5.0, but as soon as I upgraded to v1.5.4 or greater I see this error in my posttest script: tsc -p test --noEmit. (same result if I used the typescript package)

Error log:

node_modules/@oclif/command/lib/main.d.ts:3:22 - error TS2417: Class static side 'typeof Main' incorrectly extends base class static side 'typeof Command'.
  Types of property 'run' are incompatible.
    Type '(argv?: string[] | undefined, options?: LoadOptions) => PromiseLike<any>' is not assignable to type '(argv: string[], config?: LoadOptions) => Promise<any>'.
      Type 'PromiseLike<any>' is missing the following properties from type 'Promise<any>': catch, [Symbol.toStringTag], finally

3 export declare class Main extends Command {
                       ~~~~


Found 1 error.

Looks like tsc is looking into node_modules, thus this is tsc error.

In case anyone encounters the same thing, you need the --skipLibCheck option for tsc

commented

is your typescript version old maybe? I updated to typescript 3.3

Ah yes: "typescript": "^3.2.2"