From 1e8b8a041b00adfacd2bbc26980249f918b83325 Mon Sep 17 00:00:00 2001 From: Raymond Feng Date: Thu, 19 Sep 2019 09:22:08 -0700 Subject: [PATCH] Fix typescript typing for DataSource.getModel See https://github.com/strongloop/loopback-next/pull/3722 --- types/datasource.d.ts | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/types/datasource.d.ts b/types/datasource.d.ts index 4c64b3098..177b12b1a 100644 --- a/types/datasource.d.ts +++ b/types/datasource.d.ts @@ -108,7 +108,15 @@ export declare class DataSource extends EventEmitter { options?: Options, ): T; - getModel(modelName: string): ModelBaseClass | undefined; + /** + * Look up a model class by name + * @param modelName Model name + * @param forceCreate A flag to force creation of a model if not found + */ + getModel( + modelName: string, + forceCreate?: boolean, + ): ModelBaseClass | undefined; /** * Remove a model from the registry. @@ -197,17 +205,15 @@ export declare class DataSource extends EventEmitter { execute( command: string | object, args?: any[] | object, - options?: Options + options?: Options, ): Promise; -/** - * Begin a new transaction. - * - * - * @param [options] Options {isolationLevel: '...', timeout: 1000} - * @returns Promise A promise which resolves to a Transaction object - */ - beginTransaction( - options?: IsolationLevel | Options, - ): Promise; + /** + * Begin a new transaction. + * + * + * @param [options] Options {isolationLevel: '...', timeout: 1000} + * @returns Promise A promise which resolves to a Transaction object + */ + beginTransaction(options?: IsolationLevel | Options): Promise; }