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