feat: Generate types declaration file#71
Merged
jallamsetty1 merged 2 commits intomasterfrom Jun 12, 2025
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a types declaration file by adding a TypeScript dependency, along with a minor update to the browser detection logic.
- Added TypeScript as a dependency in package.json to support generating declaration files.
- Updated BrowserDetection.ts to conditionally map the engine value using a ternary operator.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| package.json | Added TypeScript dependency and adjusted formatting. |
| browser-detection/BrowserDetection.ts | Changed engine mapping to handle falsy values. |
Comments suppressed due to low confidence (1)
browser-detection/BrowserDetection.ts:61
- Ensure that treating falsy engine values as undefined is the intended behavior, especially for cases where engine might be an empty string.
engine: engine ? ENGINES[engine] : undefined,
Member
|
Generally speaking we shouldn't commit the type declaration files. Since they are generated by tsc we should try to add a build step that runs tsc and use the result as the entry point, and put a "types" entry in package.json pointing to the generated types inside dist/. Take a look at how LJM does it (for the TS build, not the UMD one) |
damencho
approved these changes
Jun 12, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
So that it can be imported in packages that use js-utils for type infomation.