diff --git a/types/req-real-ip/.npmignore b/types/req-real-ip/.npmignore new file mode 100644 index 00000000000000..680c524577719f --- /dev/null +++ b/types/req-real-ip/.npmignore @@ -0,0 +1,5 @@ +* +!**/*.d.ts +!**/*.d.cts +!**/*.d.mts +!**/*.d.*.ts \ No newline at end of file diff --git a/types/req-real-ip/index.d.ts b/types/req-real-ip/index.d.ts new file mode 100644 index 00000000000000..9c24db89c52e5d --- /dev/null +++ b/types/req-real-ip/index.d.ts @@ -0,0 +1,12 @@ +/// +import type { IncomingMessage } from "node:http"; + +export function detect({ + req, + config, +}: { + req: IncomingMessage; + config: { + cloudflare?: boolean; + }; +}): string | null; diff --git a/types/req-real-ip/package.json b/types/req-real-ip/package.json new file mode 100644 index 00000000000000..a77ba50c243c03 --- /dev/null +++ b/types/req-real-ip/package.json @@ -0,0 +1,20 @@ +{ + "private": true, + "name": "@types/req-real-ip", + "version": "1.0.9999", + "projects": [ + "https://github.com/zfcsoftware/real-ip" + ], + "dependencies": { + "@types/node": "*" + }, + "devDependencies": { + "@types/req-real-ip": "workspace:." + }, + "owners": [ + { + "name": "LacheRo`", + "githubUsername": "lacherogwu" + } + ] +} diff --git a/types/req-real-ip/req-real-ip-tests.ts b/types/req-real-ip/req-real-ip-tests.ts new file mode 100644 index 00000000000000..82955ee5a18c67 --- /dev/null +++ b/types/req-real-ip/req-real-ip-tests.ts @@ -0,0 +1,5 @@ +import type { IncomingMessage } from "node:http"; +import realip = require("req-real-ip"); + +const req = {} as IncomingMessage; +realip.detect({ req, config: { cloudflare: true } }); // $ExpectType string | null diff --git a/types/req-real-ip/tsconfig.json b/types/req-real-ip/tsconfig.json new file mode 100644 index 00000000000000..492d7bde0bc1cd --- /dev/null +++ b/types/req-real-ip/tsconfig.json @@ -0,0 +1,14 @@ +{ + "compilerOptions": { + "module": "CommonJS", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": ["index.d.ts", "req-real-ip-tests.ts"] +}