Skip to content

noop in setTypeAcquisiton for undefined #41291

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

Merged

Conversation

jessetrinity
Copy link
Contributor

#40952 mistakenly sets typeAcquisition to {} if it isn't explicitly set by the editor, disabling type acquisition in inferred projects. This reverts the changes made to removeLocalTypingsFromTypeAcquisition in that PR and noops in setTypeAcquisition when newTypeAcquisition is undefined.

Issue was caught in VS nightly integration tests.

@typescript-bot typescript-bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Oct 28, 2020
Copy link
Member

@sheetalkamat sheetalkamat left a comment

Choose a reason for hiding this comment

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

The change looks correct but i am surprised we dont have test. can you add one please so we dont regress this in future. Thanks

Copy link
Member

@minestarks minestarks left a comment

Choose a reason for hiding this comment

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

Looks good. +1 to adding test if possible

@minestarks
Copy link
Member

@DanielRosenwasser heads up - we want this for 4.1 RC, looks like it's almost ready to go. Thanks!

@jessetrinity
Copy link
Contributor Author

@sheetalkamat I've been looking at the tests for a while and I can't figure out what we should actually have as a regression test. Should there be a unit test for the compilerOptions/watchOptions/typeAcquisition setters to make sure they noop on undefined?

@jessetrinity
Copy link
Contributor Author

To clarify - inferred projects infer typeAcquisition when it is undefined, so my previous change caused the inference to never happen (the getter started returning {}). A minimal test would basically be:

project.setTypeAcquisition(undefined);
assert.isTrue(project.getTypeAcquisition().enable, true)

@sheetalkamat
Copy link
Member

assert.deepEqual(project.getTypeAcquisition(), expected) is what i think better test.

@jessetrinity jessetrinity merged commit b27d4bf into microsoft:master Oct 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For Uncommitted Bug PR for untriaged, rejected, closed or missing bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants