Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

elasticlunr: add type definitions #21779

Closed
wants to merge 2 commits into from

Conversation

AbraaoAlves
Copy link
Contributor

Please fill in this template.

  • Use a meaningful title for the pull request. Include the name of the package modified.
  • Test the change in your own code. (Compile and run.)
  • Follow the advice from the readme.
  • Avoid common mistakes.
  • Run npm run lint package-name (or tsc if no tslint.json is present).

Select one of these and delete the others:

If adding a new definition:

  • The package does not provide its own types, and you can not add them.
  • If this is for an NPM package, match the name. If not, do not conflict with the name of an NPM package.
  • Create it with dts-gen --dt, not by basing it on an existing project.
  • tslint.json should be present, and tsconfig.json should have noImplicitAny, noImplicitThis, strictNullChecks, and strictFunctionTypes set to true.

@dt-bot
Copy link
Member

dt-bot commented Nov 27, 2017

types/elasticlunr/configuration.d.ts

Checklist


types/elasticlunr/document_store.d.ts

Checklist


types/elasticlunr/event_emitter.d.ts

Checklist


types/elasticlunr/index.d.ts

Checklist


types/elasticlunr/indexr.d.ts

Checklist


types/elasticlunr/inverted_indexr.d.ts

Checklist


types/elasticlunr/pipeline.d.ts

Checklist


types/elasticlunr/sorted_set.d.ts

Checklist


types/elasticlunr/stemmer.d.ts

Checklist


types/elasticlunr/stop_word_filter.d.ts

Checklist


types/elasticlunr/tokenizer.d.ts

Checklist


types/elasticlunr/trimmer.d.ts

Checklist


types/elasticlunr/types.d.ts

Checklist


types/elasticlunr/utils.d.ts

Checklist

@typescript-bot typescript-bot added the New Definition This PR creates a new definition package. label Nov 27, 2017
@typescript-bot
Copy link
Contributor

typescript-bot commented Nov 27, 2017

@AbraaoAlves The Travis CI build failed! Please review the logs for more information. Once you've pushed the fixes, the build will automatically re-run. Thanks!

@typescript-bot
Copy link
Contributor

After 5 days, no one has reviewed the PR 😞. A maintainer will be reviewing the PR in the next few days and will either merge it or request revisions. Thank you for your patience!

@typescript-bot typescript-bot added Unmerged The author did not merge the PR when it was ready. and removed The Travis CI build failed labels Jan 8, 2018
@@ -0,0 +1,40 @@
import * as elasticlunr from 'elasticlunr';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Classes and functions cannot be imported using import * as syntax. Please fix either the test or the definition file to use a correct import form.

See also https://stackoverflow.com/questions/39415661/what-does-resolves-to-a-non-module-entity-and-cannot-be-imported-using-this

@typescript-bot typescript-bot removed this from Merge: YSYL in Pull Request Triage Backlog Jan 8, 2018
@typescript-bot typescript-bot added Revision needed This PR needs code changes before it can be merged. Awaiting reviewer feedback and removed Unmerged The author did not merge the PR when it was ready. labels Jan 8, 2018
@typescript-bot
Copy link
Contributor

typescript-bot commented Jan 8, 2018

@AbraaoAlves Thank you for submitting this PR!

Because this is a new definition, a DefinitelyTyped maintainer will be reviewing this PR in the next few days once the Travis CI build passes.

In the meantime, if the build fails or a merge conflict occurs, I'll let you know. Have a nice day!

*
* @constructor
*
* @param {String} config user configuration
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't include types in JSDoc, use TypeScript type declarations instead.

*
* @param {String} config user configuration
* @param {Array} fields fields of index instance
* @module
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem like a module?

* idx.search('oracle database', {fields: {title: {boost: 2}, body: {boost: 1}}});
*
*
* @constructor
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid unnecessary jsdoc tags like @constructor, @module and @memberOf -- this is clearly a constructor, we don't need documentation for that.

@@ -0,0 +1,123 @@
/*!
* elasticlunr.DocumentStore
* Copyright (C) @YEAR Wei Song
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the type definitions aren't under copyright, this comment shouldn't be included. (If they are, we'll have to review the license before merging.)

*
* @param {Integer|String} docRef document id or reference
* @param {String} fieldName field name
* @return {Integer} field length
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it returns an integer, the return type should be number.

// Project: https://github.com/weixsong/elasticlunr.js
// Definitions by: Abraão Alves <https://github.com/abraaoalves>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.5.2
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If possible use a lower version. Also, this can only be 2.X, not 2.X.Y.

"extends": "dtslint/dt.json",
"no-any-union": false,
"rules": {
"no-any-union": false,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please re-enable these lint rules, they are important warnings.
A type number | any will be interpreted as just any, so we warn for that. (In general try to avoid using any at all.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
New Definition This PR creates a new definition package.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants