Skip to content

Commit bc0dd05

Browse files
Merge pull request #8 from stack-spot/feature/bridge-interface-console
feat: add log and error methods
2 parents 0313c3a + 337fe40 commit bc0dd05

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

packages/client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@stack-spot/vscode-async-webview-client",
3-
"version": "0.7.2",
3+
"version": "0.7.3",
44
"repository": "github:stack-spot/vscode-async-webview",
55
"main": "out/index.js",
66
"module": "out/index.mjs",

packages/client/src/VSCodeWebInterface.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ type Unpromisify<T> = T extends Promise<infer R> ? Unpromisify<R> : T
55
// extract only the functions of the Bridge and make every return type a Promise if not already
66
export type LinkedBridge<T> = Omit<{
77
[K in keyof T as T[K] extends (...args: any) => any ? K : never]:
8-
T[K] extends (...args: infer Args) => infer Return
9-
? (...args: Args) => Promise<Unpromisify<Return>>
10-
: never
8+
T[K] extends (...args: infer Args) => infer Return
9+
? (...args: Args) => Promise<Unpromisify<Return>>
10+
: never
1111
}, 'dispose' | 'stream'>
1212

1313
export interface VSCodeWebInterface<
@@ -59,4 +59,16 @@ export interface VSCodeWebInterface<
5959
* Client communicate that DOM are mounted
6060
*/
6161
setViewReady?: () => void,
62+
/**
63+
* Logs a message to the console.
64+
*
65+
* @param {string} text - The message to log.
66+
*/
67+
log(text: string): void,
68+
/**
69+
* Logs an error message to the console.
70+
*
71+
* @param {string} text - The error message to log.
72+
*/
73+
error(text: string): void
6274
}

0 commit comments

Comments
 (0)