Skip to content

Chai-As-Promised integration not working (possible Typescript clash?) #59

@weijie-tang

Description

@weijie-tang

When parsing the values of an array returned by a promise, I get weird behavior.

Given the following versions of chai, chai-things, chai-as-promised and typescript:

+-- types@chai@3.5.2
+-- types@chai-as-promised@0.0.30
+-- types@chai-things@0.0.32
+-- chai@3.5.0
+-- chai-as-promised@6.0.0
+-- chai-things@0.2.0
+-- typescript@2.4.1

And the following import order:

import chai = require('chai');
chai.use(require('chai-things'));
chai.use(require('chai-as-promised'));
const expect = chai.expect;

And the following assertions:

expect(Promise.resolve([{ test: 'test' }])).to.eventually.all.have.property('test', 'test');
Promise.resolve([{ test: 'test' }]).should.eventually.all.have.property('test', 'test');

I get the following error:

TS2339: Property 'have' does not exist on type 'PromisedKeyFilter'.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions