TypeScript default import failing TypeScript default import failing typescript typescript

TypeScript default import failing


It looks like the expect namespace type is wrong in the npm package (@types/expect) You can make small workaround to save type checking:

import * as _expect from 'expect';const expect = _expect as any as typeof _expect.default;


It seems that your expect package version does not match its declaration. I just installed one and found it does have a default entry:

exports['default'] = expect;module.exports = exports['default'];


I had the same issue and fixed it by changing the import statement from

import expect from 'expect';

to

import * as expect from 'expect';

i.e. get the full module instead of just the default export