LG-3756: Upgrade intl-tel-input from 16.0.7 to 17.0#4536
Conversation
**Why**: As a user, I want login.gov to not have unused or out of date apps, so that I can use the fastest and most secure app possible. See changelog: https://github.com/jackocnr/intl-tel-input/blob/master/CHANGELOG.md Specific upgrade conflicts: - Reliance on specific element IDs, now assigned uniquely by intl-tel-input - Reliance on duplicate list item element IDs, now assigned uniquely by intl-tel-input
| /** @type {NodeListOf<HTMLLIElement>} */ | ||
| const duplicates = iti.querySelectorAll(`.iti__standard[data-country-code="${countryCode}"]`); | ||
| duplicates.forEach((duplicateListItem) => { | ||
| duplicateListItem.parentNode?.removeChild(duplicateListItem); |
There was a problem hiding this comment.
what are the cases when a list item has a null parent node? since we're querying from iti wouldn't every element have some parent?
There was a problem hiding this comment.
what are the cases when a list item has a null parent node? since we're querying from
itiwouldn't every element have some parent?
In most practical cases, never. Especially here since we're running querySelectorAll from a starting element, so at the very least that element would be the parent. I think TypeScript defaults to a generic Element|null type for the parent, since it can be a common case to "walk up the tree" using null as a condition to stop (e.g. Element#closest polyfill).
Another option here is to instruct TypeScript to treat it as though it exists:
| duplicateListItem.parentNode?.removeChild(duplicateListItem); | |
| /** @type {HTMLULElement} */ (duplicateListItem.parentNode).removeChild(duplicateListItem); |
There was a problem hiding this comment.
Oh yeah I didn't realize it was part of the method definition --- seems easier to just leave the null-safe navigator in there
There was a problem hiding this comment.
Oh yeah I didn't realize it was part of the method definition --- seems easier to just leave the null-safe navigator in there
Yeah, the main downside I see is that in practical terms, the transpiled output is quite verbose (example), though this feels pretty incidental and eventually temporary.
Why: As a user, I want login.gov to not have unused or out of date apps, so that I can use the fastest and most secure app possible.
See changelog: https://github.com/jackocnr/intl-tel-input/blob/master/CHANGELOG.md
Specific upgrade conflicts: