I accepted Nitzen Tomer because it was the main idea that I was going for.
As a more generalized solution, this is what I came across:
export function rest(object: any, remove: {[key: string]: any}) { let rest = Object.assign({}, object); Object.keys(remove).forEach(key => delete rest[key]); return rest; }
Therefore, I can use it as follows:
const {a, b, c} = props; const htmlProps = rest(props, {a, b, c});
And as soon as TypeScript supports the rest / spread object, I can just search for all rest() applications and simplify it to const {a, b, c, ...htmlProps} = props .
source share