I would like to remove the tslint error I get on the following (in the object desctructuring parameter):
export function renameProperty(
oldProp: string,
newProp: string,
{[oldProp]: old, ...others}
): any {
return {
[newProp]: old,
...others
};
}
The error I get is on line 5:
TSLint: expected parameter: '{[oldProp]: old, ...others}' to have a typedef (typedef)
of course, I could do the following, but I'd rather simply do what satisfies Typescript's typing requirements.
export function renameProperty(
oldProp: string,
newProp: string,
// tslint:disable-next-line:typedef
{[oldProp]: old, ...others}
): any {
return {
[newProp]: old,
...others
};
}
Any answers on how to type def the {[oldProp]: old, ...others}
line?