mirror of
https://github.com/HeyPuter/puter.git
synced 2026-05-04 00:20:45 +00:00
devex: add some types for extension intellisense
This commit is contained in:
committed by
KernelDeimos
parent
dde652fb27
commit
1358e98c5b
Vendored
+40
@@ -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 {};
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2020",
|
||||
"module": "CommonJS",
|
||||
"moduleResolution": "node",
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"../src/*": ["../src/*"]
|
||||
},
|
||||
"allowJs": true,
|
||||
"checkJs": true
|
||||
},
|
||||
"include": [
|
||||
"**/*.js",
|
||||
"**/*.d.ts"
|
||||
]
|
||||
}
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user