Skip to content

Fix SMBus constructor options type - #1688

Open
stc1988 wants to merge 1 commit into
Moddable-OpenSource:publicfrom
stc1988:typings/smbus/constructor
Open

Fix SMBus constructor options type#1688
stc1988 wants to merge 1 commit into
Moddable-OpenSource:publicfrom
stc1988:typings/smbus/constructor

Conversation

@stc1988

@stc1988 stc1988 commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Fix the SMBus constructor type declaration to use the first parameter of the I2C constructor.

ConstructorParameters produces a tuple containing the constructor arguments. Intersecting that tuple directly with the SMBus-specific options caused TypeScript to reject valid I2C properties such as address, data, clock, and hz.

Selecting the first tuple element with ConstructorParameters[0] correctly extends the I2C options with the optional SMBus stop property.

@phoddie

phoddie commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

Yes, that makes sense. And it is consistent with how ConstructorParameters is used by mcdevicetree for RTCOptions. We'll merge this for the September release. Thank you.

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.

2 participants