devex: add some types for extension intellisense

This commit is contained in:
KernelDeimos
2025-09-23 18:25:55 -04:00
committed by KernelDeimos
parent dde652fb27
commit 1358e98c5b
3 changed files with 77 additions and 0 deletions
+40
View File
@@ -0,0 +1,40 @@
import type { RequestHandler } from 'express';
declare global {
namespace Express {
interface Request {
actor: any; // TODO
}
}
}
type EndpointOptions = {
allowedMethods?: string[]
subdomain?: string
noauth?: boolean
}
type HttpMethod = 'get' | 'post' | 'put' | 'delete' | 'patch';
type AddRouteFunction = (path: string, options: EndpointOptions, handler: RequestHandler) => void
type RouterMethods = {
[K in HttpMethod]: {
(path: string, options: EndpointOptions, handler: RequestHandler): void;
(path: string, handler: RequestHandler, options?: EndpointOptions): void;
};
}
interface Extension extends RouterMethods {
// import(module: 'core'): {
// UserActorType: typeof UserActorType;
// };
import(module: string): any;
}
declare global {
// Declare the extension variable
const extension: Extension;
}
export {};
+17
View File
@@ -0,0 +1,17 @@
{
"compilerOptions": {
"target": "ES2020",
"module": "CommonJS",
"moduleResolution": "node",
"baseUrl": ".",
"paths": {
"../src/*": ["../src/*"]
},
"allowJs": true,
"checkJs": true
},
"include": [
"**/*.js",
"**/*.d.ts"
]
}
+20
View File
@@ -0,0 +1,20 @@
{
"compilerOptions": {
"target": "ES2020",
"module": "CommonJS",
"moduleResolution": "node",
"baseUrl": ".",
"paths": {
"../src/*": ["../src/*"]
},
"typeRoots": ["../node_modules/@types"],
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true
},
"include": [
"**/*.ts",
"**/*.js",
"*.d.ts"
]
}