Skip to content

Conversation

@trusktr
Copy link
Member

@trusktr trusktr commented Dec 31, 2025

feat: also improve and test additional inheritance scenarios, adding a new option parameter for @signal to disable default extension behavior, defaulting to true: @signal({ extend: false }). When extend is set to false, a subclass signal will override the parent class signal instead of re-using it, but that will cause any base class effects depending on the base class signal to no longer re-run when the subclass signal changes.

…private members

feat: also improve and test additional inheritance scenarios, adding a new option parameter for `@signal` to disable default extension behavior, defaulting to true: `@signal({ extend: false })`. When `extend` is set to `false`, a subclass signal will *override* the parent class signal instead of re-using it, but that will cause any base class effects depending on the base class signal to no longer re-run when the subclass signal changes.
Copilot AI review requested due to automatic review settings December 31, 2025 09:58
@trusktr trusktr merged commit 6807164 into main Dec 31, 2025
6 checks passed
@trusktr trusktr deleted the private-member-support branch December 31, 2025 10:00
Copy link

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 adds comprehensive support for JavaScript #private members with the @signal, @memo, and @effect decorators. It also introduces a new inheritance mechanism with an extend option for @signal that defaults to true, allowing subclasses to override signal initial values while keeping base class effects and memos operational.

Key changes include:

  • Private field detection and appropriate error handling for @signal on private fields
  • Full support for private getters/setters and auto accessors across all decorators
  • New SignalOptions interface with extend property for controlling inheritance behavior
  • Enhanced metadata structure with context tracking and signal reuse capabilities

Reviewed changes

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

Show a summary per file
File Description
src/signals/signalify.ts Adds Undefined symbol and optional initialVal parameter to support distinguishing undefined from unset values
src/decorators/types.ts Introduces MemberType (renamed from SignalOrMemoType), adds new metadata fields for signal reuse and private memo storage
src/decorators/signal.ts Major refactor with overloaded signatures, private member support, inheritance handling via extend option, and signal descriptor reuse logic
src/decorators/signal.test.ts Comprehensive test coverage for private members and inheritance scenarios
src/decorators/memo.ts Implements private member support for getters/setters, auto accessors, and methods using separate code paths
src/decorators/memo.test.ts Tests for private memo members across all supported kinds
src/decorators/effect.ts Updated to use new API signatures and support private members through context.access
src/decorators/effect.test.ts Extended tests for private method and auto accessor effects
src/_state.ts Refactored helper functions to accept MemberStat instead of individual parameters, adds untrack import
dist/* Generated distribution files reflecting all source changes

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


// CONTINUE writing not working yet for private method memos
// Uncomment when fixed
debugger
Copy link

Copilot AI Dec 31, 2025

Choose a reason for hiding this comment

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

There's a debugger statement left in test code that should be removed before merging.

Copilot uses AI. Check for mistakes.
Comment on lines +35 to +37
/**
*
*/
Copy link

Copilot AI Dec 31, 2025

Choose a reason for hiding this comment

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

The comment on line 36 is empty. Either add meaningful documentation or remove this empty JSDoc comment block.

Copilot uses AI. Check for mistakes.
memoFn.length === 0
? [createMemo(() => memoFn.call(self)), (() => {}) as Setter<any>]
: createWritableMemo(() => {
debugger
Copy link

Copilot AI Dec 31, 2025

Choose a reason for hiding this comment

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

There's a debugger statement left in the code. This should be removed before merging to production.

Copilot uses AI. Check for mistakes.
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