Code Monkey home page Code Monkey logo

Comments (7)

manekinekko avatar manekinekko commented on May 26, 2024

Hey, can you share the repo you are using. I am looking to reproduce this issue. Thank you.

from angular-web-bluetooth.

bitbay avatar bitbay commented on May 26, 2024

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!

from angular-web-bluetooth.

wbrett avatar wbrett commented on May 26, 2024

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.

from angular-web-bluetooth.

bitbay avatar bitbay commented on May 26, 2024
λ 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.

from angular-web-bluetooth.

bitbay avatar bitbay commented on May 26, 2024

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

  • adding the not recognized 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 ?)
  • and fixing some obvious "strict" errors, while moving the package @manekinekko/angular-web-bluetooth into the projects src directly

I 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.

from angular-web-bluetooth.

manekinekko avatar manekinekko commented on May 26, 2024

This issues has been fixed in. Please install new version @manekinekko/[email protected]. Please feel free to close this issue once you've confirmed it's working for you.

from angular-web-bluetooth.

wbrett avatar wbrett commented on May 26, 2024

Installed and working, thanks a lot @manekinekko

from angular-web-bluetooth.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.