Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: LJ <81748770+elle-j@users.noreply.github.com>
  • Loading branch information
takameyer and elle-j committed Jul 13, 2023
1 parent 170ac54 commit 52430d1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions packages/realm/src/Dictionary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ export class Dictionary<T = unknown> extends Collection<string, T, [string, T],
* @returns An iterator with all values in the dictionary.
* @since 0.11.0
* @ts-expect-error We're exposing methods in the end-users namespace of keys */
*keys() {
*keys(): Generator<string> {
const snapshot = this[INTERNAL].keys.snapshot();
const size = snapshot.size();
for (let i = 0; i < size; i++) {
Expand Down Expand Up @@ -291,7 +291,7 @@ export class Dictionary<T = unknown> extends Collection<string, T, [string, T],
* Removes elements from the dictionary, with the keys provided.
* This does not throw if the keys are already missing from the dictionary.
* @param key - The key to be removed.
* @throws an {@link AssertionError} If not inside a write transaction.
* @throws An {@link AssertionError} if not inside a write transaction.
* @returns The dictionary
* @since 10.6.0
* @ts-expect-error We're exposing methods in the end-users namespace of keys */
Expand Down
24 changes: 12 additions & 12 deletions packages/realm/src/List.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export class List<T = unknown> extends OrderedCollection<T> implements Partially
* Checks if this collection has not been deleted and is part of a valid Realm.
* @returns `true` if the collection can be safely accessed.
*/
isValid() {
isValid(): boolean {
return this.internal.isValid;
}

Expand Down Expand Up @@ -134,10 +134,10 @@ export class List<T = unknown> extends OrderedCollection<T> implements Partially
/**
* Add one or more values to the _end_ of the list.
* @param items - Values to add to the list.
* @throws {TypeError} If a `value` is not of a type which can be stored in
* @throws A {TypeError} if a value is not of a type which can be stored in
* the list, or if an object being added to the list does not match the {@link ObjectSchema} for the list.
* @throws an {@link AssertionError} If not inside a write transaction.
* @returns A number equal to the new length of the list after adding the values.
* @throws An {@link AssertionError} if not inside a write transaction.
* @returns The new length of the list after adding the values.
*/
push(...items: T[]): number {
assert.inTransaction(this.realm);
Expand All @@ -162,7 +162,7 @@ export class List<T = unknown> extends OrderedCollection<T> implements Partially
/**
* Remove the **first** value from the list and return it.
* @throws An {@link AssertionError} if not inside a write transaction.
* @returns The first value or undefined if the list is empty.
* @returns The first value or `undefined` if the list is empty.
*/
shift(): T | undefined {
assert.inTransaction(this.realm);
Expand All @@ -180,7 +180,7 @@ export class List<T = unknown> extends OrderedCollection<T> implements Partially
/**
* Add one or more values to the _beginning_ of the list.
* @param items - Values to add to the list.
* @throws {TypeError} If a `value` is not of a type which can be stored in
* @throws A {TypeError} if a value is not of a type which can be stored in
* the list, or if an object being added to the list does not match the {@link ObjectSchema} for the list.
* @throws An {@link AssertionError} if not inside a write transaction.
* @returns The new {@link length} of the list after adding the values.
Expand Down Expand Up @@ -289,8 +289,8 @@ export class List<T = unknown> extends OrderedCollection<T> implements Partially
/**
* Removes the element of the list at the specified index.
* @param index - The index of the element to remove.
* @throws an {@link AssertionError} If not inside a write transaction or the input index is less than 0
* or greater than the size of the list.
* @throws An {@link AssertionError} if not inside a write transaction or the input index is less than 0
* or greater than or equal to the size of the list.
*/
remove(index: number) {
assert.inTransaction(this.realm);
Expand All @@ -306,8 +306,8 @@ export class List<T = unknown> extends OrderedCollection<T> implements Partially
* Moves one element of the list from one index to another.
* @param from - The index of the element to move.
* @param to - The destination index of the element.
* @throws an {@link AssertionError} If not inside a write transaction or if any of the input indexes
* is less than 0 or greater than the size of the list.
* @throws An {@link AssertionError} if not inside a write transaction or if any of the input indexes
* is less than 0 or greater than or equal to the size of the list.
*/
move(from: number, to: number) {
assert.inTransaction(this.realm);
Expand All @@ -326,9 +326,9 @@ export class List<T = unknown> extends OrderedCollection<T> implements Partially
* @param index1 - The index of the first element.
* @param index2 - The index of the second element.
* @throws An {@link AssertionError} if not inside a write transaction or if any of the input indexes
* is less than 0 or greater than the size of the list.
* is less than 0 or greater than or equal to the size of the list.
*/
swap(index1: number, index2: number) {
swap(index1: number, index2: number): void {
assert.inTransaction(this.realm);
assert.number(index1, "index1");
assert.number(index2, "index2");
Expand Down
6 changes: 3 additions & 3 deletions packages/realm/src/Object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,17 +138,17 @@ export class RealmObject<T = DefaultObject, RequiredProperties extends keyof Omi
public static allowValuesArrays = false;

/**
* Optionally specify the primary key of the schema when using [`@realm/babel-plugin`](https://www.npmjs.com/package/@realm/babel-plugin).
* Optionally specify the primary key of the schema when using [@realm/babel-plugin](https://www.npmjs.com/package/@realm/babel-plugin).
*/
static primaryKey?: string;

/**
* Optionally specify that the schema is an embedded schema when using [`@realm/babel-plugin`](https://www.npmjs.com/package/@realm/babel-plugin).
* Optionally specify that the schema is an embedded schema when using [@realm/babel-plugin](https://www.npmjs.com/package/@realm/babel-plugin).
*/
static embedded?: boolean;

/**
* Optionally specify that the schema should sync unidirectionally if using flexible sync when using [`@realm/babel-plugin`](https://www.npmjs.com/package/@realm/babel-plugin).
* Optionally specify that the schema should sync unidirectionally if using flexible sync when using [@realm/babel-plugin](https://www.npmjs.com/package/@realm/babel-plugin).
*/
static asymmetric?: boolean;

Expand Down

0 comments on commit 52430d1

Please sign in to comment.