interface ScatterProps {
  // The data
	xs: number[];
	ys: number[];

  // Display
	xRange: [number, number];
	yRange: [number, number];
	color: string;

	// Events
  onClick: (x: number, y: number, index: number) => void;
}
const REQUIRES_UPDATE: {[k in keyof ScatterProps]: boolean} = {
	xs: true,
	ys: true,
	xRange: true,
	yRange: true,
	color: true,
	onClick: false,
};

function shouldUpdate(
	oldProps: ScatterProps,
	newProps: ScatterProps
) {
	let k: keyof ScatterProps;
	for (k in oldProps) {
		if (oldProps[k] !== newProps[k] && REQUIRES_UPDATE[k]) {
			return true;
		}
	}
	return false;
}

만약 ScatterProps에 새로운 속성을 추가한다면?

interface ScatterProps {
	// ...
	onDoubleClick: () => void;
}

const REQUIRES_UPDATE: {[k in keyof ScatterProps]: boolean} = {
// Property 'onDoubleClick' is missing in type ...
	xs: true,
	ys: true,
	xRange: true,
	yRange: true,
	color: true,
	onClick: false,
};

에러가 난다!