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

requestPairingCode() cannot have function default parameters. #3371

Open
2 tasks done
wis-dev opened this issue Nov 8, 2024 · 0 comments · May be fixed by #3180
Open
2 tasks done

requestPairingCode() cannot have function default parameters. #3371

wis-dev opened this issue Nov 8, 2024 · 0 comments · May be fixed by #3180
Labels
bug Something isn't working

Comments

@wis-dev
Copy link

wis-dev commented Nov 8, 2024

Is there an existing issue for this?

  • I have searched the existing issues.

Is this a problem caused by your code, or is it specifically because of the library?

  • I have double-checked my code carefully.

Describe the bug.

After build my node.js app with tsc, when trying to start the server running node dist/src/index.js, the following error is throw:

node_modules/whatsapp-web.js/index.d.ts:127:49 - error TS2371: A parameter initializer is only allowed in a function or constructor implementation.
requestPairingCode(phoneNumber: string, showNotification = true): Promise<string>

Code ref.:
https://github.com/pedroslopez/whatsapp-web.js/blob/main/index.d.ts#L127

Expected Behavior

requestPairingCode method shoud be correcly declared.
Because abstract functions cannot have function default parameters.

✅ Correct way:
requestPairingCode(phoneNumber: string, showNotification: boolean): Promise<string>

❌ Incorrect way:
requestPairingCode(phoneNumber: string, showNotification = true): Promise<string>

Steps to Reproduce the Bug or Issue

Run:

  1. npm install whatsapp-web.js@v1.26.1-alpha.2
  2. tsc
  3. node dist/src/index.js

WhatsApp Account Type

Standard

Browser Type

Chromium

Operation System Type

Windows

Phone OS Type

iOS

WhatsApp-Web.js Version

1.26.1-alpha.2

WhatsApp Web Version

2.3000.1017054665

Node.js Version

22.0.0

Authentication Strategy

LocalAuth

Additional Context

I fix this typo error updating the method in my node_modules folder, changing this:
requestPairingCode(phoneNumber: string, showNotification = true): Promise<string>

To this:
requestPairingCode(phoneNumber: string, showNotification: boolean): Promise<string>

@wis-dev wis-dev added the bug Something isn't working label Nov 8, 2024
@alechkos alechkos linked a pull request Nov 8, 2024 that will close this issue
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant