Digital-Alchemy-TS / hass

Typescript APIs for Home Assistant. Includes rest & websocket bindings
https://docs.digital-alchemy.app
MIT License
5 stars 2 forks source link

Build fixing #49

Closed zoe-codez closed 2 months ago

zoe-codez commented 2 months ago

Changes

This PR focuses on resolving issues in the published build. Previously interfaces would get published like this

byDevice: <DEVICE extends TDeviceId, DOMAINS extends TRawDomains = TRawDomains>(device: DEVICE, ...domains: DOMAINS[]) => Extract<{
_308e39cf50a9fc6c30b4110724ed1f2e: "sensor.sun_next_dawn" | ... ;
_e58841e47cf86097b310316e55d6bb12: "calendar.united_states_tx";
}[`_${DEVICE}`], PICK_ENTITY<DOMAINS>>[];

Instead of properly keeping the utility types:

byDevice: <DEVICE extends TDeviceId, DOMAINS extends TRawDomains = TRawDomains>(device: DEVICE, ...domains: DOMAINS[]) => PICK_FROM_DEVICE<DEVICE, DOMAIN>

This was as a result of TS doing some inferring work inside extensions. It resulted in placeholder entities being injected into the build, preventing interfaces from returning stuff as expected.

Fortunately, the fallout seems to be contained to mostly internals, but everything should be publishing as expected going forward


This PR drops deprecated method with build issues

And provides a hard coded correct interface so TS doesn't get creative

Checklist

codecov[bot] commented 2 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 74.94%. Comparing base (23dde42) to head (63d322f).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #49 +/- ## ========================================== + Coverage 74.25% 74.94% +0.69% ========================================== Files 35 35 Lines 1375 1361 -14 Branches 167 167 ========================================== - Hits 1021 1020 -1 + Misses 334 321 -13 Partials 20 20 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.