Skip to content

feat: Generate types declaration file#71

Merged
jallamsetty1 merged 2 commits intomasterfrom
add-ts-types
Jun 12, 2025
Merged

feat: Generate types declaration file#71
jallamsetty1 merged 2 commits intomasterfrom
add-ts-types

Conversation

@jallamsetty1
Copy link
Member

So that it can be imported in packages that use js-utils for type infomation.

@jallamsetty1 jallamsetty1 requested a review from Copilot June 5, 2025 16:04
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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,

@jallamsetty1 jallamsetty1 requested a review from saghul June 5, 2025 17:22
@saghul
Copy link
Member

saghul commented Jun 5, 2025

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)

@jallamsetty1 jallamsetty1 merged commit 258ad2d into master Jun 12, 2025
1 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants