Skip to content

Conversation

@lavoiesl
Copy link
Contributor

@lavoiesl lavoiesl commented Dec 1, 2025

Copilot finished reviewing on behalf of lavoiesl December 1, 2025 15:18
Copy link
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 pull request enhances the once utility function by adding TypeScript generic support for return types, improving type inference when wrapping functions. The changes enable better type safety and developer experience by allowing TypeScript to infer the return type of the wrapped function.

Key Changes

  • Added generic type parameter R to capture and preserve the return type of wrapped functions
  • Changed the memoization flag from setting fn = () => {} to fn = null to enable garbage collection of the original function reference
  • Added comprehensive test coverage for different function signatures (with arguments, void functions, and typed functions)

Reviewed changes

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

File Description
packages/atomic/src/utils/utils.ts Updated once function signature with generic return type parameter and changed memoization implementation to null out function reference for garbage collection
packages/atomic/src/utils/utils.spec.ts Added four new test cases covering argument handling, memoization behavior, void functions, and type inference

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI commented Dec 1, 2025

@lavoiesl I've opened a new pull request, #6685, to work on those changes. Once the pull request is ready, I'll request review from you.

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: lavoiesl <1216046+lavoiesl@users.noreply.github.com>
Merged via the queue into main with commit e986e72 Dec 1, 2025
92 of 93 checks passed
@lavoiesl lavoiesl deleted the seb-KIT-5270-once branch December 1, 2025 16:18
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