JavaScript/typescript/断言:修订间差异
来自康健生活
< JavaScript | typescript
| 第3行: | 第3行: | ||
[as语法 | <>语法]</pre></blockquote> | [as语法 | <>语法]</pre></blockquote> | ||
== undefined == | == undefined == | ||
如 body 值可能是 | 如 body 值可能是 undefined,使用 <code>as unknown</code> 断言。 | ||
<syntaxhighlight lang="javascript"> | <syntaxhighlight lang="javascript"> | ||
body as unknown as globalThis.FormData</syntaxhighlight> | body as unknown as globalThis.FormData</syntaxhighlight> | ||
2021年6月23日 (三) 11:47的版本
引言
[as语法 | <>语法]
undefined
如 body 值可能是 undefined,使用 as unknown 断言。
body as unknown as globalThis.FormData
No categories