Open jordanburke opened 2 days ago
Thanks for reporting this finding!
I can't reproduce it on my end. Please use import type { Logger } from "@bogeychan/elysia-logger/types";
instead of importing from the dist
folder.
I'm aware there's a bug with https://github.com/elysiajs/elysia/issues/838 at the moment, but I don't want to break backward compatibility just to fix a type issue I can't reproduce.
tsconfig.json
skips all kind of library checks. I didn't run into any issues using the bun init -y
's confignode_modules/
, bun.lockb
and cache (located at bun pm cache
) firstCan you provide me some code snipped please? Like how do you use the imported Logger
?
Thanks for checking it out! Yeah it's around that - I think I found the issue. I noticed at some point my IDE pulled in:
import { logger } from "@bogeychan/elysia-logger"
as the import instead of
import { logger } from "@bogeychan/elysia-logger/dist"
The former import @bogeychan/elysia-logger is hitting this in the package file types as defined here.
"types": "./src/index.ts",
Not sure what the current standard package solution is here. It looks like the raw types in @bogeychan/elysia-logger are causing my tsc to bomb out even with "skipLibCheck": true on, whereas the tsc compiled /dist types are not. I think because it's looking at the raw index.ts instead of a type file. For now I'll use this import.
import { logger } from "@bogeychan/elysia-logger/dist"
I think if the package changes to a "types": "./dist/index.d.ts",
or similar on the top level types (not the export one) - it could potentially fix it as well. I'll give it try later and post back if I get a chance.
Hope that helps - functionally-wise it works great though.
Just published a new version 0.1.3
fixing this types
entry. Can you give it a try?
What versions are running?
"dependencies": { "@bogeychan/elysia-logger": "^0.1.2", "@elysiajs/swagger": "^1.1.1", "elysia": "1.1.16", "pino-pretty": "^11.2.2", }, "devDependencies": { "@typescript-eslint/eslint-plugin": "^8.7.0", "eslint": "^8.37.0", "bun-types": "latest", "prettier": "^3.3.3", "typescript": "^5.6.2" },
What steps can reproduce the bug?
Import and use a type def using Elysia 1.1.6:
import { Logger } from "@bogeychan/elysia-logger/dist/types"
then run:
tsc --noEmit
Also was able to reproduce this in the elysia-logger by upgrading to 1.1.6
What is the expected behavior?
Process finished with exit code 0
What do you see instead?
node_modules/@bogeychan/elysia-logger/src/index.ts:128:13 - error TS2339: Property 'store' does not exist on type 'never'.
128 ctx.store.startTime ??= 0;
node_modules/@bogeychan/elysia-logger/src/index.ts:130:13 - error TS2339: Property 'store' does not exist on type 'never'.
130 ctx.store.responseTime = ctx.store.endTime - ctx.store.startTime;
node_modules/@bogeychan/elysia-logger/src/index.ts:130:58 - error TS2339: Property 'store' does not exist on type 'never'.
130 ctx.store.responseTime = ctx.store.endTime - ctx.store.startTime;