Skip to content

Conversation

@uniqueiniquity
Copy link
Contributor

Currently, if a previously installed ATA package is removed from the types-registry, we throw an exception when trying to determine whether to update it on typings install.

This PR fixes that issue by reporting the package as not cached, and then appropriately does not attempt to install it (due to it being missing from the registry).

@uniqueiniquity uniqueiniquity requested review from a user and RyanCavanaugh June 1, 2018 21:32
// Add the cached typing locations for inferred typings that are already installed
packageNameToTypingLocation.forEach((typing, name) => {
if (inferredTypings.has(name) && inferredTypings.get(name) === undefined && isTypingUpToDate(typing, typesRegistry.get(name)!)) {
if (inferredTypings.has(name) && inferredTypings.get(name) === undefined && typesRegistry.has(name) && isTypingUpToDate(typing, typesRegistry.get(name)!)) {
Copy link

@ghost ghost Jun 1, 2018

Choose a reason for hiding this comment

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

Nit: Better to .get() once and check against undefined, instead of using has() (in the usual case where a map shouldn't contain undefined values)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

@uniqueiniquity uniqueiniquity requested a review from mhegazy June 1, 2018 22:22
packageNameToTypingLocation.forEach((typing, name) => {
if (inferredTypings.has(name) && inferredTypings.get(name) === undefined && typesRegistry.has(name) && isTypingUpToDate(typing, typesRegistry.get(name)!)) {
const registryEntry = typesRegistry.get(name);
if (inferredTypings.has(name) && inferredTypings.get(name) === undefined && registryEntry !== undefined && isTypingUpToDate(typing, typesRegistry.get(name)!)) {
Copy link

@ghost ghost Jun 1, 2018

Choose a reason for hiding this comment

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

Forgot to replace the second typesRegistry.get with registryEntry

packageNameToTypingLocation.forEach((typing, name) => {
if (inferredTypings.has(name) && inferredTypings.get(name) === undefined && isTypingUpToDate(typing, typesRegistry.get(name)!)) {
const registryEntry = typesRegistry.get(name);
if (inferredTypings.has(name) && inferredTypings.get(name) === undefined && registryEntry !== undefined && isTypingUpToDate(typing, registryEntry!)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do not think u need the null assertion now.

@uniqueiniquity uniqueiniquity merged commit 7b8426d into microsoft:master Jun 4, 2018
@uniqueiniquity uniqueiniquity deleted the handleMissingRegistryEntries branch June 4, 2018 16:47
@microsoft microsoft locked and limited conversation to collaborators Aug 3, 2018
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