浏览代码

type checking

Shaun 2 年之前
父节点
当前提交
81f877c088
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      src/router.js

+ 2 - 0
src/router.js

@@ -24,6 +24,7 @@ export class Router {
   }
 
   is (target, ...routes) {
+    console.assert(target instanceof RouterURL)
     for (const route of routes) {
       const pattern = this.#patterns[route] ?? this.#cache[route] ?? URLPattern.build(route)
       this.#cache[route] = pattern
@@ -35,6 +36,7 @@ export class Router {
   }
 
   not (target, ...routes) {
+    console.assert(target instanceof RouterURL)
     for (const route of routes) {
       const pattern = this.#patterns[route] ?? this.#cache[route] ?? URLPattern.build(route)
       this.#cache[route] = pattern