Skip to content

TypeError: kitsu_1.default is not a constructor #1047

Closed
@benchaikin

Description

@benchaikin

I'm attempting to use Kitsu 10.1.5 with Nest.js on node 22.6.0 with TypeScript 5.7.2.

import Kitsu from 'kitsu';

export class SomeService {
  private readonly api: Kitsu;
  
  constructor {
    this.api = new Kitsu({ baseURL: 'https://some.api.com/v1', pluralize: false });
  }
}

and getting the following error:

TypeError: kitsu_1.default is not a constructor

After some fiddling I was able to get it work with arguably one of the worst hacks of modern history:

import * as Kitsu from 'kitsu';

export class SomeService {
  private readonly api: Kitsu.default;
  
  constructor {
    const hack = Kitsu.default;
    const str = `new Kitsu({baseURL: 'https://some.api.com/v1', pluralize: false})`;
    this.api = eval(str);
  }
}

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions