Object Properties
Last updated
Was this helpful?
Last updated
Was this helpful?
TypeScript โฉ
็ถๅฎฃๅ x?: T ๆ๏ผx ็ๅๅฅๅฏฆ้ไธๆฏ T | undefined
readonly properties can be modified via aliasingโ๏ธ
An index signature property type T must be either โstringโ or โnumberโ.
It is possible to support both types of indexers, but the type returned from a numeric indexer must be a subtype of the type returned from the string indexer. This is because when indexing with a number, JavaScript will actually convert that to a string before indexing into an object. That means:
a[100] === a["100"]
readonly ่ const ็ไฝ็จๅทฎไธๅค๏ผๆไฟ่ญท ไธๅๆดๆน๏ผไฝๅฐๆผ ไพ่ชช๏ผ้็ถไธ่ฝๆดๆน็ฉไปถๆฌ่บซ๏ผไฝๅฏๆดๆนๅ ถๅฑฌๆงใ
TypeScript ็ ้กไผผๆผ Swift ็ ใ