zhan-huang / js-solr-highlighter

A JavaScript library for highlighting text based on the query in the lucene/solr query syntax
MIT License
2 stars 0 forks source link

Incorrect type assigned to result of exec() #1

Closed Raul52 closed 1 year ago

Raul52 commented 1 year ago

Hello,

If you are having a tsconfig using strictNullChecks to true, the library will fail to build.

Error: node_modules/js-solr-highlighter/index.ts:106:11 - error TS2322: Type 'RegExpExecArray | null' is not assignable to type 'RegExpExecArray'. Type 'null' is not assignable to type 'RegExpExecArray'.

Can you please adapt the code and change the line 96 to let res: RegExpExecArray | null?

Thank you!

zhan-huang commented 1 year ago

Hi,

Make sense to me. I will do as required today.

Thank you for your feedback!

zhan-huang commented 1 year ago

Changed as required (also deployed to npm). Close this issue now.