Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

web-bluetooth dependency should be transitive #1704

Closed
7 tasks done
sanyarnd opened this issue Jun 19, 2022 · 12 comments
Closed
7 tasks done

web-bluetooth dependency should be transitive #1704

sanyarnd opened this issue Jun 19, 2022 · 12 comments

Comments

@sanyarnd
Copy link

sanyarnd commented Jun 19, 2022

Describe the bug

Without "@types/web-bluetooth": "0.0.14", in my devDependencies the build fails with:

.....

node_modules/@vueuse/core/index.d.ts:396:32 - error TS2304: Cannot find name 'BluetoothDevice'.

396         onserviceadded: (this: BluetoothDevice, ev: Event) => any;
                                   ~~~~~~~~~~~~~~~

node_modules/@vueuse/core/index.d.ts:397:34 - error TS2304: Cannot find name 'BluetoothDevice'.

397         onservicechanged: (this: BluetoothDevice, ev: Event) => any;
                                     ~~~~~~~~~~~~~~~

node_modules/@vueuse/core/index.d.ts:398:34 - error TS2304: Cannot find name 'BluetoothDevice'.

398         onserviceremoved: (this: BluetoothDevice, ev: Event) => any;
                                     ~~~~~~~~~~~~~~~

node_modules/@vueuse/core/index.d.ts:401:26 - error TS2304: Cannot find name 'BluetoothRemoteGATTServer'.

401     server: vue_demi.Ref<BluetoothRemoteGATTServer | undefined>;
                             ~~~~~~~~~~~~~~~~~~~~~~~~~

Project uses TypeScript.

System Info

System:
    OS: Windows 10 10.0.19044
    CPU: (12) x64 Intel(R) Core(TM) i7-10850H CPU @ 2.70GHz
    Memory: 13.45 GB / 31.73 GB
  Binaries:
    Node: 16.13.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 3.1.1 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 8.12.2 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.19041.1266.0), Chromium (102.0.1245.44)
    Internet Explorer: 11.0.19041.1566
  npmPackages:
    @vueuse/core: 8.7.4 => 8.7.4
    vue: 3.2.37 => 3.2.37

Used Package Manager

yarn

Validations

@antfu antfu closed this as completed in 9f5b9ef Jun 19, 2022
@Shinigami92
Copy link
Contributor

Seems it's not solved via v8.7.5 🙁

node_modules/.pnpm/@vueuse+core@8.7.5_vue@3.2.37/node_modules/@vueuse/core/index.d.ts:340:15 - error TS2304: Cannot find name 'BluetoothLEScanFilter'.

340     filters?: BluetoothLEScanFilter[] | undefined;
                  ~~~~~~~~~~~~~~~~~~~~~

node_modules/.pnpm/@vueuse+core@8.7.5_vue@3.2.37/node_modules/@vueuse/core/index.d.ts:348:24 - error TS2304: Cannot find name 'BluetoothServiceUUID'.

348     optionalServices?: BluetoothServiceUUID[] | undefined;
                           ~~~~~~~~~~~~~~~~~~~~

node_modules/.pnpm/@vueuse+core@8.7.5_vue@3.2.37/node_modules/@vueuse/core/index.d.ts:376:36 - error TS2304: Cannot find name 'BluetoothRemoteGATTServer'.

376             connect: () => Promise<BluetoothRemoteGATTServer>;
                                       ~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/.pnpm/@vueuse+core@8.7.5_vue@3.2.37/node_modules/@vueuse/core/index.d.ts:378:42 - error TS2304: Cannot find name 'BluetoothServiceUUID'.

378             getPrimaryService: (service: BluetoothServiceUUID) => Promise<BluetoothRemoteGATTService>;
                                             ~~~~~~~~~~~~~~~~~~~~

node_modules/.pnpm/@vueuse+core@8.7.5_vue@3.2.37/node_modules/@vueuse/core/index.d.ts:378:75 - error TS2304: Cannot find name 'BluetoothRemoteGATTService'.

378             getPrimaryService: (service: BluetoothServiceUUID) => Promise<BluetoothRemoteGATTService>;
                                                                              ~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/.pnpm/@vueuse+core@8.7.5_vue@3.2.37/node_modules/@vueuse/core/index.d.ts:379:44 - error TS2304: Cannot find name 'BluetoothServiceUUID'.

379             getPrimaryServices: (service?: BluetoothServiceUUID | undefined) => Promise<BluetoothRemoteGATTService[]>;
                                               ~~~~~~~~~~~~~~~~~~~~

node_modules/.pnpm/@vueuse+core@8.7.5_vue@3.2.37/node_modules/@vueuse/core/index.d.ts:379:89 - error TS2304: Cannot find name 'BluetoothRemoteGATTService'.

379             getPrimaryServices: (service?: BluetoothServiceUUID | undefined) => Promise<BluetoothRemoteGATTService[]>;
                                                                                            ~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/.pnpm/@vueuse+core@8.7.5_vue@3.2.37/node_modules/@vueuse/core/index.d.ts:383:41 - error TS2304: Cannot find name 'WatchAdvertisementsOptions'.

383         watchAdvertisements: (options?: WatchAdvertisementsOptions | undefined) => Promise<void>;
                                            ~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/.pnpm/@vueuse+core@8.7.5_vue@3.2.37/node_modules/@vueuse/core/index.d.ts:387:63 - error TS2304: Cannot find name 'BluetoothDevice'.

387             (type: "gattserverdisconnected", listener: (this: BluetoothDevice, ev: Event) => any, useCapture?: boolean | undefined): void;
                                                                  ~~~~~~~~~~~~~~~

node_modules/.pnpm/@vueuse+core@8.7.5_vue@3.2.37/node_modules/@vueuse/core/index.d.ts:388:62 - error TS2304: Cannot find name 'BluetoothDevice'.

388             (type: "advertisementreceived", listener: (this: BluetoothDevice, ev: BluetoothAdvertisingEvent) => any, useCapture?: boolean | undefined): void;
                                                                 ~~~~~~~~~~~~~~~

node_modules/.pnpm/@vueuse+core@8.7.5_vue@3.2.37/node_modules/@vueuse/core/index.d.ts:388:83 - error TS2304: Cannot find name 'BluetoothAdvertisingEvent'.

388             (type: "advertisementreceived", listener: (this: BluetoothDevice, ev: BluetoothAdvertisingEvent) => any, useCapture?: boolean | undefined): void;
                                                                                      ~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/.pnpm/@vueuse+core@8.7.5_vue@3.2.37/node_modules/@vueuse/core/index.d.ts:393:41 - error TS2304: Cannot find name 'BluetoothDevice'.

393         onadvertisementreceived: (this: BluetoothDevice, ev: BluetoothAdvertisingEvent) => any;
                                            ~~~~~~~~~~~~~~~

node_modules/.pnpm/@vueuse+core@8.7.5_vue@3.2.37/node_modules/@vueuse/core/index.d.ts:393:62 - error TS2304: Cannot find name 'BluetoothAdvertisingEvent'.

393         onadvertisementreceived: (this: BluetoothDevice, ev: BluetoothAdvertisingEvent) => any;
                                                                 ~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/.pnpm/@vueuse+core@8.7.5_vue@3.2.37/node_modules/@vueuse/core/index.d.ts:394:42 - error TS2304: Cannot find name 'BluetoothDevice'.

394         ongattserverdisconnected: (this: BluetoothDevice, ev: Event) => any;
                                             ~~~~~~~~~~~~~~~

node_modules/.pnpm/@vueuse+core@8.7.5_vue@3.2.37/node_modules/@vueuse/core/index.d.ts:395:46 - error TS2304: Cannot find name 'BluetoothDevice'.

395         oncharacteristicvaluechanged: (this: BluetoothDevice, ev: Event) => any;
                                                 ~~~~~~~~~~~~~~~

node_modules/.pnpm/@vueuse+core@8.7.5_vue@3.2.37/node_modules/@vueuse/core/index.d.ts:396:32 - error TS2304: Cannot find name 'BluetoothDevice'.

396         onserviceadded: (this: BluetoothDevice, ev: Event) => any;
                                   ~~~~~~~~~~~~~~~

node_modules/.pnpm/@vueuse+core@8.7.5_vue@3.2.37/node_modules/@vueuse/core/index.d.ts:397:34 - error TS2304: Cannot find name 'BluetoothDevice'.

397         onservicechanged: (this: BluetoothDevice, ev: Event) => any;
                                     ~~~~~~~~~~~~~~~

node_modules/.pnpm/@vueuse+core@8.7.5_vue@3.2.37/node_modules/@vueuse/core/index.d.ts:398:34 - error TS2304: Cannot find name 'BluetoothDevice'.

398         onserviceremoved: (this: BluetoothDevice, ev: Event) => any;
                                     ~~~~~~~~~~~~~~~

node_modules/.pnpm/@vueuse+core@8.7.5_vue@3.2.37/node_modules/@vueuse/core/index.d.ts:401:26 - error TS2304: Cannot find name 'BluetoothRemoteGATTServer'.

401     server: vue_demi.Ref<BluetoothRemoteGATTServer | undefined>;
                             ~~~~~~~~~~~~~~~~~~~~~~~~~


Found 19 errors in the same file, starting at: node_modules/.pnpm/@vueuse+core@8.7.5_vue@3.2.37/node_modules/@vueuse/core/index.d.ts:340

@MrCube42
Copy link

Can confirm this: We still have the same problem even after upgrading to 8.7.5+ (using vue 2.6.14 and @vue/composition-api 1.4.3). We get the same error from the d.ts files as reported above #1704 (comment).

@ch1035063420
Copy link

ch1035063420 commented Jul 21, 2022

The upgrade to 8.7.5 is still unresolved
"@vueuse/core": "^8.7.5",
"@vueuse/rxjs": "^7.7.1",
"typescript": "^4.4.4",

@holtwick
Copy link

Also still seeing this when using "vue-tsc --noEmit"

@holtwick
Copy link

Any updates on this? In "@vueuse/core": "^9.1.0" I still see the error.

I was able to mitigate it by installing "@types/web-bluetooth" and adding "web-bluetooth" to "compilerOptions.types" in tsconfig.json, but it is a bit annoying to have this kind of workaround, since most users very likely are not using bluetooth features of the lib at all. Maybe this could become a separate package?

@MrCube42
Copy link

MrCube42 commented Aug 10, 2022

Can confirm this: We still have the same problem even after upgrading to 8.7.5+ (using vue 2.6.14 and @vue/composition-api 1.4.3). We get the same error from the d.ts files as reported above #1704 (comment).

FYI: We updated to @vueuse/core 9.0.0 (using vue 2.6.14 and @vue/composition-api 1.7.0, still using vue-cli to build) and the error is gone without any extra adjustmenst.

@holtwick
Copy link

Thanks @MrCube42 for the feedback. I still saw the issues with the latest versions of all packages (on macOS, package manager pnpm), but maybe this is just a local setup issue. Never mind, the workaround is fine for me ;)

> vue-tsc --noEmit -p ./tsconfig.json

node_modules/.pnpm/@vueuse+core@9.1.0_vue@3.2.37/node_modules/@vueuse/core/index.d.ts:368:15 - error TS2304: Cannot find name 'BluetoothLEScanFilter'.

368     filters?: BluetoothLEScanFilter[] | undefined;
                  ~~~~~~~~~~~~~~~~~~~~~

node_modules/.pnpm/@vueuse+core@9.1.0_vue@3.2.37/node_modules/@vueuse/core/index.d.ts:376:24 - error TS2304: Cannot find name 'BluetoothServiceUUID'.

376     optionalServices?: BluetoothServiceUUID[] | undefined;
                           ~~~~~~~~~~~~~~~~~~~~

node_modules/.pnpm/@vueuse+core@9.1.0_vue@3.2.37/node_modules/@vueuse/core/index.d.ts:399:17 - error TS2304: Cannot find name 'BluetoothDevice'.

399     device: Ref<BluetoothDevice | undefined>;
                    ~~~~~~~~~~~~~~~

node_modules/.pnpm/@vueuse+core@9.1.0_vue@3.2.37/node_modules/@vueuse/core/index.d.ts:401:17 - error TS2304: Cannot find name 'BluetoothRemoteGATTServer'.

401     server: Ref<BluetoothRemoteGATTServer | undefined>;
                    ~~~~~~~~~~~~~~~~~~~~~~~~~

@radusuciu
Copy link

Also have this issue in 9.1.0. Workaround;

  1. Add two dev dependencies to package.json:
        "@babel/types": "^7.18.10",
        "@types/web-bluetooth": "^0.0.15",
  1. Add web-bluetooth to compilerOptions.types in tsconfig.json.

I do not need any bluetooth related features, and had to add @babel/types since there were also some errors related to that..

neutron0831 added a commit to neutron0831/nlp100-ts that referenced this issue Mar 9, 2023
- 🏷️ Add @types/web-bluetooth
  See vueuse/vueuse#1704
- 🔧 Set transpile target to `esnext`
  See vitejs/vite#6985
neutron0831 added a commit to neutron0831/nlp100-ts that referenced this issue Mar 10, 2023
- 🏷️ Add @types/web-bluetooth
  See vueuse/vueuse#1704
- 🔧 Set transpile target to `esnext`
  See vitejs/vite#6985
neutron0831 added a commit to neutron0831/nlp100-ts that referenced this issue Mar 12, 2023
- 🏷️ Add @types/web-bluetooth
  See vueuse/vueuse#1704
- 🔧 Set transpile target to `esnext`
  See vitejs/vite#6985
@tkzt
Copy link

tkzt commented Apr 19, 2023

Also encounter this, my workaround:

// tsconfig.json
{
  "compilerOptions": {
    ...
    "skipLibCheck": true
    ...
  }
}

@radusuciu
Copy link

Still see this with version 10.1.2. One more thing to add to my previous comment: @types/web-bluetooth is not necessary in package.json, but it is still required in tsconfig.json.

skipLibCheck: true in tsconfig.json works as well but that seems like too broad a solution for this specific problem as it could potentially bury legitimate errors related to other packages as well.

@troyere
Copy link

troyere commented Jan 24, 2024

The problem is still there with 10.7.2

  • Add skipLibCheck: true : ...seriously ? In 2023, we're still there ?
  • Add "@types/web-bluetooth": "^0.0.15" ? I'm using vue use core, there is no way in hell I'll add that if my app does not even use bluetooth features

@troyere
Copy link

troyere commented Jan 24, 2024

Got it, the problem was in my tsconfig files.

Still, don't do "that" (#1704 (comment) !)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants