I would like to convert this type
type A = [interestID: string, tags: string[], text: string, creatorID: string, createdAt: number]
to the following type:
type B = {
interestID: string,
tags: string[],
text: string,
creatorID: string,
createdAt: number
}
but I have no Idea...Is there any smart way for this?
Note: It is very similar to the following question but it is different that the elements of the pre-converted type is not fixed(changable in each array like string
, string[]
, ...).
TypeScript: tuple type to object type