Migrate project from typing_practiceweb
This commit is contained in:
26
server/global.d.ts
vendored
Normal file
26
server/global.d.ts
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
import { Request, Response, NextFunction } from 'express';
|
||||
|
||||
declare global {
|
||||
namespace Express {
|
||||
interface Request {
|
||||
user: {
|
||||
_id: string;
|
||||
username: string;
|
||||
fullname?: string;
|
||||
isAdmin?: boolean;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 解决TypeScript类型错误
|
||||
declare module 'express-serve-static-core' {
|
||||
interface Router {
|
||||
get: any;
|
||||
post: any;
|
||||
put: any;
|
||||
delete: any;
|
||||
}
|
||||
}
|
||||
|
||||
export {};
|
||||
Reference in New Issue
Block a user