Skip to content

feat: add explicit type annotations to utils namespace#67

Merged
JosunLP merged 4 commits intodevelopmentfrom
copilot/add-type-annotations-to-utils
Mar 24, 2026
Merged

feat: add explicit type annotations to utils namespace#67
JosunLP merged 4 commits intodevelopmentfrom
copilot/add-type-annotations-to-utils

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 24, 2026

The utils namespace object and isDev constant relied on TypeScript inference rather than having explicit type annotations, inconsistent with the project's strict typing conventions.

Changes

  • BQueryUtils interface (src/core/utils/index.ts): Defines the full public shape of the utils namespace — 39 members, all readonly, organized by category
  • utils const typed as BQueryUtils instead of inferred
  • BQueryUtils function members: debounce, throttle, and once now reuse typeof the exported implementations to avoid signature drift
  • isDev (src/store/utils.ts): Added explicit : boolean annotation
  • Exports: BQueryUtils re-exported from src/core/index.ts and src/full.ts
  • Test: Compile-time verification that utils is assignable to BQueryUtils

Usage

import { utils } from '@bquery/bquery/core';
import type { BQueryUtils } from '@bquery/bquery/core';

// Consumers can now reference the interface directly
const myUtils: BQueryUtils = utils;

Note: When adding new utility functions to the utils namespace, the BQueryUtils interface must also be updated.


📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.

@github-actions github-actions bot added core Changes to the core module store Changes to the store module tests Chenges to the tests labels Mar 24, 2026
@JosunLP JosunLP marked this pull request as ready for review March 24, 2026 14:38
Copilot AI review requested due to automatic review settings March 24, 2026 14:38
Copy link
Copy Markdown
Contributor

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 formalizes the public typing surface of the core/utils aggregated utils namespace by introducing a BQueryUtils interface and explicitly typing utils (plus a small explicit type annotation for isDev), making the API shape more stable and easier to reference for consumers.

Changes:

  • Add BQueryUtils interface and type the utils namespace as BQueryUtils.
  • Re-export BQueryUtils from core and full entry points.
  • Add a test block intended to validate the utils/BQueryUtils relationship.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/utils.test.ts Adds a new test section intended to validate utils against BQueryUtils.
src/store/utils.ts Adds an explicit : boolean annotation to isDev.
src/full.ts Re-exports BQueryUtils as a type from the full bundle entry point.
src/core/utils/index.ts Introduces BQueryUtils and types the aggregated utils object explicitly.
src/core/index.ts Re-exports BQueryUtils from the core entry point.

@JosunLP
Copy link
Copy Markdown
Collaborator

JosunLP commented Mar 24, 2026

@copilot apply changes based on the comments in this thread

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 24, 2026

@copilot apply changes based on the comments in this thread

Applied the review-thread follow-up in 0518a1d: BQueryUtils now uses typeof debounce / typeof throttle / typeof once, and the test was reduced to the compile-time assignability check plus a minimal runtime assertion. Full validation is clean (bun test, bun run build, bun run lint, bun run lint:types, bun run test:types).

Copy link
Copy Markdown
Contributor

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

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

@JosunLP
Copy link
Copy Markdown
Collaborator

JosunLP commented Mar 24, 2026

@copilot apply changes based on the comments in this thread

Co-authored-by: JosunLP <20913954+JosunLP@users.noreply.github.com>
Agent-Logs-Url: https://github.com/bQuery/bQuery/sessions/77dfff22-3e29-4c54-803e-aefe93d16faf
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 24, 2026

@copilot apply changes based on the comments in this thread

Applied in b8def16. The BQueryUtils test is now compile-time-only and no longer includes the misleading runtime assertion. Validation is clean with bun test tests/utils.test.ts, bun run lint, bun run lint:types, and bun run test:types. No UI changes in this update.

Copy link
Copy Markdown
Contributor

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

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

@JosunLP
Copy link
Copy Markdown
Collaborator

JosunLP commented Mar 24, 2026

@copilot apply changes based on the comments in this thread

Co-authored-by: JosunLP <20913954+JosunLP@users.noreply.github.com>
Agent-Logs-Url: https://github.com/bQuery/bQuery/sessions/2962e271-d2ad-49f2-bb15-2b9570e94543
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 24, 2026

@copilot apply changes based on the comments in this thread

Applied in 94968bd. The BQueryUtils test now explicitly reads as a compile-time guard and includes a minimal expect(utils).toBeDefined() runtime sanity check so it isn’t vacuous under bun test. I also revalidated with bun test tests/utils.test.ts, bun run lint, bun run lint:types, and bun run test:types. The implemented interface surface remains 39 members. No UI changes in this update.

Copy link
Copy Markdown
Contributor

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

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

@JosunLP JosunLP merged commit 6fccd42 into development Mar 24, 2026
14 checks passed
@JosunLP JosunLP deleted the copilot/add-type-annotations-to-utils branch March 24, 2026 15:11
JosunLP added a commit that referenced this pull request Mar 27, 2026
Co-authored-by: JosunLP <20913954+JosunLP@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Changes to the core module store Changes to the store module tests Chenges to the tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants