Skip to content

Commit

Permalink
use expectAssignable instead of expectType
Browse files Browse the repository at this point in the history
  • Loading branch information
emadum committed Jul 21, 2021
1 parent d0ba75f commit 56ae872
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions test/types/index_options.test-d.ts
@@ -1,25 +1,25 @@
import { expectType, expectNotType } from 'tsd';
import { expectAssignable, expectNotAssignable } from 'tsd';
import type { IndexDescription } from '../../src';

// test that all valid index options are allowed in IndexDefinitions
expectType<IndexDescription>({ key: {}, background: true });
expectType<IndexDescription>({ key: {}, expireAfterSeconds: 2400 });
expectType<IndexDescription>({ key: {}, name: 'index_1' });
expectType<IndexDescription>({ key: {}, sparse: true });
expectType<IndexDescription>({ key: {}, storageEngine: {} });
expectType<IndexDescription>({ key: {}, unique: true });
expectType<IndexDescription>({ key: {}, version: 1 });
expectType<IndexDescription>({ key: {}, default_language: 'english' });
expectType<IndexDescription>({ key: {}, language_override: 'english' });
expectType<IndexDescription>({ key: {}, textIndexVersion: 2 });
expectType<IndexDescription>({ key: {}, weights: {} });
expectType<IndexDescription>({ key: {}, '2dsphereIndexVersion': 2 });
expectType<IndexDescription>({ key: {}, bits: 1 });
expectType<IndexDescription>({ key: {}, max: 1.1 });
expectType<IndexDescription>({ key: {}, min: 9.9 });
expectType<IndexDescription>({ key: {}, bucketSize: 100 });
expectType<IndexDescription>({ key: {}, partialFilterExpression: {} });
expectType<IndexDescription>({ key: {}, collation: { locale: 'en' } });
expectType<IndexDescription>({ key: {}, wildcardProjection: {} });
expectType<IndexDescription>({ key: {}, hidden: true });
expectNotType<IndexDescription>({ key: {}, invalidOption: 2400 });
// test that all valid index options are allowed in IndexDescription
expectAssignable<IndexDescription>({ key: {}, background: true });
expectAssignable<IndexDescription>({ key: {}, expireAfterSeconds: 2400 });
expectAssignable<IndexDescription>({ key: {}, name: 'index_1' });
expectAssignable<IndexDescription>({ key: {}, sparse: true });
expectAssignable<IndexDescription>({ key: {}, storageEngine: {} });
expectAssignable<IndexDescription>({ key: {}, unique: true });
expectAssignable<IndexDescription>({ key: {}, version: 1 });
expectAssignable<IndexDescription>({ key: {}, default_language: 'english' });
expectAssignable<IndexDescription>({ key: {}, language_override: 'english' });
expectAssignable<IndexDescription>({ key: {}, textIndexVersion: 2 });
expectAssignable<IndexDescription>({ key: {}, weights: {} });
expectAssignable<IndexDescription>({ key: {}, '2dsphereIndexVersion': 2 });
expectAssignable<IndexDescription>({ key: {}, bits: 1 });
expectAssignable<IndexDescription>({ key: {}, max: 1.1 });
expectAssignable<IndexDescription>({ key: {}, min: 9.9 });
expectAssignable<IndexDescription>({ key: {}, bucketSize: 100 });
expectAssignable<IndexDescription>({ key: {}, partialFilterExpression: {} });
expectAssignable<IndexDescription>({ key: {}, collation: { locale: 'en' } });
expectAssignable<IndexDescription>({ key: {}, wildcardProjection: {} });
expectAssignable<IndexDescription>({ key: {}, hidden: true });
expectNotAssignable<IndexDescription>({ key: {}, invalidOption: 2400 });

0 comments on commit 56ae872

Please sign in to comment.