-
-
Notifications
You must be signed in to change notification settings - Fork 2
refactor(server): Introduce base class and add runtime types #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
* feat: Improve type safety and remove @ts-ignore - Installed `@types/open` and `@types/node` to provide type definitions for dependencies. - Updated `tsconfig.json` to include `deno` and `node` types, making globals for these runtimes available to TypeScript. - Refactored `src/server.ts` to use specific types instead of `any`, including `Bun.Server`, `http.Server`, and `http.IncomingMessage`. - Removed all `@ts-ignore` comments from `src/server.ts`. * Fix the rest of the TS issues and types for deno --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: 7heMech <[email protected]>
|
I also
|
|
Hey @7heMech! 👋 I just noticed this PR after pushing #2 Let me review with a bit of help from Claude. First off, thank you so much for taking the time to contribute to this project! I really appreciate your thoughtful improvements to the codebase. Your PR shows a deep understanding of the code structure and brings some excellent modernization ideas. Let me share my detailed review of the changes. ✅ What I Love About This PR1. Base Class Architecture 🏗️The introduction of 2. Modern Promise Patterns with Promise.race() ⚡Your replacement of the manual timeout handling with
3. Improved Resource Management 🧹The 4. Better Error Handling for Multiple Listeners 🛡️The check for existing listeners on the same path prevents potential conflicts and provides clear error messages. This is a thoughtful addition that improves the developer experience. 🔍 Areas That Need Attention1. TypeScript Type Definitions IssueWhile adding type packages ( Critical issue with Node.js type imports:
Current state:
2. Type Safety Could Be StrongerWhile the base class reduces duplication, we're still using private server?: Bun.Server; // Instead of any3. Minor Implementation Details
📊 Test Results✅ All tests pass successfully (9/9 tests, 22 assertions) 🎯 Suggestions for Improvement
🚀 Overall AssessmentThis is a high-quality PR that brings meaningful improvements to the codebase! The architectural changes with the base class pattern and modernized Promise handling are exactly what this project needed. While there are some minor issues with the TypeScript types that need resolution, the core improvements are solid and valuable. The code is cleaner, more maintainable, and follows modern JavaScript/TypeScript best practices. Your attention to detail in areas like resource cleanup and error handling shows careful consideration of edge cases. |
|
Hey, I'm sorry, but Claude is just hallucinating. I'll address everything one by one, if you think I'm wrong on some (which I might) I'd be happy to learn.
bun run build runs fine for me, and I added it because the typescript language server was complaining about deno global, when I added it the issue was resolved.
These type imports don't make it into the final compiled code.
This is exactly what I did at line 213.
That's the cleaner layout for the core doesn't change how the app works.
I don't really think it does. |
|
@7heMech sounds good. Let me check if there is a way to resolve the merge conflict... |
|
This should do it, I'll test though |
|
Yeah, now you can squash and merge, tell me if you don't want the replit ide config I'll get rid of that, that's just what I code on. |
|
@7heMech having Replit config in place is convenient. |
|
@7heMech that was quick. Awesome! |
First of all awesome project, I love how it uses specific servers for each runtime, with this PR we make adding new ones even easier and improve type safety.
This PR mainly edits the server file does several things: