capacitor-community / barcode-scanner

A fast and efficient (QR) barcode scanner for Capacitor
MIT License
436 stars 172 forks source link

npm install fails with error TS2322: Type 'boolean' is not assignable to type 'false'. #203

Closed arcadius closed 1 year ago

arcadius commented 1 year ago

Describe the bug npm install fails on the latest main branch To Reproduce

  1. git clone https://github.com/capacitor-community/barcode-scanner
  2. cd barcode-scanner
  3. npm install
  4. See error
uuu@uuu-b9450fa:~/devenv/oss/barcode-scanner$ npm install
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: @typescript-eslint/eslint-plugin@4.33.0
npm WARN Found: eslint@8.28.0
npm WARN node_modules/eslint
npm WARN   dev eslint@"^8.28.0" from the root project
npm WARN   5 more (@ionic/eslint-config, ...)
npm WARN 
npm WARN Could not resolve dependency:
npm WARN peer eslint@"^5.0.0 || ^6.0.0 || ^7.0.0" from @typescript-eslint/eslint-plugin@4.33.0
npm WARN node_modules/@ionic/eslint-config/node_modules/@typescript-eslint/eslint-plugin
npm WARN   @typescript-eslint/eslint-plugin@"^4.1.0" from @ionic/eslint-config@0.3.0
npm WARN   node_modules/@ionic/eslint-config
npm WARN 
npm WARN Conflicting peer dependency: eslint@7.32.0
npm WARN node_modules/eslint
npm WARN   peer eslint@"^5.0.0 || ^6.0.0 || ^7.0.0" from @typescript-eslint/eslint-plugin@4.33.0
npm WARN   node_modules/@ionic/eslint-config/node_modules/@typescript-eslint/eslint-plugin
npm WARN     @typescript-eslint/eslint-plugin@"^4.1.0" from @ionic/eslint-config@0.3.0
npm WARN     node_modules/@ionic/eslint-config
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: @typescript-eslint/parser@4.33.0
npm WARN Found: eslint@8.28.0
npm WARN node_modules/eslint
npm WARN   dev eslint@"^8.28.0" from the root project
npm WARN   5 more (@ionic/eslint-config, ...)
npm WARN 
npm WARN Could not resolve dependency:
npm WARN peer eslint@"^5.0.0 || ^6.0.0 || ^7.0.0" from @typescript-eslint/parser@4.33.0
npm WARN node_modules/@ionic/eslint-config/node_modules/@typescript-eslint/parser
npm WARN   @typescript-eslint/parser@"^4.1.0" from @ionic/eslint-config@0.3.0
npm WARN   node_modules/@ionic/eslint-config
npm WARN   1 more (@typescript-eslint/eslint-plugin)
npm WARN 
npm WARN Conflicting peer dependency: eslint@7.32.0
npm WARN node_modules/eslint
npm WARN   peer eslint@"^5.0.0 || ^6.0.0 || ^7.0.0" from @typescript-eslint/parser@4.33.0
npm WARN   node_modules/@ionic/eslint-config/node_modules/@typescript-eslint/parser
npm WARN     @typescript-eslint/parser@"^4.1.0" from @ionic/eslint-config@0.3.0
npm WARN     node_modules/@ionic/eslint-config
npm WARN     1 more (@typescript-eslint/eslint-plugin)

> @capacitor-community/barcode-scanner@3.0.0 prepare
> npm run build

> @capacitor-community/barcode-scanner@3.0.0 build
> npm run clean && tsc && rollup -c rollup.config.js

> @capacitor-community/barcode-scanner@3.0.0 clean
> rimraf ./dist

src/web.ts:165:15 - error TS2322: Type 'boolean' is not assignable to type 'false'.

165               hasContent: !!result.getText(),
                  ~~~~~~~~~~

src/web.ts:166:15 - error TS2322: Type 'string' is not assignable to type 'undefined'.

166               content: result.getText(),
                  ~~~~~~~

src/web.ts:167:15 - error TS2322: Type 'string' is not assignable to type 'undefined'.

167               format: result.getBarcodeFormat().toString(),
                  ~~~~~~

Found 3 errors in the same file, starting at: src/web.ts:165

npm ERR! code 2
npm ERR! path  oss/barcode-scanner
npm ERR! command failed
npm ERR! command sh -c npm run build

Expected behavior Buils should be sucessful

Screenshots If applicable, add screenshots to help explain your problem.

Version latest main

arcadius commented 1 year ago

@TheOnlyTails , this bug seems related to the last 2 PRs:

https://github.com/capacitor-community/barcode-scanner/pull/196 and https://github.com/capacitor-community/barcode-scanner/pull/197

TheOnlyTails commented 1 year ago

yes, sorry, that's fixed in #199. @thegnuu could you please take a look?

thegnuu commented 1 year ago

Sure, sorry I am really busy at the moment... Will have a look at it this weekend! Sorry for the delay!

TheOnlyTails commented 1 year ago

it's alright, no worries!

thegnuu commented 1 year ago

Should be resolved with the latest release :)

thegnuu commented 1 year ago

Closing since it should work now, feel free to reopen the issue if you still have problems with the newest version