gaurishhs / elysia-ip

Get Client IP Address in Elysia
MIT License
53 stars 10 forks source link

Error: Property 'ip' does not exist on type on 0.0.7 #8

Closed ReesMorris closed 8 months ago

ReesMorris commented 8 months ago

Hi! I'm running into an issue while following the basic implementation guide from the docs:

import { Elysia } from "elysia";
import { ip } from "elysia-ip";

new Elysia().use(ip()).get("/", ({ ip }) => ip).listen(3000);

On version ^0.0.7, TypeScript throws a Property 'ip' does not exist on type error for the { ip } reference.

This error disappears when I downgrade to version ^0.0.6, where ip is correctly typed as string | SocketAddress | null | undefined

My environment is using the latest Bun version (v1.0.27), with all other dependencies up to date, including TypeScript (^5.3.3) and Elysia (^0.8.17 or latest).

I have attached screenshots to illustrate the issue (0.0.7 left, and 0.0.6 right), but please let me know if there are any issues accessing them or if further details are required.

SCR-20240219-ucfy SCR-20240219-uckv
gaurishhs commented 8 months ago

This was covered in #5 I don't really know what could cause the issue now. Previous implementation did work for some and doesn't for some. There must be some sort of incompatibility. I'd suggest if 0.0.6 works stay on that.

ReesMorris commented 8 months ago

Sure, its definitely a weird one. Thanks anyway!