---
description: occurs when something can't be done on the subject of the statement.
---

# ⛔️ TypeError

[JS](..) ⟩ [error]() ⟩ TypeError

{% hint style="success" %}
([runtime](runtime "mention")) occurs when <mark style="color:yellow;">**some operation**</mark>**&#x20;**<mark style="color:red;">**can't**</mark>**&#x20;**<mark style="color:yellow;">**be performed**</mark> on the <mark style="color:yellow;">**subject**</mark> (value/object) of the statement. (that is, the <mark style="color:yellow;">**subject**</mark> of the <mark style="color:yellow;">**action**</mark> is of the "<mark style="color:red;">**wrong**</mark>" <mark style="color:yellow;">**type**</mark>, it isn't capable to do that kind of thing)
{% endhint %}

{% tabs %}
{% tab title="🔴 主題" %}
* [not-function](type/not-function "mention")
* [const-no-reassign](type/const-no-reassign "mention")
* [cannot-read-properties-of-nullish](type/cannot-read-properties-of-nullish "mention")
* [no-bigint-to-num](type/no-bigint-to-num "mention")
* [no-sym-to-num](type/no-sym-to-num "mention")
{% endtab %}

{% tab title="👥 相關" %}
* :no\_entry:[const](../variable/declare/const "mention") - can't be reassigned, redeclared:exclamation:
* :no\_entry: <mark style="color:red;">**TypeError**</mark> <mark style="color:yellow;">**thrown**</mark> <mark style="color:red;">**if**</mark> "[**optional chaining**](broken-reference)" **not used** to guard againt [<mark style="color:blue;">**nullish**</mark>](../val/prim/nullish):exclamation:
* :no\_entry:[obj-to-prim](../val/obj/convert/obj-to-prim "mention") may result in <mark style="color:red;">**TypeError**</mark>:exclamation:
{% endtab %}

{% tab title="📘 手冊" %}
* [TypeError](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypeError)
{% endtab %}

{% tab title="⭐️ 重點" %}
{% hint style="warning" %}
<mark style="color:yellow;">**calling**</mark> a [var](../variable/declare/var "mention") (as function) <mark style="color:red;">**before initialization**</mark> will cause a <mark style="color:red;">**TypeError**</mark> at [runtime](../compile/runtime "mention"):exclamation: 👉 [var](../scope/hoist/variable/var "mention")
{% endhint %}
{% endtab %}
{% endtabs %}
