Update typescript declarations for arrays of primitives (#1359)
This commit is contained in:
parent
fc4f6f6c20
commit
154d259326
|
@ -120,7 +120,7 @@ declare namespace Realm {
|
||||||
* SortDescriptor
|
* SortDescriptor
|
||||||
* @see { @link https://realm.io/docs/javascript/latest/api/Realm.Collection.html#~SortDescriptor }
|
* @see { @link https://realm.io/docs/javascript/latest/api/Realm.Collection.html#~SortDescriptor }
|
||||||
*/
|
*/
|
||||||
type SortDescriptor = string | [string, boolean] | any[];
|
type SortDescriptor = [string] | [string, boolean];
|
||||||
|
|
||||||
interface CollectionChangeSet {
|
interface CollectionChangeSet {
|
||||||
insertions: number[];
|
insertions: number[];
|
||||||
|
@ -135,6 +135,9 @@ declare namespace Realm {
|
||||||
* @see { @link https://realm.io/docs/javascript/latest/api/Realm.Collection.html }
|
* @see { @link https://realm.io/docs/javascript/latest/api/Realm.Collection.html }
|
||||||
*/
|
*/
|
||||||
interface Collection<T> extends ReadonlyArray<T> {
|
interface Collection<T> extends ReadonlyArray<T> {
|
||||||
|
readonly type: PropertyType;
|
||||||
|
readonly optional: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns boolean
|
* @returns boolean
|
||||||
*/
|
*/
|
||||||
|
@ -147,12 +150,9 @@ declare namespace Realm {
|
||||||
*/
|
*/
|
||||||
filtered(query: string, ...arg: any[]): Results<T>;
|
filtered(query: string, ...arg: any[]): Results<T>;
|
||||||
|
|
||||||
/**
|
sorted(reverse?: boolean): Results<T>;
|
||||||
* @param {string|SortDescriptor} descriptor
|
sorted(descriptor: SortDescriptor[]): Results<T>;
|
||||||
* @param {boolean} reverse?
|
sorted(descriptor: string, reverse?: boolean): Results<T>;
|
||||||
* @returns Results
|
|
||||||
*/
|
|
||||||
sorted(descriptor: string | SortDescriptor, reverse?: boolean): Results<T>;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns Results
|
* @returns Results
|
||||||
|
@ -188,22 +188,21 @@ declare namespace Realm {
|
||||||
interface List<T> extends Collection<T> {
|
interface List<T> extends Collection<T> {
|
||||||
[n: number]: T;
|
[n: number]: T;
|
||||||
|
|
||||||
/**
|
|
||||||
* @returns T
|
|
||||||
*/
|
|
||||||
pop(): T | null | undefined;
|
pop(): T | null | undefined;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {T} object
|
* @param {T} object
|
||||||
* @returns number
|
* @returns number
|
||||||
*/
|
*/
|
||||||
push(object: T): number;
|
push(...object: T[]): number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns T
|
* @returns T
|
||||||
*/
|
*/
|
||||||
shift(): T | null | undefined;
|
shift(): T | null | undefined;
|
||||||
|
|
||||||
|
unshift(...object: T[]): number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {number} index
|
* @param {number} index
|
||||||
* @param {number} count?
|
* @param {number} count?
|
||||||
|
@ -211,12 +210,6 @@ declare namespace Realm {
|
||||||
* @returns T
|
* @returns T
|
||||||
*/
|
*/
|
||||||
splice(index: number, count?: number, object?: any): T[];
|
splice(index: number, count?: number, object?: any): T[];
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {T} object
|
|
||||||
* @returns number
|
|
||||||
*/
|
|
||||||
unshift(object: T): number;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const List: {
|
const List: {
|
||||||
|
@ -296,8 +289,7 @@ declare namespace Realm.Sync {
|
||||||
}
|
}
|
||||||
|
|
||||||
type PermissionCondition = {
|
type PermissionCondition = {
|
||||||
userId: string |
|
userId: string | { metadataKey: string, metadataValue: string }
|
||||||
{ metadataKey: string, metadataValue: string }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
type AccessLevel = 'none' | 'read' | 'write' | 'admin';
|
type AccessLevel = 'none' | 'read' | 'write' | 'admin';
|
||||||
|
|
Loading…
Reference in New Issue