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

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 Jun 5, 2019
Copy link
Member

left a comment

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

@cartant

This comment has been minimized.

Copy link
Collaborator Author

commented Jun 5, 2019

Added the missing test.

@benlesh
benlesh approved these changes Jun 6, 2019
@benlesh
benlesh approved these changes Jun 6, 2019
@benlesh benlesh merged commit cb52c1b into ReactiveX:master Jun 6, 2019
5 checks passed
5 checks passed
ci/circleci: build Your tests passed on CircleCI!
Details
ci/circleci: dtslint Your tests passed on CircleCI!
Details
ci/circleci: lint Your tests passed on CircleCI!
Details
ci/circleci: test Your tests passed on CircleCI!
Details
ci/circleci: typescript3 Your tests passed on CircleCI!
Details
benlesh added 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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
2 participants
You can’t perform that action at this time.