feat(types): add LiteralUnion type and refactor union types - #128
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the type definitions within the project by introducing and applying a Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces the LiteralUnion utility type to improve autocompletion for string literal union types throughout the codebase. The refactoring is applied consistently to configuration options like allowedHosts, webSocketServer, Host, Port, and others, enhancing developer experience without changing runtime behavior. The implementation is clean and follows TypeScript best practices for this pattern. The change to README.md also correctly updates a link to point to a specific section. Overall, the changes are solid and beneficial.
There was a problem hiding this comment.
Pull request overview
Introduces a reusable LiteralUnion helper type to improve IntelliSense/type-safety for string literal unions (while still allowing arbitrary strings), and applies it across the dev-server public types.
Changes:
- Add
LiteralUniontype helper insrc/types.ts. - Refactor several string-literal-or-string unions (
Host,Port,ServerType, websocket/client transports,allowedHosts) to useLiteralUnion. - Update the README link for the v1.x usage guide anchor.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/types.ts |
Adds LiteralUnion and refactors multiple exported type unions to use it. |
src/server.ts |
Updates the exported Configuration interface to use LiteralUnion for allowedHosts and websocket configuration types. |
README.md |
Fixes/updates the v1.x README link to a more specific anchor. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Use
LiteralUniontype to simplify and standardize string literal unions with fallback to string type. This improves type safety and maintainability while following TypeScript best practices.