Closed wbrett closed 3 years ago
Hey, can you share the repo you are using. I am looking to reproduce this issue. Thank you.
Just a +1 on the issue.
@manekinekko created a stackblitz, here.
It will tell You Can't find package:@manekinekko/angular-web-bluetooth
and offer You an "install button" - although it is already installed. Different behavior on stackblitz, but the result is the same.
error TS2307: Cannot find module '@manekinekko/angular-web-bluetooth' or its corresponding type declarations.
You can probably download the project to debug it. Eager to get my hands dirty, if i can help You out in anyway, just let me know!
Hey, can you share the repo you are using. I am looking to reproduce this issue. Thank you.
Hey @manekinekko, its a private repo I can't share it, but happy to provide any more info or code snippets. Thanks for your help and thanks @bitbay for putting up the stackblitz.
λ node -v
v13.11.0
λ npm -v
6.13.7
And
λ ng version
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 11.2.2
Node: 13.11.0
OS: win32 x64
Angular: 11.2.3
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Ivy Workspace: Yes
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1102.2
@angular-devkit/build-angular 0.1102.2
@angular-devkit/core 11.2.2
@angular-devkit/schematics 11.2.2
@angular/cdk 11.2.2
@angular/cli 11.2.2
@angular/flex-layout 11.0.0-beta.33
@angular/material 11.2.2
@schematics/angular 11.2.2
@schematics/update 0.1102.2
rxjs 6.6.6
typescript 4.1.5
Then create project, add module
λ ng new bluetoothtest --commit false --defaults --minimal true --skip-git
λ cd bluetoothtest && npm install -S @manekinekko/angular-web-bluetooth @types/web-bluetooth
Just add import { WebBluetoothModule } from '@manekinekko/angular-web-bluetooth';
to app.module.ts
and
λ ng build
√ Browser application bundle generation complete.
Error: src/app/app.module.ts:5:36 - error TS2307: Cannot find module '@manekinekko/angular-web-bluetooth' or its corresponding type declarations.
5 import { WebBluetoothModule } from '@manekinekko/angular-web-bluetooth';
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
But
λ ls node_modules\@manekinekko\
angular-web-bluetooth/
If You preferr start from sratch.
DEFINITELY missed an important flag on project creation, --strict true
.
The correct command to get all them errors is
λ ng new bluetoothtest --commit false --defaults --minimal true --skip-git --strict true
Doing some monkeypatching, like
node_modules/@types/web-bluetooth/*.d.ts
to the includes
array inside tsconfig.app.json
(maybe solvable by defining this as a dependency in angular-web-bluetooth
?)@manekinekko/angular-web-bluetooth
into the projects src directlyI got down to
...
Error: src/app/src/lib/bluetooth.service.ts:385:36 - error TS2345: Argument of type 'BluetoothDevice' is not assignable to parameter of type 'FromEventTarget<Event>'.
Type 'BluetoothDevice' is not assignable to type 'HasEventTargetAddRemove<Event>'.
Types of property 'removeEventListener' are incompatible.
Type '(type: string, callback: EventListener | EventListenerObject | null, options?: boolean | EventListenerOptions | undefined) => void' is not assignable to type '(type: string, listener?: ((evt: Event) => void) | null | undefined, options?: boolean | EventListenerOptions | undefined) => void'.
Types of parameters 'callback' and 'listener' are incompatible.
Type '((evt: Event) => void) | null | undefined' is not assignable to type 'EventListener | EventListenerObject | null'.
Type 'undefined' is not assignable to type 'EventListener | EventListenerObject | null'.
385 const disconnected = fromEvent(characteristic.service.device, 'gattserverdisconnected');
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
Which seems like a mismatch of typedefs web-bluetooth and angulars compiler is using. Not a typedef guy myself, that's a bummer for me.
This issues has been fixed in. Please install new version @manekinekko/angular-web-bluetooth@11.2.2
. Please feel free to close this issue once you've confirmed it's working for you.
Installed and working, thanks a lot @manekinekko
Describe the bug Upgrading the version from 9.1.1 to 11.2.1.
To Reproduce Steps to reproduce the behavior:
Error: src/app/device-management/comms/ferit-config-bluetooth.service.ts:3:31 - error TS2307: Cannot find module '@manekinekko/angular-web-bluetooth' or its corresponding type declarations.
Expected behavior A clean compile, no errors.
Desktop (please complete the following information):
Also tried a fresh project checkout, removing bluetooth dependency completely from package.json and run: npm install -S @manekinekko/angular-web-bluetooth @types/web-bluetooth Checked node modules and found the packages in both types and @manekinekko/angular-web-bluetooth directory. run ng build. Same build error and not bluetooth types found. If I revert the project to 9.1.1 all is well again.