4

My code is:

Object.keys(res.body.data).should.containEql('id')

The error that TypeScript gives me is

Property 'should' does not exist on type 'string[]'.

So how do I use should with TypeScript?

Shamoon
  • 41,293
  • 91
  • 306
  • 570

1 Answers1

5

You are missing the import of should library. Basically you need to import import 'should' to have access to should methods.

I have tested this code and it works! If I comment the import I had the same issue that you have.

import 'should';

describe('test', () => {

    it('should must work', () => {
        Object.keys({ a: 1, b: 2 }).should.containEql('b');
    })
})
Marco Talento
  • 2,335
  • 2
  • 19
  • 31