%% まずはType Aliases直前まで %%
- よほどシンプルな関数でなければ挙動をかえるオプションの引数型注釈には[[オブジェクト型 (TypeScript)|オブジェクト型]]を使う
> Just like when we used a type alias above, the example works just as if we had used an anonymous object type. TypeScript is only concerned with the structure of the value we passed to printCoord - it only cares that it has the expected properties. Being concerned only with the structure and capabilities of types is why we call TypeScript a structurally typed type system.
[[構造的部分型]]の概念は大事。名前のエイリアスであり、別名になったからといって違う型として扱われるわけではない。
- [[型エイリアス (TypeScript)|型エイリアス]]について、[[TypeScript 4.2#よりスマートな型の保持]]の効果は大きい
- [[インターフェース (TypeScript)|インターフェース]]はもとからこの問題がなかった
> For the most part, you can choose based on personal preference, and TypeScript will tell you if it needs something to be the other kind of declaration. If you would like a heuristic, use interface until you need to use features from type.
どちらを使うかは自由だが、こちらから何か言うとしたら『[[型エイリアス (TypeScript)|型エイリアス]]が必要になるまでは[[インターフェース (TypeScript)|インターフェース]]を使うでいいのでは』とのこと。
> Enums are a feature added to JavaScript by TypeScript which allows for describing a value which could be one of a set of possible named constants. Unlike most TypeScript features, this is not a type-level addition to JavaScript but something added to the language and runtime. Because of this, it’s a feature which you should know exists, but maybe hold off on using unless you are sure. You can read more about enums in the Enum reference page.
[[Enum (TypeScript)|Enum]]は[[ランタイム]]に対する機能だが、==使用は控える==こと。
[[bigint型 (TypeScript)|bigint型]]、存在は知っていたけど真面目に学習するのは初めて。
[[Symbol (JavaScript)|Symbol]]は毎回雰囲気で理解してる... つまり分かってない。