Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ts2339: property 'should' does not exist on type Bluebird<boolean>

I wrote my mocha test in Typescript, and now I'm compiling it in es6

tsc *.ts --target es6 -m commonjs --watch

I get NO error in the console,
But in the WebStorm I get underlined every 'should' chai-keyword with red (when I hover it I get a message: ts2339: property 'should' does not exist on type Bluebird).

for example I'm using 'chai' and I want to check is expected value true:

import * as chai    from "chai";

export class WrapedChai {
     public shouldBeTrue(valueToTest : any){
        let expectedValue : boolean = true;
        expectedValue.should.equal(valueToTest);
    }
// or usintg SHOULD with a Promise
     public belongsToGLOErrorPromise(valueToTest: any) {
        let expectedValue   : boolean = true;
        return Promise.resolve(expectedValue).should.eventually.equal(valueToTest);
    } 
}

and should is always underlined in red.

I tried this:

import { should } from 'chai';
should();

and this:

import chai = require('chai');
var should = chai.should();

but 'should' stil stays underlined as an error.

like image 433
Zack Zilic Avatar asked Oct 19 '25 10:10

Zack Zilic


1 Answers

This can be solved with npm install @types/chai.

like image 60
Kevin Avatar answered Oct 21 '25 23:10

Kevin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!