Skip to content

Commit cfe9c77

Browse files
committed
Increase type safety
1 parent 4209a52 commit cfe9c77

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ export function Enum<
33
T extends { [_: string]: V },
44
V extends string
55
>(definition: T): T;
6-
export function Enum(...values: any[]): any {
6+
export function Enum(...values: any[]): object {
77
if (typeof values[0] === "string") {
88
const result: any = {};
99
for (const value of values) {
@@ -15,4 +15,4 @@ export function Enum(...values: any[]): any {
1515
}
1616
}
1717

18-
export type Enum<T> = T[keyof T];
18+
export type Enum<T extends object> = T[keyof T];

0 commit comments

Comments
 (0)