Is there any way to destructure arguments and write type annotation without repeating every key?
The following examples is pretty extreme, but it is such a pain to have to write it this way. Not only is it verbose and repetitive but you can easily end up with keys in different order, and the default value assignment becomes disconnected from the type annotation. It just seems like there has to be a better way to write this?
function projectToDataRow(
project: Project,
{
fieldsById,
customNames,
nestedCostRowsSources,
includeProjectTimePeriodData,
tags,
formatMessage,
portfolioBaselinePlanUsers,
attachments,
timeFrame,
weightsByFieldId,
includeAllocations = false,
includeTagsMetadata = false,
includeSpendPlanColumns = false,
includeDependenciesColumn = false
}: {
fieldsById: { [id: string]: Field; },
customNames: GroupedCustomNames,
nestedCostRowsSources?: NestedCostRowSources,
includeProjectTimePeriodData: boolean,
includeAllocations: boolean,
tags?: Tag[],
formatMessage?: FormatMessage,
portfolioBaselinePlanUsers?: PortfolioPlanUser[],
includeTagsMetadata: boolean,
attachments?: Attachment[],
timeFrame?: TimeFrame,
includeSpendPlanColumns: boolean,
includeDependenciesColumn: boolean,
weightsByFieldId?: Record<string, FieldWeight>
}
) {
}