Skip to content

Rename useResource() to createResource() in ShadowObjectParams API#4

Merged
spearwolf merged 3 commits into
mainfrom
copilot/rename-api-function-use-resource
Nov 27, 2025
Merged

Rename useResource() to createResource() in ShadowObjectParams API#4
spearwolf merged 3 commits into
mainfrom
copilot/rename-api-function-use-resource

Conversation

Copilot AI commented Nov 27, 2025

Copy link
Copy Markdown
Contributor

Renames useResource() to createResource() in the ShadowObjectParams interface for API consistency.

Changes

  • Interface & Implementation: Updated types.ts and Kernel.ts
  • Tests: Updated Kernel.spec.ts test suite
  • Documentation: Updated README.md API table
  • Changelog: Added entry in [Unreleased] section documenting the rename

Usage

function MyShadowObject({ createResource }: ShadowObjectParams) {
  const resource = createResource(
    () => new SomeExternalResource(),
    (res) => res.dispose()
  );
}
Original prompt

Rename the API function useResource() from the ShadowObjectParams interface to createResource(). Adjust the tests, documentation, and CHANGLOG accordingly.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: spearwolf <12805+spearwolf@users.noreply.github.com>
Copilot AI changed the title [WIP] Rename useResource API function to createResource Rename useResource() to createResource() in ShadowObjectParams API Nov 27, 2025
Copilot AI requested a review from spearwolf November 27, 2025 14:40
Comment thread packages/shadow-objects/CHANGELOG.md Outdated
- enhance the shadow-objects creation api _aka_ `ShadowObjectParams`
- added the `useProperties()` function
- added the `useResource()` function
- added the `createResource()` function

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

@copilot do not change useResource here in this line

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reverted line 16 to useResource() in commit a7997d9. The 0.23.0 section now correctly shows the original function name, while the [Unreleased] section documents the rename.

Co-authored-by: spearwolf <12805+spearwolf@users.noreply.github.com>
@spearwolf
spearwolf marked this pull request as ready for review November 27, 2025 14:48
Copilot AI requested a review from spearwolf November 27, 2025 14:49
@spearwolf
spearwolf merged commit 9a177f6 into main Nov 27, 2025
@spearwolf
spearwolf deleted the copilot/rename-api-function-use-resource branch November 27, 2025 14:49
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.

2 participants