wiki icon indicating copy to clipboard operation
wiki copied to clipboard

Invalid types in ESM project

Open tgdn opened this issue 9 months ago • 0 comments

Declaration files are generated automatically and override the root declaration file index.d.ts which breaks TypeScript support.

Generated file in node_modules: image

Result: image

Alternative solution

The way around this is creating a file overrides.d.ts in src (or within your root directory), copy-pasting the content of index.d.ts within it but replacing the part declare module 'wikijs' { with

declare global {
  module "wikijs" {
	/* content of index.d.ts within "declare module 'wikijs'" { */

	/**
     * Default Options
     *
     * @interface Options
     */
    interface Options /* etc */
  }
}

Which solves it: image

tgdn avatar Apr 28 '24 17:04 tgdn