Skip to content

Commit

Permalink
🤖 Merge PR DefinitelyTyped#70756 feat: req-real-ip by @lacherogwu
Browse files Browse the repository at this point in the history
  • Loading branch information
lacherogwu authored Oct 8, 2024
1 parent cbdef00 commit 0d19896
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 0 deletions.
5 changes: 5 additions & 0 deletions types/req-real-ip/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*
!**/*.d.ts
!**/*.d.cts
!**/*.d.mts
!**/*.d.*.ts
12 changes: 12 additions & 0 deletions types/req-real-ip/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/// <reference types="node" />
import type { IncomingMessage } from "node:http";

export function detect({
req,
config,
}: {
req: IncomingMessage;
config: {
cloudflare?: boolean;
};
}): string | null;
20 changes: 20 additions & 0 deletions types/req-real-ip/package.json
Original file line number Diff line number Diff line change
@@ -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"
}
]
}
5 changes: 5 additions & 0 deletions types/req-real-ip/req-real-ip-tests.ts
Original file line number Diff line number Diff line change
@@ -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
14 changes: 14 additions & 0 deletions types/req-real-ip/tsconfig.json
Original file line number Diff line number Diff line change
@@ -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"]
}

0 comments on commit 0d19896

Please sign in to comment.