有谁能告诉我如何正确地做到这一点?
import {Router} from 'express';
import assert from 'assert'
let routerInstance = new Router();
assert(routerInstance instanceof Router); // this is throwing an error
感谢您的帮助!
答案 0 :(得分:2)
With a little experiment, I did this instead:
Object.getPrototypeOf(routerInstance) == express.Router; //this returns true