Skip to main content

isWebviewSourceInfoHtml

Type guard that checks whether a WebviewSourceInfo is an inline HTML source.

function isWebviewSourceInfoHtml(source: WebviewSourceInfoHtml): source is WebviewSourceInfoHtml

Parameters

ParameterTypeDescription
sourceWebviewSourceInfoHtmlThe source info to check

Returns

true if source.type === "html", narrowing the type to WebviewSourceInfoHtml.

Example

const info = await webview.info();

if (isWebviewSourceInfoHtml(info.source as WebviewSourceInfoHtml)) {
console.log(info.source.content); // may be undefined in list responses
}