Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix assignment of subtypes (#7) #42

Merged

Conversation

Gvozd
Copy link
Contributor

@Gvozd Gvozd commented Dec 7, 2024

There is also an alternative solution - not to introduce a new interface.
Then need to change all the equal declarations from a property to a method, but it doesn't look elegant.
equal(...args: Parameters<ValueEqualityFn<T>>): ReturnType<ValueEqualityFn<T>>;

@NullVoxPopuli NullVoxPopuli added the bug Something isn't working label Dec 10, 2024
@NullVoxPopuli
Copy link
Contributor

is there a test that would fail before this change?

@Gvozd
Copy link
Contributor Author

Gvozd commented Dec 21, 2024

yes, the tests added in this commit fail without these changes
these changes fix the issue #7

@@ -93,3 +93,19 @@ expectTypeOf<keyof Signal.subtle.Watcher & string>().toEqualTypeOf<
expectTypeOf(new Signal.State(0)).toEqualTypeOf<Signal.State<number>>();
expectTypeOf(new Signal.State(0).get()).toEqualTypeOf<number>();
expectTypeOf(new Signal.State(0).set(1)).toEqualTypeOf<void>();

/**
* Assigning subtypes works
Copy link
Contributor

Choose a reason for hiding this comment

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

thanks for adding these tests!

@NullVoxPopuli NullVoxPopuli merged commit b8ee846 into proposal-signals:main Jan 17, 2025
5 checks passed
@github-actions github-actions bot mentioned this pull request Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants