Skip to content

Commit a61261b

Browse files
committed
deploy: ffe0330
1 parent e8e3f2f commit a61261b

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

basics/type-assertion.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ <h3 id="%E5%B0%86-any-%E6%96%AD%E8%A8%80%E4%B8%BA%E4%B8%80%E4%B8%AA%E5%85%B7%E4%
222222
<p>上面的例子中,我们调用完 <code>getCacheData</code> 之后,立即将它断言为 <code>Cat</code> 类型。这样的话明确了 <code>tom</code> 的类型,后续对 <code>tom</code> 的访问时就有了代码补全,提高了代码的可维护性。</p>
223223
<h2 id="%E7%B1%BB%E5%9E%8B%E6%96%AD%E8%A8%80%E7%9A%84%E9%99%90%E5%88%B6">类型断言的限制<a class="anchor" href="#%E7%B1%BB%E5%9E%8B%E6%96%AD%E8%A8%80%E7%9A%84%E9%99%90%E5%88%B6">§</a></h2>
224224
<blockquote>
225-
<p>本小结的前置知识点:[结构类型系统(TODO)][]、[类型兼容性(TODO)][]</p>
225+
<p>本小节的前置知识点:[结构类型系统(TODO)][]、[类型兼容性(TODO)][]</p>
226226
</blockquote>
227227
<p>从上面的例子中,我们可以总结出:</p>
228228
<ul>
@@ -422,7 +422,7 @@ <h2 id="%E7%B1%BB%E5%9E%8B%E6%96%AD%E8%A8%80-vs-%E7%B1%BB%E5%9E%8B%E5%A3%B0%E6%9
422422
<p>所以为了增加代码的质量,我们最好优先使用类型声明,这也比类型断言的 <code>as</code> 语法更加优雅。</p>
423423
<h2 id="%E7%B1%BB%E5%9E%8B%E6%96%AD%E8%A8%80-vs-%E6%B3%9B%E5%9E%8B">类型断言 vs 泛型<a class="anchor" href="#%E7%B1%BB%E5%9E%8B%E6%96%AD%E8%A8%80-vs-%E6%B3%9B%E5%9E%8B">§</a></h2>
424424
<blockquote>
425-
<p>本小结的前置知识点<a href="../advanced/generics.html">泛型</a></p>
425+
<p>本小节的前置知识点<a href="../advanced/generics.html">泛型</a></p>
426426
</blockquote>
427427
<p>还是这个例子:</p>
428428
<pre class="language-ts"><code class="language-ts"><span class="token keyword">function</span> <span class="token function">getCacheData</span><span class="token punctuation">(</span>key<span class="token operator">:</span> <span class="token builtin">string</span><span class="token punctuation">)</span><span class="token operator">:</span> <span class="token builtin">any</span> <span class="token punctuation">{</span>

basics/type-assertion_props.js

Lines changed: 5 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)