Skip to content

Commit

Permalink
sdk/server: Fix type of canMixin (#1333)
Browse files Browse the repository at this point in the history
* Fix type of canMixin

* Allow undefined

* Add void
  • Loading branch information
longzheng committed Feb 20, 2024
1 parent a47f7e2 commit 657921a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion common/src/autoenable-mixin-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,5 @@ export abstract class AutoenableMixinProvider extends ScryptedDeviceBase {
this.storage.setItem('hasEnabledMixin', JSON.stringify(this.hasEnabledMixin));
}

abstract canMixin(type: ScryptedDeviceType, interfaces: string[]): Promise<string[]>;
abstract canMixin(type: ScryptedDeviceType, interfaces: string[]): Promise<string[] | null | undefined | void>;
}
2 changes: 1 addition & 1 deletion sdk/types/scrypted_python/scrypted_sdk/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -1097,7 +1097,7 @@ async def getAudioStream(self) -> MediaObject:
class MixinProvider:
"""MixinProviders can add and intercept interfaces to other devices to add or augment their behavior."""

async def canMixin(self, type: ScryptedDeviceType, interfaces: list[str]) -> list[str]:
async def canMixin(self, type: ScryptedDeviceType, interfaces: list[str]) -> None | list[str]:
pass

async def getMixin(self, mixinDevice: Any, mixinDeviceInterfaces: list[ScryptedInterface], mixinDeviceState: WritableDeviceState) -> Any:
Expand Down
2 changes: 1 addition & 1 deletion sdk/types/src/types.input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1862,7 +1862,7 @@ export interface MixinProvider {
/**
* Called by the system to determine if this provider can create a mixin for the supplied device. Returns null if a mixin can not be created, otherwise returns a list of new interfaces (which may be an empty list) that are provided by the mixin.
*/
canMixin(type: ScryptedDeviceType, interfaces: string[]): Promise<string[]>;
canMixin(type: ScryptedDeviceType, interfaces: string[]): Promise<string[] | null | undefined | void>;

/**
* Create a mixin that can be applied to the supplied device.
Expand Down

0 comments on commit 657921a

Please sign in to comment.