From 8b89df6f8ae644e2923d509345f555aff0faf704 Mon Sep 17 00:00:00 2001 From: spacejack Date: Fri, 1 Feb 2019 19:15:09 -0500 Subject: [PATCH] Use RouteOptions type, test other properties --- types/mithril/index.d.ts | 2 +- types/mithril/test/test-route.ts | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/types/mithril/index.d.ts b/types/mithril/index.d.ts index 86c20f57cd..a8a80c7bd2 100644 --- a/types/mithril/index.d.ts +++ b/types/mithril/index.d.ts @@ -96,7 +96,7 @@ declare namespace Mithril { prefix(urlFragment: string): void; /** This method is meant to be used in conjunction with an Vnode's oncreate/onupdate hooks. */ link(vnode: Vnode): (e?: Event) => any; - link(options: {replace: boolean}): (vnode: Vnode) => (e?: Event) => any; + link(options: RouteOptions): (vnode: Vnode) => (e?: Event) => any; /** Returns the named parameter value from the current route. */ param(name: string): string; /** Gets all route parameters. */ diff --git a/types/mithril/test/test-route.ts b/types/mithril/test/test-route.ts index 8cb2a21a21..a7737af671 100644 --- a/types/mithril/test/test-route.ts +++ b/types/mithril/test/test-route.ts @@ -127,8 +127,16 @@ const path: string = route.get(); const fn1: (e?: Event) => any = route.link(h('div', 'test')); -const fn2: (v: Vnode) => any = route.link({replace: true}); +const fn2: (v: Vnode) => any = route.link({ + replace: true, + state: {abc: 123}, + title: "Title" +}); const ex1 = h('a', {href: '/url', oncreate: route.link}); -const ex2 = h('a', {href: '/url', oncreate: route.link({replace: true})}); +const ex2 = h('a', {href: '/url', oncreate: route.link({ + replace: true, + state: {abc: 123}, + title: "Title" +})});