Skip to content

Conversation

@divdavem
Copy link
Contributor

@divdavem divdavem commented Feb 26, 2025

Hello,

I am opening this PR to suggest making Angular signals interoperable with other signal libraries by implementing what I suggested in this ticket of the TC39 signals proposal.

This PR contains an implementation of my suggestion. This is a work in progress. As mentioned in the above ticket, it would be good to receive feedback from different signal libraries authors, so this PR may evolve as feedback is received.

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.dev application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

The following tests (and many similar tests) currently fail:

import { computed as tansuComputed, writable as tansuSignal } from '@amadeus-it-group/tansu';
import { computed as angularComputed, signal as angularSignal } from '@angular/core';
import { expect, it } from 'vitest';

it('should be interoperable from tansu to angular', () => {
  const a = tansuSignal(0);
  const c = angularComputed(() => a() * 2);
  expect(c()).toEqual(0);
  a.set(1);
  expect(c()).toEqual(2);
});

it('should be interoperable from angular to tansu', () => {
  const a = angularSignal(0);
  const c = tansuComputed(() => a() * 2);
  expect(c()).toEqual(0);
  a.set(1);
  expect(c()).toEqual(2);
});

It is also related to #50189

What is the new behavior?

The above tests succeed.

Does this PR introduce a breaking change?

  • Yes
  • No

This PR can break code that directly depends on @angular/core/primitives/signals because of changes in the data types.

Other information

Note that the content of the interop_lib.ts file in this PR is directly copied from this ticket as a temporary solution. It should ideally come from an independent npm package that provides the interoperability layer.

@gemini-code-assist
Copy link

Important

The terms of service for this installation has not been accepted. Please ask the Organization owners to visit the Gemini Code Assist Admin Console to sign it.

@angular-robot angular-robot bot added detected: feature PR contains a feature commit area: core Issues related to the framework runtime labels Feb 26, 2025
@ngbot ngbot bot added this to the Backlog milestone Feb 26, 2025
@divdavem divdavem force-pushed the interopSignal branch 8 times, most recently from b32d800 to a8dc6a9 Compare March 7, 2025 10:53
@thePunderWoman
Copy link
Contributor

@divdavem We appreciate the effort here, but at the moment things are moving too quickly with signals to worry about interop. Once we see signals move further along and as our internal signals development work slows, we can worry about interop at that time. Thank you for your contribution though! We appreciate you!

@divdavem
Copy link
Contributor Author

divdavem commented Jun 5, 2025

@thePunderWoman Thank you for your answer
I am happy to finally see someone commenting on my PR, even though I am disappointed that it is only to (kindly) close it.
I was not necessarily expecting to have my PR merged soon, but I mostly opened this PR to have some feedback from the Angular team regarding my suggested interop specification. I understand that the Angular team is busy.

Note that the code I implemented in this PR no longer reflects my latest interop specification. (I updated it following some feedback given by another signal library author during a TC 39 Signal Community meeting).
I am happy to open another PR on Angular to implement my latest interop specification when I have time (and if there is some interest from the Angular team/community).

@thePunderWoman
Copy link
Contributor

@divdavem Thanks! I don't think we're ready for it yet. So maybe you can ping us a bit down the road and we can let you know if the timing is right.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jul 6, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area: core Issues related to the framework runtime detected: feature PR contains a feature commit

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants