From 40a1445181572d0f354ce4e81eecf767a94618af Mon Sep 17 00:00:00 2001 From: Andrea Jemmett Date: Wed, 12 Dec 2018 10:33:46 +0100 Subject: [PATCH] updated universal-router to 7.0.0 --- types/universal-router/index.d.ts | 5 +++-- types/universal-router/universal-router-tests.ts | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/types/universal-router/index.d.ts b/types/universal-router/index.d.ts index eb698fc8bf..8dd2357f03 100644 --- a/types/universal-router/index.d.ts +++ b/types/universal-router/index.d.ts @@ -1,8 +1,9 @@ -// Type definitions for universal-router 6.0 +// Type definitions for universal-router 7.0 // Project: https://github.com/kriasoft/universal-router // Definitions by: Jack Moore // Tomek Łaziuk // Lodin +// acidghost // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -101,7 +102,7 @@ export interface Options { context?: C; baseUrl?: string; resolveRoute?: (context: ActionContext & C, params: Params) => any; - errorHandler?: (error: Error & { context: C, code: number }) => any; + errorHandler?: (error: Error & { status: number }, context: C) => any; } /** diff --git a/types/universal-router/universal-router-tests.ts b/types/universal-router/universal-router-tests.ts index 02c79fb062..40b5ac32c1 100644 --- a/types/universal-router/universal-router-tests.ts +++ b/types/universal-router/universal-router-tests.ts @@ -12,10 +12,10 @@ new UniversalRouter( user: 'name', }, baseUrl: '/base', - errorHandler: (error) => { + errorHandler: (error, context) => { console.error(error); - console.dir(error.context); - return error.code === 404 + console.dir(context); + return error.status === 404 ? '

Page Not Found

' : '

Oops! Something went wrong

'; },