Cannot use with typescript: Adapter is not assignable to parameter of type Newable<any>
Author: kuba-orlikCreated Jan 17, 2025Updated Dec 12, 2025
When using this simple code:
import { Polly } from '@pollyjs/core';
import { default as XHRAdapter } from '@pollyjs/adapter-xhr';
import FetchAdapter from '@pollyjs/adapter-fetch';
import { default as NodeHTTPAdapter } from '@pollyjs/adapter-node-http';
// Register the xhr adapter so its accessible by all future polly instances
Polly.register(XHRAdapter);
Polly.register(FetchAdapter);
Polly.register(FetchAdapter);I'm getting the following error:
Argument of type 'typeof import("/my_project/node_modules/@pollyjs/adapter-xhr/types")' is not assignable to parameter of type 'Newable'.\n Type 'typeof import("/my_project/node_modules/@pollyjs/adapter-xhr/types")' provides no match for the signature 'new (...args: any[]): any'.
Source: Netflix/pollyjs