diff --git a/types/parse/index.d.ts b/types/parse/index.d.ts index 1973c8938b..d186211983 100644 --- a/types/parse/index.d.ts +++ b/types/parse/index.d.ts @@ -4,6 +4,7 @@ // David Poetzsch-Heffter // Cedric Kemp // Flavio Negrão +// Wes Grimes // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -644,6 +645,7 @@ declare namespace Parse { select(...keys: string[]): Query; skip(n: number): Query; startsWith(key: string, prefix: string): Query; + subscribe(): Events; withinGeoBox(key: string, southwest: GeoPoint, northeast: GeoPoint): Query; withinKilometers(key: string, point: GeoPoint, maxDistance: number): Query; withinMiles(key: string, point: GeoPoint, maxDistance: number): Query; diff --git a/types/parse/parse-tests.ts b/types/parse/parse-tests.ts index 87194ba02c..06ec062880 100644 --- a/types/parse/parse-tests.ts +++ b/types/parse/parse-tests.ts @@ -491,3 +491,16 @@ function test_batch_operations() { Parse.Object.fetchAllIfNeeded(games, { sessionToken: '' }) } +function test_query_subscribe() { + // create new query from Game object type + const query = new Parse.Query(Game); + + // create subscription to Game object + const subscription = query.subscribe(); + + // listen for new Game objects created on Parse server + subscription.on('create', (game: any) => { + console.log(game); + }); +} +