Skip to content

Commit 2fb42c3

Browse files
committed
Add optional typing for webview state in WebviewPanelSerializer
This makes it easier for extensions to correctly type their state if they wish
1 parent db01f71 commit 2fb42c3

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/vs/vscode.d.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7109,8 +7109,10 @@ declare module 'vscode' {
71097109
* VS Code will save off the state from `setState` of all webviews that have a serializer. When the
71107110
* webview first becomes visible after the restart, this state is passed to `deserializeWebviewPanel`.
71117111
* The extension can then restore the old `WebviewPanel` from this state.
7112+
*
7113+
* @param T Type of the webview's state.
71127114
*/
7113-
interface WebviewPanelSerializer {
7115+
interface WebviewPanelSerializer<T = unknown> {
71147116
/**
71157117
* Restore a webview panel from its serialized `state`.
71167118
*
@@ -7122,7 +7124,7 @@ declare module 'vscode' {
71227124
*
71237125
* @return Thenable indicating that the webview has been fully restored.
71247126
*/
7125-
deserializeWebviewPanel(webviewPanel: WebviewPanel, state: any): Thenable<void>;
7127+
deserializeWebviewPanel(webviewPanel: WebviewPanel, state: T): Thenable<void>;
71267128
}
71277129

71287130
/**

0 commit comments

Comments
 (0)