Bug report
When using the latest @types/node in conjunction with webpack, I get the following:
node_modules/webpack/types.d.ts:15875:15 - error TS2417: Class static side 'typeof WebpackError' incorrectly extends base class static side '{ readonly prototype: Error; captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void; prepareStackTrace(err: Error, stackTraces: CallSite[]): any; stackTraceLimit: number; }'.
Types of property 'prepareStackTrace' are incompatible.
Type '((err: Error, stackTraces: CallSite[]) => any) | undefined' is not assignable to type '(err: Error, stackTraces: CallSite[]) => any'.
Type 'undefined' is not assignable to type '(err: Error, stackTraces: CallSite[]) => any'.
15875 declare class WebpackError extends Error {
~~~~~~~~~~~~
Found 1 error in node_modules/webpack/types.d.ts:15875
What is the current behavior?
Fails type checking.
What is the expected behavior?
Passes type checking.
Other relevant information:
webpack version: 5.99.7
Node.js version: Irrelevant
Operating System: Irrelevant
Steps to reproduce:
mkdir webpack-type-error
cd webpack-type-error
npm init -y
npm i typescript webpack @types/node
npx tsc --init --module nodenext --moduleResolution nodenext --skipLibCheck false
echo "import * as webpack from 'webpack'; console.log(webpack);" > index.ts
npx tsc --noEmit
Fix:
change:
static prepareStackTrace?: (err: Error, stackTraces: NodeJS.CallSite[]) => any;
to:
static prepareStackTrace: (err: Error, stackTraces: NodeJS.CallSite[]) => any;
Bug report
When using the latest @types/node in conjunction with webpack, I get the following:
What is the current behavior?
Fails type checking.
What is the expected behavior?
Passes type checking.
Other relevant information:
webpack version: 5.99.7
Node.js version: Irrelevant
Operating System: Irrelevant
Steps to reproduce:
Fix:
change:
static prepareStackTrace?: (err: Error, stackTraces: NodeJS.CallSite[]) => any;to:
static prepareStackTrace: (err: Error, stackTraces: NodeJS.CallSite[]) => any;