From 6292510eddb891a0eb305d2cb08c2e5f6206635e Mon Sep 17 00:00:00 2001 From: richardgong1987 <909253305@qq.com> Date: Mon, 24 Apr 2017 09:28:52 +0800 Subject: [PATCH 1/5] add loopback Remote hooks definitely types --- .gitignore | 1 + types/loopback/index.d.ts | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/.gitignore b/.gitignore index 5b79863e52..bf7fc48845 100644 --- a/.gitignore +++ b/.gitignore @@ -41,3 +41,4 @@ node_modules .vs .vscode yarn.lock +.idea diff --git a/types/loopback/index.d.ts b/types/loopback/index.d.ts index adb14ae209..0f7737c316 100644 --- a/types/loopback/index.d.ts +++ b/types/loopback/index.d.ts @@ -11,6 +11,7 @@ ************************************************/ import * as core from "express-serve-static-core"; +import {NextFunction} from "../express-serve-static-core/index"; declare function l(): l.LoopBackApplication; declare namespace l { @@ -886,8 +887,27 @@ declare namespace l { * See [Setting up a custom model](docs.strongloop.com/display/LB/Extending+built-in+models#Extendingbuilt-inmodels-Settingupacustommodel) */ static setup(): void; + + static setup(): void; + + /** + * loopback 3.x Remote hooks + * http://loopback.io/doc/en/lb3/Remote-hooks.html + * @param method + * @param fn + */ + beforeRemote(method: string, backback: (ctx: Context, modelInstanceOrNext: Model + | NextFunction, next?: NextFunction)=>void): void; + + afterRemote(method: string, backback: (ctx: Context, modelInstanceOrNext: Model + | NextFunction, next?: NextFunction) => void): void; + + afterRemoteError(method: string, next: NextFunction): void; + } + + /** * SharedClass * Create a new SharedClass with the given options. From 5dd01a9a7182bedf0cb8b42a5ed9daef0a03caa7 Mon Sep 17 00:00:00 2001 From: richardgong1987 <909253305@qq.com> Date: Mon, 24 Apr 2017 09:37:42 +0800 Subject: [PATCH 2/5] add loopback Remote hooks definitely types --- types/loopback/index.d.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/types/loopback/index.d.ts b/types/loopback/index.d.ts index 0f7737c316..d4ba602f25 100644 --- a/types/loopback/index.d.ts +++ b/types/loopback/index.d.ts @@ -11,7 +11,7 @@ ************************************************/ import * as core from "express-serve-static-core"; -import {NextFunction} from "../express-serve-static-core/index"; +import {NextFunction} from "../express/index"; declare function l(): l.LoopBackApplication; declare namespace l { @@ -888,8 +888,6 @@ declare namespace l { */ static setup(): void; - static setup(): void; - /** * loopback 3.x Remote hooks * http://loopback.io/doc/en/lb3/Remote-hooks.html From 7e22b1422f4c602615e57bd295acc6ccfe7cc3e9 Mon Sep 17 00:00:00 2001 From: richardgong1987 <909253305@qq.com> Date: Mon, 24 Apr 2017 09:39:46 +0800 Subject: [PATCH 3/5] add loopback Remote hooks definitely types --- types/loopback/index.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/types/loopback/index.d.ts b/types/loopback/index.d.ts index d4ba602f25..fd3c363cbb 100644 --- a/types/loopback/index.d.ts +++ b/types/loopback/index.d.ts @@ -892,15 +892,15 @@ declare namespace l { * loopback 3.x Remote hooks * http://loopback.io/doc/en/lb3/Remote-hooks.html * @param method - * @param fn + * @param backback */ - beforeRemote(method: string, backback: (ctx: Context, modelInstanceOrNext: Model + beforeRemote(method: string, callback: (ctx: Context, modelInstanceOrNext: Model | NextFunction, next?: NextFunction)=>void): void; - afterRemote(method: string, backback: (ctx: Context, modelInstanceOrNext: Model + afterRemote(method: string, callback: (ctx: Context, modelInstanceOrNext: Model | NextFunction, next?: NextFunction) => void): void; - afterRemoteError(method: string, next: NextFunction): void; + afterRemoteError(method: string, callback: NextFunction): void; } From 498022ec6842fe17ac6cb7abc9b413c6283ec60b Mon Sep 17 00:00:00 2001 From: richardgong1987 <909253305@qq.com> Date: Mon, 24 Apr 2017 09:40:32 +0800 Subject: [PATCH 4/5] add loopback Remote hooks definitely types --- types/loopback/index.d.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/types/loopback/index.d.ts b/types/loopback/index.d.ts index fd3c363cbb..e17b6f368e 100644 --- a/types/loopback/index.d.ts +++ b/types/loopback/index.d.ts @@ -901,11 +901,8 @@ declare namespace l { | NextFunction, next?: NextFunction) => void): void; afterRemoteError(method: string, callback: NextFunction): void; - } - - /** * SharedClass * Create a new SharedClass with the given options. From a306138098c65bc87e5a0f059cb1b3caf9793ef7 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Thu, 1 Jun 2017 07:09:27 -0700 Subject: [PATCH 5/5] Fix lint --- types/loopback/index.d.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/types/loopback/index.d.ts b/types/loopback/index.d.ts index e17b6f368e..e4c31c7f8d 100644 --- a/types/loopback/index.d.ts +++ b/types/loopback/index.d.ts @@ -11,7 +11,7 @@ ************************************************/ import * as core from "express-serve-static-core"; -import {NextFunction} from "../express/index"; +import { NextFunction } from "express"; declare function l(): l.LoopBackApplication; declare namespace l { @@ -894,11 +894,9 @@ declare namespace l { * @param method * @param backback */ - beforeRemote(method: string, callback: (ctx: Context, modelInstanceOrNext: Model - | NextFunction, next?: NextFunction)=>void): void; + beforeRemote(method: string, callback: (ctx: Context, modelInstanceOrNext: Model | NextFunction, next?: NextFunction) => void): void; - afterRemote(method: string, callback: (ctx: Context, modelInstanceOrNext: Model - | NextFunction, next?: NextFunction) => void): void; + afterRemote(method: string, callback: (ctx: Context, modelInstanceOrNext: Model | NextFunction, next?: NextFunction) => void): void; afterRemoteError(method: string, callback: NextFunction): void; }