Skip to content

Commit ed49a9f

Browse files
committed
type check util/warn
1 parent b609d1b commit ed49a9f

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/create-matcher.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export function createMatcher (routes: Array<RouteConfig>): Matcher {
104104
hash
105105
}, undefined, location)
106106
} else {
107-
warn(`invalid redirect option: ${JSON.stringify(redirect)}`)
107+
warn(false, `invalid redirect option: ${JSON.stringify(redirect)}`)
108108
return createRouteContext(null, location)
109109
}
110110
}
@@ -174,7 +174,7 @@ function fillParams (
174174
(regexpCompileCache[path] = Regexp.compile(path))
175175
return filler(params || {}, { pretty: true })
176176
} catch (e) {
177-
assert(`missing param for ${routeMsg}: ${e.message}`)
177+
assert(false, `missing param for ${routeMsg}: ${e.message}`)
178178
return ''
179179
}
180180
}

src/util/warn.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
export function assert (condition, message) {
1+
/* @flow */
2+
3+
export function assert (condition: any, message: string) {
24
if (!condition) {
35
throw new Error(`[vue-router] ${message}`)
46
}
57
}
68

7-
export function warn (condition, message) {
9+
export function warn (condition: any, message: string) {
810
if (!condition) {
911
typeof console !== 'undefined' && console.warn(`[vue-router] ${message}`)
1012
}

0 commit comments

Comments
 (0)