Skip to content

chore: Potential fix for code scanning alert no. 24: Property access on null or undefined - #24

Open
developerEhsan wants to merge 2 commits into
masterfrom
alert-autofix-24
Open

chore: Potential fix for code scanning alert no. 24: Property access on null or undefined#24
developerEhsan wants to merge 2 commits into
masterfrom
alert-autofix-24

Conversation

@developerEhsan

Copy link
Copy Markdown
Owner

Potential fix for https://github.com/developerEhsan/api-client/security/code-scanning/24

To fix this without changing functionality, replace the runtime-initialized ctx (undefined as unknown as ModuleContext) with a type-only declared variable. In TypeScript, declare const ctx: ModuleContext; provides the type for compile-time checks but emits no runtime value initialization, which avoids creating an always-undefined base expression while preserving all existing type assertions and @ts-expect-error checks.

Edit in packages/core/src/factory/request-events.test-d.ts:

  • In the it('ctx.request enforces path params at the call site', ...) block, replace:
    • const ctx = undefined as unknown as ModuleContext;
  • With:
    • declare const ctx: ModuleContext;

No new imports, helper methods, or dependencies are required.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

… or undefined

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@vercel
vercel Bot temporarily deployed to Preview – api-client-react-vite July 30, 2026 14:02 Inactive
@vercel

vercel Bot commented Jul 30, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
api-client-nextjs Ready Ready Preview Aug 14, 2026 3:56pm
api-client-react-vite Ready Ready Preview Aug 14, 2026 3:56pm

@vercel
vercel Bot temporarily deployed to Preview – api-client-nextjs July 30, 2026 14:02 Inactive
@developerEhsan
developerEhsan marked this pull request as ready for review July 30, 2026 14:04
@developerEhsan developerEhsan changed the title Potential fix for code scanning alert no. 24: Property access on null or undefined chore: Potential fix for code scanning alert no. 24: Property access on null or undefined Aug 14, 2026
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