Skip to content

Commit 6e75e9e

Browse files
committed
fix(typing): JSDoc on Console constructor
1 parent 520d3bd commit 6e75e9e

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

python/pythonmonkey/builtin_modules/console.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
const { customInspectSymbol, format } = require("util");
77

88
/** @typedef {(str: string) => void} WriteFn */
9+
/** @typedef {{ write: WriteFn }} IOWriter */
910

1011
/**
1112
* @see https://developer.mozilla.org/en-US/docs/Web/API/Console_API
@@ -21,14 +22,20 @@ class Console {
2122

2223
/**
2324
* Console constructor, form 1
24-
* @param {object} stdout - object with write method
25-
* @param {object} stderr - object with write method
26-
* @param {boolean} ignoreErrors - currently unused in PythonMonkey
25+
* @overload
26+
* @param {IOWriter} stdout - object with write method
27+
* @param {IOWriter} stderr - object with write method
28+
* @param {boolean=} ignoreErrors - currently unused in PythonMonkey
2729
* @see https://nodejs.org/api/console.html#new-consolestdout-stderr-ignoreerrors
2830
*/
2931
/**
3032
* Console constructor, form 2
31-
* @param {object} options - options object
33+
* @overload
34+
* @param {ConsoleConstructorOptions} options - options object
35+
* @typedef {object} ConsoleConstructorOptions
36+
* @property {IOWriter} stdout - object with write method
37+
* @property {IOWriter} stderr - object with write method
38+
* @property {boolean=} ignoreErrors - currently unused in PythonMonkey
3239
*/
3340
constructor(stdout, stderr, ignoreErrors)
3441
{

0 commit comments

Comments
 (0)