lunr: Use export as namespace instead of global declarations + declare module (#20045)

This commit is contained in:
Andy
2017-09-26 11:01:35 -07:00
committed by Mohamed Hegazy
parent c975ec52cd
commit 6d7f3012a1
3 changed files with 6 additions and 15 deletions

View File

@@ -4,6 +4,9 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
export as namespace lunr;
export = lunr;
/**
* lunr - http://lunrjs.com - A bit like Solr, but much smaller and not as bright
* Copyright (C) 2014 Oliver Nightingale
@@ -999,7 +1002,3 @@ declare namespace lunr {
* ```
*/
declare function lunr(config: lunr.ConfigFunction): lunr.Index;
declare module "lunr" {
export = lunr;
}

View File

@@ -22,12 +22,12 @@ function basic_test() {
function pipeline_test() {
const index = lunr(function() {
this.pipeline.add(function(token, tokenIndex, tokens) {
this.pipeline.add((token, tokenIndex, tokens) => {
// text processing in here
return token;
});
this.pipeline.after(lunr.stopWordFilter, function(token, tokenIndex, tokens) {
this.pipeline.after(lunr.stopWordFilter, (token, tokenIndex, tokens) => {
// text processing in here
return token;
});

View File

@@ -1,9 +1 @@
{
"extends": "dtslint/dt.json",
"rules": {
"ban-types": false,
"only-arrow-functions": [false],
"no-single-declare-module": false,
"no-unnecessary-qualifier": true
}
}
{ "extends": "dtslint/dt.json" }