13 lines
243 B
TypeScript
13 lines
243 B
TypeScript
|
type ObjectKeys<T> =
|
||
|
T extends object
|
||
|
? `${Exclude<keyof T, symbol>}`[]
|
||
|
: T extends number
|
||
|
? []
|
||
|
: T extends any | string
|
||
|
? string[]
|
||
|
: never
|
||
|
|
||
|
interface ObjectConstructor {
|
||
|
keys<T> (o: T): ObjectKeys<T>
|
||
|
}
|