From d60c373cac817917660a6ec0064672557d3d1d6a Mon Sep 17 00:00:00 2001 From: Kenneth Geisshirt Date: Tue, 8 Jun 2021 15:25:54 +0200 Subject: [PATCH] Using for mutual-exclusive TS def --- types/index.d.ts | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/types/index.d.ts b/types/index.d.ts index d351fd3ad3..abf20d54da 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -107,7 +107,7 @@ declare namespace Realm { error?: ErrorCallback; } - interface ConfigurationWithSync { + interface BaseConfiguration { encryptionKey?: ArrayBuffer | ArrayBufferView | Int8Array; schema?: (ObjectClass | ObjectSchema)[]; schemaVersion?: number; @@ -115,19 +115,20 @@ declare namespace Realm { path?: string; fifoFilesFallbackPath?: string; readOnly?: boolean; - sync: SyncConfiguration; } - interface ConfigurationWithoutSync { - encryptionKey?: ArrayBuffer | ArrayBufferView | Int8Array; + interface ConfigurationWithSync extends BaseConfiguration { + sync: SyncConfiguration, + migration?: never, + inMemory?: never, + deleteRealmIfMigrationNeeded?: never, + disableFormatUpgrade?: never + } + + interface ConfigurationWithoutSync extends BaseConfiguration { + sync?: never, migration?: MigrationCallback; - shouldCompactOnLaunch?: (totalBytes: number, usedBytes: number) => boolean; - path?: string; - fifoFilesFallbackPath?: string; - readOnly?: boolean; inMemory?: boolean; - schema?: (ObjectClass | ObjectSchema)[]; - schemaVersion?: number; deleteRealmIfMigrationNeeded?: boolean; disableFormatUpgrade?: boolean; } @@ -138,7 +139,6 @@ declare namespace Realm { */ type Configuration = ConfigurationWithSync | ConfigurationWithoutSync; - /** * realm configuration used for overriding default configuration values. * @see { @link https://realm.io/docs/javascript/latest/api/Realm.html#~Configuration }