Skip to content

Commit 154a287

Browse files
committed
fix: lint!
1 parent db652e3 commit 154a287

File tree

1 file changed

+22
-18
lines changed

1 file changed

+22
-18
lines changed

test/types/enum.test-d.ts

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-disable @typescript-eslint/no-unused-vars */
2-
import { expectType } from 'tsd';
2+
import { expectAssignable, expectType } from 'tsd';
33

44
import {
55
AuthMechanism,
@@ -21,23 +21,27 @@ import {
2121
TopologyType
2222
} from '../../src/index';
2323

24+
const num: number = Math.random();
25+
2426
// In our index.ts we clump CURSOR_FLAGS with the enums but its an array
25-
expectType<CursorFlag>(CURSOR_FLAGS[0]);
27+
expectType<CursorFlag>(CURSOR_FLAGS[num]);
28+
29+
// Explain is kept as type string so we can automatically allow any new level to be passed through
30+
expectAssignable<string>(Object.values(ExplainVerbosity)[num]);
2631

2732
// Note both the Enum name and a property on the enum are the same type
28-
// Object.values(x)[0] gets a union of the all the value types
29-
expectType<AuthMechanism>(Object.values(AuthMechanism)[0]);
30-
expectType<AutoEncryptionLoggerLevel>(Object.values(AutoEncryptionLoggerLevel)[0]);
31-
expectType<BatchType>(Object.values(BatchType)[0]);
32-
expectType<BSONType>(Object.values(BSONType)[0]);
33-
expectType<Compressor>(Object.values(Compressor)[0]);
34-
expectType<ExplainVerbosity>(Object.values(ExplainVerbosity)[0]);
35-
expectType<GSSAPICanonicalizationValue>(Object.values(GSSAPICanonicalizationValue)[0]);
36-
expectType<LoggerLevel>(Object.values(LoggerLevel)[0]);
37-
expectType<ProfilingLevel>(Object.values(ProfilingLevel)[0]);
38-
expectType<ReadConcernLevel>(Object.values(ReadConcernLevel)[0]);
39-
expectType<ReadPreferenceMode>(Object.values(ReadPreferenceMode)[0]);
40-
expectType<ReturnDocument>(Object.values(ReturnDocument)[0]);
41-
expectType<ServerApiVersion>(Object.values(ServerApiVersion)[0]);
42-
expectType<ServerType>(Object.values(ServerType)[0]);
43-
expectType<TopologyType>(Object.values(TopologyType)[0]);
33+
// Object.values(x)[num] gets a union of the all the value types
34+
expectType<AuthMechanism>(Object.values(AuthMechanism)[num]);
35+
expectType<AutoEncryptionLoggerLevel>(Object.values(AutoEncryptionLoggerLevel)[num]);
36+
expectType<BatchType>(Object.values(BatchType)[num]);
37+
expectType<BSONType>(Object.values(BSONType)[num]);
38+
expectType<Compressor>(Object.values(Compressor)[num]);
39+
expectType<GSSAPICanonicalizationValue>(Object.values(GSSAPICanonicalizationValue)[num]);
40+
expectType<LoggerLevel>(Object.values(LoggerLevel)[num]);
41+
expectType<ProfilingLevel>(Object.values(ProfilingLevel)[num]);
42+
expectType<ReadConcernLevel>(Object.values(ReadConcernLevel)[num]);
43+
expectType<ReadPreferenceMode>(Object.values(ReadPreferenceMode)[num]);
44+
expectType<ReturnDocument>(Object.values(ReturnDocument)[num]);
45+
expectType<ServerApiVersion>(Object.values(ServerApiVersion)[num]);
46+
expectType<ServerType>(Object.values(ServerType)[num]);
47+
expectType<TopologyType>(Object.values(TopologyType)[num]);

0 commit comments

Comments
 (0)