diff --git a/types/bookshelf/bookshelf-tests.ts b/types/bookshelf/bookshelf-tests.ts index 81c42f7680..ff56b0497b 100644 --- a/types/bookshelf/bookshelf-tests.ts +++ b/types/bookshelf/bookshelf-tests.ts @@ -701,17 +701,15 @@ qb.where({id: 1}).select().then(resp => { /* model.refresh(), see http://bookshelfjs.org/#Model-instance-refresh */ -/* model.related(), see http://bookshelfjs.org/#Model-instance-related */ +/* model.related(), see https://bookshelfjs.org/api.html#Model-instance-related */ class Trip extends bookshelf.Model {} class Trips extends bookshelf.Collection {} new Photo({id: 1}).fetch({ withRelated: ['account'] }).then(photo => { - if (photo) { - var account = photo.related('account'); - if (account.id) { - return ( account.related('trips')).fetch(); - } + var account = photo.related('account') as Account; + if (account.id) { + return (account.related('trips') as Trips).fetch(); } }); @@ -974,10 +972,12 @@ let tabs = new TabSet([tab1, tab2, tab3]); /* Collection.extend(), see http://bookshelfjs.org/#Collection-static-extend */ -/* Collection.forge(), see http://bookshelfjs.org/#Collection-static-forge */ +/* Collection.forge(), see https://bookshelfjs.org/api.html#Collection-static-forge */ class Accounts extends bookshelf.Collection { - model: Account + get model() { + return Account + } } var accounts = Accounts.forge([ @@ -985,7 +985,7 @@ var accounts = Accounts.forge([ {name: 'Person2'} ]); -Promise.all(accounts.invoke('save')).then(() => { +Promise.all(accounts.invokeMap('save')).then(() => { // collection models should now be saved... }); @@ -1219,63 +1219,26 @@ ships.trigger('fetched'); } } -/* Lodash methods, see http://bookshelfjs.org/#Collection-subsection-lodash-methods */ +/* Lodash methods, see https://bookshelfjs.org/api.html#Collection-subsection-lodash-methods */ -/* all(), see http://lodash.com/docs/#all */ - -/* any(), see http://lodash.com/docs/#any */ - -/* chain(), see http://lodash.com/docs/#chain */ - -/* collect(), see http://lodash.com/docs/#collect */ - -/* contains(), see http://lodash.com/docs/#contains */ - -/* countBy(), see http://lodash.com/docs/#countBy */ - -/* detect(), see http://lodash.com/docs/#detect */ - -/* difference(), see http://lodash.com/docs/#difference */ - -/* drop(), see http://lodash.com/docs/#drop */ - -/* each(), see http://lodash.com/docs/#each */ - -/* every(), see http://lodash.com/docs/#every */ - -/* filter(), see http://lodash.com/docs/#filter */ - -/* find(), see http://lodash.com/docs/#find */ - -/* first(), see http://lodash.com/docs/#first */ - -/* foldl(), see http://lodash.com/docs/#foldl */ - -/* foldr(), see http://lodash.com/docs/#foldr */ - -/* forEach(), see http://lodash.com/docs/#forEach */ - -/* groupBy(), see http://lodash.com/docs/#groupBy */ - -/* head(), see http://lodash.com/docs/#head */ - -/* include(), see http://lodash.com/docs/#include */ - -/* indexOf(), see http://lodash.com/docs/#indexOf */ - -/* initial(), see http://lodash.com/docs/#initial */ - -/* inject(), see http://lodash.com/docs/#inject */ - -/* invoke(), see http://lodash.com/docs/#invoke */ - -/* isEmpty(), see http://lodash.com/docs/#isEmpty */ - -/* last(), see http://lodash.com/docs/#last */ - -/* lastIndexOf(), see http://lodash.com/docs/#lastIndexOf */ - -/* map(), see http://lodash.com/docs/#map */ +/* +- countBy() +- every() +- filter() +- find() +- forEach() +- groupBy() +- includes() +- invokeMap() +- isEmpty() +- map() +- reduce() +- reduceRight() +- reject() +- some() +- sortBy() +- toArray() +*/ // TODO No example provided on Bookshelf website diff --git a/types/bookshelf/index.d.ts b/types/bookshelf/index.d.ts index 2e5a4b71c6..3990e1e19c 100644 --- a/types/bookshelf/index.d.ts +++ b/types/bookshelf/index.d.ts @@ -1,10 +1,10 @@ -// Type definitions for bookshelfjs v1.0.1 +// Type definitions for bookshelfjs v1.1.1 // Project: http://bookshelfjs.org/ // Definitions by: Andrew Schurman // Vesa Poikajärvi // Ian Serpa // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 3.2 +// Minimum TypeScript Version: 3.6 import Knex = require('knex'); import knex = require('knex'); @@ -214,32 +214,12 @@ declare namespace Bookshelf { where(match: { [key: string]: any }, firstOnly: boolean): T | Collection; // lodash methods - all( - predicate?: Lodash.ListIterator | Lodash.DictionaryIterator | string, - thisArg?: any, - ): boolean; - all(predicate?: R): boolean; - any( - predicate?: Lodash.ListIterator | Lodash.DictionaryIterator | string, - thisArg?: any, - ): boolean; - any(predicate?: R): boolean; - collect( - predicate?: Lodash.ListIterator | Lodash.DictionaryIterator | string, - thisArg?: any, - ): T[]; - collect(predicate?: R): T[]; - contains(value: any, fromIndex?: number): boolean; + includes(value: any, fromIndex?: number): boolean; countBy( predicate?: Lodash.ListIterator | Lodash.DictionaryIterator | string, thisArg?: any, ): Lodash.Dictionary; countBy(predicate?: R): Lodash.Dictionary; - detect( - predicate?: Lodash.ListIterator | Lodash.DictionaryIterator | string, - thisArg?: any, - ): T; - detect(predicate?: R): T; every( predicate?: Lodash.ListIterator | Lodash.DictionaryIterator | string, thisArg?: any, @@ -256,8 +236,6 @@ declare namespace Bookshelf { ): T; find(predicate?: R): T; first(): T; - foldl(callback?: Lodash.MemoIterator, accumulator?: R, thisArg?: any): R; - foldr(callback?: Lodash.MemoIterator, accumulator?: R, thisArg?: any): R; forEach(callback?: Lodash.ListIterator, thisArg?: any): Lodash.List; forEach(callback?: Lodash.DictionaryIterator, thisArg?: any): Lodash.Dictionary; forEach(callback?: Lodash.ObjectIterator, thisArg?: any): T; @@ -266,9 +244,7 @@ declare namespace Bookshelf { thisArg?: any, ): Lodash.Dictionary; groupBy(predicate?: R): Lodash.Dictionary; - include(value: any, fromIndex?: number): boolean; - inject(callback?: Lodash.MemoIterator, accumulator?: R, thisArg?: any): R; - invoke(methodName: string | Function, ...args: any[]): any; + invokeMap(methodName: string | Function, ...args: any[]): any; isEmpty(): boolean; keys(): string[]; last(): T; @@ -286,12 +262,7 @@ declare namespace Bookshelf { thisArg?: any, ): T[]; reject(predicate?: R): T[]; - rest(): T[]; - select( - predicate?: Lodash.ListIterator | Lodash.DictionaryIterator | string, - thisArg?: any, - ): T[]; - select(predicate?: R): T[]; + tail(): T[]; some( predicate?: Lodash.ListIterator | Lodash.DictionaryIterator | string, thisArg?: any, diff --git a/types/bookshelf/package.json b/types/bookshelf/package.json index 6c3b8365ac..5d5151e955 100644 --- a/types/bookshelf/package.json +++ b/types/bookshelf/package.json @@ -1,6 +1,6 @@ { "private": true, "dependencies": { - "knex": "^0.17.0" + "knex": "^0.20.13" } } diff --git a/types/bookshelf/tsconfig.json b/types/bookshelf/tsconfig.json index e983e9b53c..f74781805d 100644 --- a/types/bookshelf/tsconfig.json +++ b/types/bookshelf/tsconfig.json @@ -5,10 +5,7 @@ "lib": [ "es6" ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, + "strict": true, "baseUrl": "../", "typeRoots": [ "../"