Skip to content

fix(lib): remove unused ts-expect-error for clean Next.js build - #63

Merged
JOY (JOY) merged 1 commit into
mainfrom
dev
Sep 3, 2026
Merged

fix(lib): remove unused ts-expect-error for clean Next.js build#63
JOY (JOY) merged 1 commit into
mainfrom
dev

Conversation

@JOY

@JOY JOY (JOY) commented Sep 3, 2026

Copy link
Copy Markdown

Summary

  • Removed unused ts-expect-error in useRouterQuery.ts for native ES2024 entries iteration.
  • Verified yarn workspace @calcom/web build compiles and typechecks with zero errors.

Test plan

  • Yarn turbo type-check: 114/114 packages passed
  • Yarn workspace @calcom/web build passed with code 0

Note

Low Risk
Comment and type-suppression cleanup only; no runtime or query-parsing behavior change.

Overview
Removes a stale @ts-expect-error and related comment above the for...of loop in fromEntriesWithDuplicateKeys inside useRouterQuery.ts.

With the current TypeScript target (e.g. ES2022 in @calcom/lib), iterating searchParams.entries() no longer needs a suppression, so the directive was unused and could break strict builds that flag unnecessary @ts-expect-error comments.

Reviewed by Cursor Bugbot for commit 348bb56. Configure here.

@coderabbitai

coderabbitai Bot commented Sep 3, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: f8bf4c79-9e99-4e50-927c-7e0c921be1b5

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Comment @coderabbitai help to get the list of available commands.

@cursor

cursor Bot commented Sep 3, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_56f30650-fcb7-4439-8d8f-667ca6ccbcee)

@JOY
JOY (JOY) merged commit e574f5a into main Sep 3, 2026
30 of 31 checks passed

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request removes obsolete comments and a TypeScript ignore directive from the useRouterQuery.ts file. The review feedback highlights a potential prototype pollution vulnerability and runtime error caused by calling result.hasOwnProperty(key) directly, recommending the use of Object.hasOwn instead, and points out that this utility function is duplicated in another file.

// Consider setting atleast ES2015 as target
// @ts-expect-error
for (const [key, value] of entries) {
if (result.hasOwnProperty(key)) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

security-high high

Using result.hasOwnProperty(key) directly on an object can lead to runtime errors or unexpected behavior if the query parameters contain keys that match prototype properties (e.g., hasOwnProperty, toString). For example, if a query parameter is hasOwnProperty=123, result.hasOwnProperty will be overwritten, and subsequent calls to result.hasOwnProperty(key) will throw a TypeError: result.hasOwnProperty is not a function, crashing the application.

To prevent this, use Object.hasOwn(result, key) (or Object.prototype.hasOwnProperty.call(result, key)).

Additionally, please note that this function is duplicated in packages/lib/fromEntriesWithDuplicateKeys.ts. You should apply the same fix there, or ideally, refactor the code to import fromEntriesWithDuplicateKeys from a single shared location to avoid duplication.

Suggested change
if (result.hasOwnProperty(key)) {
if (Object.hasOwn(result, key)) {

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.

1 participant