メインコンテンツまでスキップ

isWebviewSourceInfoHtml

WebviewSourceInfo がインライン HTML ソースかどうかを確認する型ガードです。

function isWebviewSourceInfoHtml(source: WebviewSourceInfoHtml): source is WebviewSourceInfoHtml

パラメータ

パラメータ説明
sourceWebviewSourceInfoHtml確認するソース情報

戻り値

source.type === "html" の場合に true を返し、型を WebviewSourceInfoHtml に絞り込みます。

const info = await webview.info();

if (isWebviewSourceInfoHtml(info.source as WebviewSourceInfoHtml)) {
console.log(info.source.content); // リストレスポンスでは undefined の場合あり
}