/** * This is a workaround helper to allow the usage of 'unknown' in * a type-guard function while checking that keys exist. * * @see https://github.com/microsoft/TypeScript/issues/21732 * @see https://stackoverflow.com/a/58630274 */ export function hasKey( k: K, o: T ): o is T & Record { return typeof o === 'object' && k in o; }