Use the currentDirectory of the project as projectRootPath in the typings request#21107
Merged
Conversation
…ct root path This ensures that we arent picking typings from folder different from the current directory for the project
mhegazy
approved these changes
Jan 10, 2018
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Instead of using custom logic for getting projectRoot for typings request, use the current directory for the project. Earlier for inferred projects the projectRootPath to typings request was "" which meant to use the directory returned by sys.getCurrentDirectory was used. So if there was package json and node modules present in that directory, the typings were picked up from those and returned as relative path (because projectRootPath was not absolute path) resulting in discrepancy between what typings returned and what project could use. Using current directory of the project ensures that projectRoot sent to the typings request is never empty string and always absolute path and also guarantees the correctness of location to look for typings.
Fixes #21040 and #20964