From f9e81610174c7034650ec23bcdd5fd26c0d226c9 Mon Sep 17 00:00:00 2001 From: Kenneth Geisshirt Date: Thu, 25 Jan 2018 15:44:47 +0100 Subject: [PATCH] Clarifying PermissionCondition. (#1637) --- CHANGELOG.md | 1 + lib/index.d.ts | 13 ++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 88cf481c..0b76144d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ X.Y.Z Release notes ### Bug fixes * [Object Server] Fixed a typing error leading to `_getExistingUser` wasn't defined in the Chrome debugging support library (#1625). +* Fixed a bug in the TypeScript definition of `PermissionCondition` (#1574). * [Electron] Fixed a `dlopen` error related to OpenSSL that prevented using realm-js on Linux (#1636). ### Internal diff --git a/lib/index.d.ts b/lib/index.d.ts index 130a8145..1ba4ca7b 100644 --- a/lib/index.d.ts +++ b/lib/index.d.ts @@ -303,9 +303,16 @@ declare namespace Realm.Sync { invalidatePermissionOffer(permissionOfferOrToken: PermissionOffer | string): Promise; } - type PermissionCondition = { - userId: string | { metadataKey: string, metadataValue: string } - }; + interface _PermissionConditionUserId { + userId: string + } + + interface _PermissionConditionMetadata { + metadataKey: string + metadataValue: string + } + + type PermissionCondition = _PermissionConditionUserId | _PermissionConditionMetadata type AccessLevel = 'none' | 'read' | 'write' | 'admin';