DefinitelyTyped/types/nspell/nspell-tests.ts
Ulrich Block 667f23ccc8
[nspell] add types and tests for v2.1 (#46293)
* [nspell] add types and tests for v2.1

* rename to plural tests

* There is no UMD

* address linter errors and add testing comments

* address review comments by switching to callable class

* revert errornous change

* address review second part

* add esModuleInterop flag

without the flag npm run test fails.
It would not fail if "export default NSpell" would be used in combination with a "npm-naming" rule
2020-07-24 11:10:38 -07:00

35 lines
820 B
TypeScript

import nspell from 'nspell';
// $ExpectType NSpell
nspell('');
// $ExpectType NSpell
nspell(new Buffer(''));
// $ExpectType NSpell
nspell(new Buffer(''), new Buffer(''));
// $ExpectType NSpell
nspell({ aff: new Buffer(''), dic: new Buffer('') });
// $ExpectType NSpell
nspell([{ aff: new Buffer('') }, { aff: new Buffer('') }]);
const spell = nspell('', '');
// $ExpectType boolean
spell.correct('');
// $ExpectType string[]
spell.suggest('');
// $ExpectType SpellCheck
spell.spell('');
// $ExpectType NSpell
spell.add('');
// $ExpectType NSpell
spell.remove('');
// $ExpectType string | undefined
spell.wordCharacters();
// $ExpectType NSpell
spell.dictionary('');
// $ExpectType NSpell
spell.dictionary(new Buffer(''));
// $ExpectType NSpell
spell.personal('');
// $ExpectType NSpell
spell.personal(new Buffer(''));