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(defer): restrict allowed factory types #4835

Merged
merged 3 commits into from
Jun 6, 2019

Conversation

cartant
Copy link
Collaborator

@cartant cartant commented Jun 5, 2019

Description:

This PR fixes a problem with the defer type signatures that was introduced in #4810 - the PR that ensured that Observable<never> was inferred for factory functions that return void.

The problem was that () => void will match functions returning any value - as the return value is ignored - which meant that factories could return anything - e.g. a number.

See the discussion on this commit.

The PR includes a failing dtslint test that is fixed by the change.

Related issue (if exists): #4804 #4810

cartant referenced this pull request Jun 5, 2019
* test(defer): add failing dtslint test

* fix(defer): use overload sig for void factory

Closes #4804
@cartant cartant requested a review from benlesh June 5, 2019 10:21
Copy link
Member

@benlesh benlesh left a comment

Choose a reason for hiding this comment

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

Doesn't look like we have a test for the conditional "maybe void" case.

@cartant
Copy link
Collaborator Author

cartant commented Jun 5, 2019

Added the missing test.

@benlesh benlesh merged commit cb52c1b into ReactiveX:master Jun 6, 2019
benlesh pushed a commit that referenced this pull request Jun 6, 2019
* test(defer): add failing dtslint test

* fix(defer): restrict allowed factory types

* test(defer): add a sometimes-returns dtslint test
@lock lock bot locked as resolved and limited conversation to collaborators Jul 7, 2019
@cartant cartant deleted the issue-4804-part-2 branch September 24, 2020 07:08
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants