olivernn / lunr.js

A bit like Solr, but much smaller and not as bright
http://lunrjs.com
MIT License
8.89k stars 548 forks source link

Typescript: builder.field, builder.add missing 'attributes' param for lunr #385

Closed calumpeak closed 4 years ago

calumpeak commented 5 years ago

Hi!

We're integrating lunr into our typescript project and found that @types/lunr is missing the second param for both builder.field and builder.add. There may be others, I haven't had time to go through and check:

See: image

The typings in question:

        /**
         * Adds a field to the list of document fields that will be indexed. Every document being
         * indexed should have this field. Null values for this field in indexed documents will
         * not cause errors but will limit the chance of that document being retrieved by searches.
         *
         * All fields should be added before adding documents to the index. Adding fields after
         * a document has been indexed will have no effect on already indexed documents.
         *
         * @param field - The name of a field to index in all documents.
         */
        field(field: string): void;

And the code which it refers to: https://lunrjs.com/docs/builder.js.html#line95

Is this something that can be addressed/needs a PR?

lunr version 2.3.5, @types/lunr version 2.1.6

hoelzro commented 5 years ago

Hi @echoes221! The type definitions on NPM seem to be maintained at https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/lunr; I think making a PR against that repo would be the way forward!