Object Properties

Optional

circle-exclamation
// 
interface PaintOptions {
  x?: number;              // โญ๏ธ optional
  y?: number;
}

/*
interface Shape {
  paint(opts: PaintOptions = {});
}
*/

const shape = getShape();

shape.paint({ });
shape.paint({ x: 100 });
shape.paint({ y: 100 });
shape.paint({ x: 100, y: 100 });

readonly

circle-info

readonly ่ˆ‡ const ็š„ไฝœ็”จๅทฎไธๅคš๏ผŒๆœƒไฟ่ญท Primitives ไธๅ—ๆ›ดๆ”น๏ผŒไฝ†ๅฐๆ–ผ Object ไพ†่ชช๏ผŒ้›–็„ถไธ่ƒฝๆ›ดๆ”น็‰ฉไปถๆœฌ่บซ๏ผŒไฝ†ๅฏๆ›ดๆ”นๅ…ถๅฑฌๆ€งใ€‚

triangle-exclamation

Index Signatures

circle-info

TypeScript ็š„ index signaturearrow-up-right ้กžไผผๆ–ผ Swift ็š„ subscriptarrow-up-rightใ€‚

circle-exclamation
triangle-exclamation

Last updated