// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. export default function keyMirror(obj: T): { [K in keyof T]: K } { if (!(obj instanceof Object && !Array.isArray(obj))) { throw new Error('keyMirror(...): Argument must be an object.'); } const ret: any = {}; for (const key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { continue; } ret[key] = key; } return ret; }