mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 22:30:01 +00:00
[iobroker] add object type "folder" (#43819)
This commit is contained in:
13
types/iobroker/index.d.ts
vendored
13
types/iobroker/index.d.ts
vendored
@@ -183,6 +183,15 @@ declare global {
|
||||
common?: Partial<DeviceCommon>;
|
||||
}
|
||||
|
||||
interface FolderObject extends BaseObject {
|
||||
type: 'folder';
|
||||
// Nothing is set in stone here, so start with allowing every property
|
||||
common: OtherCommon;
|
||||
}
|
||||
interface PartialFolderObject extends Partial<Pick<FolderObject, '_id' | 'native' | 'enums' | 'type' | 'acl'>> {
|
||||
common?: Partial<OtherCommon>;
|
||||
}
|
||||
|
||||
interface OtherObject extends BaseObject {
|
||||
type: 'adapter' | 'config' | 'enum' | 'group' | 'host' | 'info' | 'instance' | 'meta' | 'script' | 'user';
|
||||
common: OtherCommon;
|
||||
@@ -191,7 +200,7 @@ declare global {
|
||||
common?: Partial<ObjectCommon>;
|
||||
}
|
||||
|
||||
type Object = StateObject | ChannelObject | DeviceObject | OtherObject;
|
||||
type Object = StateObject | ChannelObject | DeviceObject | FolderObject | OtherObject;
|
||||
|
||||
type SettableObjectWorker<T extends ioBroker.Object> = Pick<T, Exclude<keyof T, '_id' | 'acl'>> & {
|
||||
_id?: T['_id'];
|
||||
@@ -200,7 +209,7 @@ declare global {
|
||||
|
||||
// In set[Foreign]Object[NotExists] methods, the ID and acl of the object is optional
|
||||
type SettableObject = SettableObjectWorker<ioBroker.Object>;
|
||||
type PartialObject = PartialStateObject | PartialChannelObject | PartialDeviceObject | PartialOtherObject;
|
||||
type PartialObject = PartialStateObject | PartialChannelObject | PartialDeviceObject | PartialFolderObject | PartialOtherObject;
|
||||
|
||||
/** Defines access rights for a single file */
|
||||
interface FileACL {
|
||||
|
||||
@@ -386,6 +386,17 @@ function repro3() {
|
||||
});
|
||||
}
|
||||
|
||||
const folderObj: ioBroker.FolderObject = {
|
||||
_id: "id",
|
||||
type: "folder",
|
||||
common: {
|
||||
name: "something",
|
||||
// any property is allowed
|
||||
foo: "bar",
|
||||
},
|
||||
native: {},
|
||||
};
|
||||
|
||||
// Repro from https://github.com/ioBroker/ioBroker.js-controller/issues/782
|
||||
// $ExpectError
|
||||
adapter.setState("id", {ack: false});
|
||||
|
||||
Reference in New Issue
Block a user