Skip to content

Commit

Permalink
Fixed OrderedCollection and various others
Browse files Browse the repository at this point in the history
  • Loading branch information
takameyer committed Aug 10, 2023
1 parent 0e7ed06 commit 676772c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
10 changes: 6 additions & 4 deletions integration-tests/tests/src/tests/iterators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,10 @@ describe("Iterating", () => {
}).throws("Object type 'SomeOtherClass' not found in schema");
});

type CollectionContext = { collection: Collection<unknown, Person, [unknown, Person], unknown> } & RealmContext;
type OrderedCollectionContext = { collection: OrderedCollection<Person> } & RealmContext;
type CollectionContext = { collection: Realm.Collection<unknown, Person, [unknown, Person], unknown> } & RealmContext;
type OrderedCollectionContext = { collection: Realm.OrderedCollection<Person> } & RealmContext;

function ifOrderedCollectionIt(title: string, test: (collection: OrderedCollection<Person>) => void) {
function ifOrderedCollectionIt(title: string, test: (collection: Realm.OrderedCollection<Person>) => void) {
it(title, function (this: OrderedCollectionContext) {
const { collection } = this;
if (!(collection instanceof OrderedCollection)) {
Expand All @@ -124,7 +124,9 @@ describe("Iterating", () => {
});
}

function collectionBefore(getCollection: (realm: Realm) => Collection<unknown, Person, [unknown, Person], unknown>) {
function collectionBefore(
getCollection: (realm: Realm) => Realm.Collection<unknown, Person, [unknown, Person], unknown>,
) {
before(function (this: CollectionContext) {
this.collection = getCollection(this.realm);
});
Expand Down
6 changes: 3 additions & 3 deletions integration-tests/tests/src/tests/sync/open-behavior.ts
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ describe("OpenBehaviour", function () {
_sessionStopPolicy: "immediately",
newRealmFileBehavior: { type: "foo" },
},
}),
} as unknown as Realm.Configuration),
).throws;

await expect(() =>
Expand All @@ -592,7 +592,7 @@ describe("OpenBehaviour", function () {
_sessionStopPolicy: "immediately",
newRealmFileBehavior: { type: OpenRealmBehaviorType.OpenImmediately, timeOutBehavior: "foo" },
},
}),
} as unknown as Realm.Configuration),
).throws;

await expect(() =>
Expand All @@ -604,7 +604,7 @@ describe("OpenBehaviour", function () {
_sessionStopPolicy: "immediately",
newRealmFileBehavior: { type: OpenRealmBehaviorType.OpenImmediately, timeOut: "bar" },
},
}),
} as unknown as Realm.Configuration),
).throws;
});
});
2 changes: 2 additions & 0 deletions packages/realm/src/Realm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1386,6 +1386,7 @@ type MongoDBCollectionType<T extends Document> = MongoDBCollection<T>;
type MongoDBDatabaseType = MongoDBDatabase;
type NewDocumentType<T extends Document> = NewDocument<T>;
type OperationTypeType = OperationType;
type OrderedCollectionType<T = unknown> = OrderedCollection<T>;
type RenameEventType = RenameEvent;
type ReplaceEventType<T extends Document> = ReplaceEvent<T>;
type UpdateType = Update;
Expand Down Expand Up @@ -1465,6 +1466,7 @@ export declare namespace Realm {
OpenRealmBehaviorConfiguration,
OpenRealmBehaviorTypeType as OpenRealmBehaviorType,
OpenRealmTimeOutBehaviorType as OpenRealmTimeOutBehavior,
OrderedCollectionType as OrderedCollection,
PartitionSyncConfiguration,
PrimaryKey,
PrimitivePropertyTypeName,
Expand Down

0 comments on commit 676772c

Please sign in to comment.