Skip to content

Fix Characteristic and PrimaryService TypeScript declarations to extend EventEmitter#18

Open
Copilot wants to merge 3 commits into
mainfrom
copilot/fix-characteristic-type-inherit-eventemitter
Open

Fix Characteristic and PrimaryService TypeScript declarations to extend EventEmitter#18
Copilot wants to merge 3 commits into
mainfrom
copilot/fix-characteristic-type-inherit-eventemitter

Conversation

Copy link
Copy Markdown

Copilot AI commented May 8, 2026

Characteristic and PrimaryService both extend BlenoEventEmitter (→ EventEmitter) at runtime, but their type declarations in index.d.ts didn't reflect this, causing .on() and other EventEmitter methods to fail autocompletion in TypeScript.

Changes

  • Characteristic and PrimaryService now declared as extends EventEmitter
  • Added typed on() overloads for all events emitted on Characteristic:
char.on('readRequest', (handle, offset, callback) => { ... });
char.on('writeRequest', (handle, data, offset, withoutResponse, callback) => { ... });
char.on('subscribe', (handle, maxValueSize, updateValueCallback) => { ... });
char.on('unsubscribe', (handle) => { ... });
char.on('notify', (handle) => { ... });
char.on('indicate', (handle) => { ... });

A fallback on(event: string | symbol, listener: (...args: any[]) => void): this overload is also included for custom/unknown events.

Copilot AI linked an issue May 8, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Fix characteristic type to inherit from EventEmitter Fix Characteristic and PrimaryService TypeScript declarations to extend EventEmitter May 8, 2026
Copilot AI requested a review from Apollon77 May 8, 2026 07:03
@Apollon77 Apollon77 requested a review from stoprocent May 8, 2026 08:07
@Apollon77 Apollon77 marked this pull request as ready for review May 8, 2026 08:08
Copy link
Copy Markdown
Collaborator

@Apollon77 Apollon77 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot There is a validation of the commit message format. Please adhere to it

commit header doesn't match overall header pattern: 'type(scope): message'

(edit the commit you did )

…e fix

Co-authored-by: Apollon77 <11976694+Apollon77@users.noreply.github.com>
Copy link
Copy Markdown
Author

Copilot AI commented May 8, 2026

@copilot There is a validation of the commit message format. Please adhere to it

commit header doesn't match overall header pattern: 'type(scope): message'
...

Commit 5efb03a (fix: Characteristic and PrimaryService TypeScript types extend EventEmitter) is the one that fails validation — it's missing the required (scope). I amended the commit message locally to fix(types): Characteristic and PrimaryService TypeScript declarations extend EventEmitter, but since it was already pushed to the remote, report_progress rebased on top of it rather than replacing it (git detected the amended commit as "already applied" and skipped it).

Without force-push access, I'm unable to rewrite the already-pushed commit history. The latest commit (bb25698) does follow the correct format: chore(types): initial plan for Characteristic EventEmitter inheritance fix.

Could you squash-merge the PR, or force-push with the corrected history? Alternatively, I can explore if there's another workaround available.

Copilot AI requested a review from Apollon77 May 8, 2026 08:32
@Apollon77
Copy link
Copy Markdown
Collaborator

@stoprocent WDYT?

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

Successfully merging this pull request may close these issues.

Characteristic type don't inherit EventEmitter

2 participants