book
book copied to clipboard
Wouldn't the following sample code be better? (タプル型の例としては異なる型のペアのほうが例として好ましくないですか?)
Features of TypeScript. Advanced type expression. 2. Tuple type: A type that allows you to specify a different type for each element of the array. type Point2D = [number, number];
https://github.com/yytypescript/book/blob/93c3a5c342988a97274a1eea4d09ab8a6cdaf201/docs/overview/features.md?plain=1#L56
Wouldn't the following sample code be better? type Point2D = [number, string];
Certainly! Having different types in a tuple indeed showcases the unique capability of tuple types more effectively. However, including a string in Point2D
might seem unnatural, suggesting that a significant change to the example could be beneficial.
ja: たしかに!異なる型同士のほうが、タプル型らしさが出ますね。Point2D
がstringを持つのは不自然なので、例を大きく変える必要はありそうですね。