Home > Enterprise >  Is it possible to add description to an array type in Typescript?
Is it possible to add description to an array type in Typescript?

Time:05-25

I have the following type(s):

const type Person = [string, number, number]

const type Person = [
  string, // name
  number, // age
  number // height
]

Is it possible to add comments to what the elements are? Or any conventions? Like with function: Where is the syntax for TypeScript comments documented?

CodePudding user response:

I think the closest solution is Labeled tuple elements

const type Person = [name: string, age: number, height: number]
  • Related