Skip to content

Conversation

@ghost
Copy link

@ghost ghost commented Jun 19, 2017

  • Prefer mapDefined instead of filter(map())
  • No need for mutable variables if only assigned to once
  • Use a set instead of deduplicate
  • Directly add to inferredtypings instead of adding to an array, then merging the array in
  • Don't map over an array multiple times, just use a for loop

@ghost ghost requested a review from jramsay June 19, 2017 22:07
@ghost ghost mentioned this pull request Jun 20, 2017
}
searchDirs = deduplicate(possibleSearchDirs);
for (const searchDir of searchDirs) {
possibleSearchDirs.set(projectRootPath, true);
Copy link
Member

@jramsay jramsay Jun 23, 2017

Choose a reason for hiding this comment

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

do we need a null/undefined check for projectRootPath before it is added to the list of possibleSearchDirs?

Copy link
Author

Choose a reason for hiding this comment

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

It doesn't look like that's ever passed in as undefined?

Copy link
Member

Choose a reason for hiding this comment

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

At one point I believe there were scenarios where this could be undefined in VS (ex: websites, open folder). Not sure if this is still the case though.

Copy link
Author

Choose a reason for hiding this comment

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

Maybe we should add an assert?

@ghost ghost merged commit fd22a88 into master Jun 23, 2017
@ghost ghost deleted the jsTyping branch June 23, 2017 17:03
GulajavaMinistudio added a commit to GulajavaMinistudio/TypeScript that referenced this pull request Jun 23, 2017
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
This pull request was closed.
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