note:tue_jun_17_2025

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
note:tue_jun_17_2025 [2025/06/17 08:48] root1note:tue_jun_17_2025 [2025/06/17 13:00] (current) – [dokuwiki docker upgrade] lingao
Line 95: Line 95:
 </code> </code>
  
 +===== Tuple Map =====
  
 +we can use mapped types for creating tuples. It's because tuple properties are indexes.
 +
 +<code typescript>
 +type A<T extends unknown[]> = {
 + [P in keyof T] : T[P]
 +}
 +
 +type a =  A<[1,2,3]>
 +//   ^ type a = [1, 2, 3]
 +</code>
  • note/tue_jun_17_2025.1750150133.txt.gz
  • Last modified: 2025/06/17 08:48
  • by root1