8000 (another) TypeScript error TS2742 when calling subclass with plugins option · Issue #35 · ehmicky/modern-errors · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
(another) TypeScript error TS2742 when calling subclass with plugins option #35
Closed
@benkroeger

Description

@benkroeger

Guidelines

  • Please search other issues to make sure this bug has not already been reported.

Describe the bug

Typescript compiler complains about inferred type of result of .subclass not being portable

Image

similar issue was reported in #18 and #32

can be fixed with pnpm patch like this:

diff --git a/build/src/main.d.ts b/build/src/main.d.ts
index 02fa22b354cb256d8cbfabe4c3fe20d53a9995e9..625fea03ec727e545c619b16f9d60bdb6a5f008b 100644
--- a/build/src/main.d.ts
+++ b/build/src/main.d.ts
@@ -7,7 +7,7 @@ export type { InstanceOptions } from './options/instance.js'
 export type { MethodOptions } from './options/method.js'
 export type { Info } from './plugins/info/main.js'
 export type { Plugin } from './plugins/shape/main.js'
-export type { ErrorClass }
+export type { ErrorClass, SpecificErrorClass }
 
 /**
  * Top-level `ErrorClass`.

Steps to reproduce

import ModernError from 'modern-errors';
import modernErrorsSerialize from 'modern-errors-serialize';

export const BaseError = ModernError.subclass('BaseError', { plugins: [modernErrorsSerialize], serialize: { exclude: ['stack', 'pluginsOpts'] } });
export const UnknownError = BaseError.subclass('UnknownError');

Environment

System:
OS: macOS 15.3.2
CPU: (16) arm64 Apple M3 Max
Memory: 6.74 GB / 48.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.14.0 - ~/Library/pnpm/node
npm: 10.9.2 - ~/Library/pnpm/npm
pnpm: 10.8.0 - ~/Library/pnpm/pnpm
Browsers:
Chrome: 135.0.7049.96
Safari: 18.3.1
npmPackages:
modern-errors: ^7.0.3 => 7.0.3

Pull request (optional)

  • I can submit a pull request.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0