Skip to content
Meirion Hughes edited this page Oct 5, 2017 · 5 revisions

By default, typescript should be able to infer the option-types based off the AbstractLevelDOWN (typed) implementation you give it. For example, given:

import levelup from 'levelup';
import leveldown from 'leveldown';
import encoding from 'encoding-down';

let db = levelup(encode(leveldown('./db')));

the db type will be inferred, and equivalent to:

type DbType = LevelUp<
  any,
  any,
  LevelDownOptions,
  LevelDownPutOptions & CodecOptions,
  LevelDownGetOptions & CodecOptions,
  LevelDownDeleteOptions & CodecOptions,
  LevelDownIteratorOptions & CodecOptions,
  LevelDownBatchOptions & CodecOptions>
Clone this wiki locally