File tree Expand file tree Collapse file tree
packages/happy-dom/src/console Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,17 +2,18 @@ import type IVirtualConsolePrinter from './IVirtualConsolePrinter.js';
22import VirtualConsoleLogLevelEnum from './enums/VirtualConsoleLogLevelEnum.js' ;
33import VirtualConsoleLogTypeEnum from './enums/VirtualConsoleLogTypeEnum.js' ;
44import type IVirtualConsoleLogGroup from './IVirtualConsoleLogGroup.js' ;
5- import type { ConsoleConstructor } from 'console' ;
65
76/**
87 * Virtual Console.
98 *
109 * @see https://developer.mozilla.org/en-US/docs/Web/API/Console
1110 */
1211export default class VirtualConsole implements Console {
13- // This is needed as the interface for the NodeJS Console also have a reference to the ConsoleConstructor class as a property for some reason.
14- // This is not part of the browser specs.
15- public declare Console : ConsoleConstructor ;
12+ // The NodeJS Console interface includes a reference to ConsoleConstructor as a property.
13+ // This is not part of the browser specs, but we need to declare it for type compatibility.
14+ // Using an indexed access type avoids importing from the 'console' module, which can fail
15+ // in consumer projects that don't resolve Node.js built-in module types.
16+ public declare Console : Console [ 'Console' ] ;
1617
1718 #printer: IVirtualConsolePrinter ;
1819 #count: { [ label : string ] : number } = { } ;
You can’t perform that action at this time.
0 commit comments