Types improvements

This commit is contained in:
Aleksandr Kraiz
2022-11-28 13:43:55 +04:00
parent a6300ec2c8
commit 1913a84f1e
8 changed files with 37 additions and 32 deletions

View File

@@ -26,7 +26,7 @@ export function isUnknownObject(x: unknown): x is {
return x !== null && typeof x === 'object';
}
export function isKeyOfObject<T>(
export function isKeyOfObject<K extends string | number | symbol, T extends Record<K, unknown>>(
key: string | number | symbol,
obj: T,
): key is keyof T {