From 905ee7e6f5a1971e3f8aef16ee789f4600ca5e51 Mon Sep 17 00:00:00 2001 From: Ryan Smith <0ryansmith1994@gmail.com> Date: Wed, 30 Mar 2016 18:18:16 +0100 Subject: [PATCH] Attempts to fix more TS2339 errors. ``` knex/knex-tests.ts(498,45): error TS2339: Property 'map' does not exist on type 'QueryBuilder'. knex/knex-tests.ts(506,45): error TS2339: Property 'reduce' does not exist on type 'QueryBuilder'. ``` https://travis-ci.org/DefinitelyTyped/DefinitelyTyped/builds/119590526 --- knex/knex-tests.ts | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/knex/knex-tests.ts b/knex/knex-tests.ts index 2113be68d7..c0483c5d97 100644 --- a/knex/knex-tests.ts +++ b/knex/knex-tests.ts @@ -495,19 +495,23 @@ query.then(function(x: any) { return x; }); -knex.select('name').from('users').limit(10).map(function(row: any) { - return row.name; +knex.select('name').from('users').limit(10).then(function (rows: any[]) { + return rows.map(function (row: string) { + return row.name; + }); }).then(function(names: string) { console.log(names); }).catch(function(e: Error) { console.error(e); }); -knex.select('name').from('users').limit(10).reduce(function(memo: any, row: any) { - memo.names.push(row.name); - memo.count++; - return memo; -}, {count: 0, names: []}).then(function(obj: any) { +knex.select('name').from('users').limit(10).then(function (rows: any[]) { + return rows.reduce(function(memo: any, row: any) { + memo.names.push(row.name); + memo.count++; + return memo; + }, {count: 0, names: []}) +}).then(function(obj: any) { console.log(obj); }).catch(function(e: Error) { console.error(e);