Skip to content

Commit

Permalink
Using for mutual-exclusive TS def
Browse files Browse the repository at this point in the history
  • Loading branch information
kneth committed Jun 8, 2021
1 parent 5fcac62 commit d60c373
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,27 +107,28 @@ declare namespace Realm {
error?: ErrorCallback;
}

interface ConfigurationWithSync {
interface BaseConfiguration {
encryptionKey?: ArrayBuffer | ArrayBufferView | Int8Array;
schema?: (ObjectClass | ObjectSchema)[];
schemaVersion?: number;
shouldCompactOnLaunch?: (totalBytes: number, usedBytes: number) => boolean;
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;
}
Expand All @@ -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 }
Expand Down

0 comments on commit d60c373

Please sign in to comment.