-
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix "implicit any" Typescript errors to prepare for Typescript 5.5 (#…
…1817) * Teach Typescript about the types of field keys Typescript 5.5 disallows the "suppressImplicitAnyIndexErrors", so we need to go through the code, find any places where an index has an implicit "any" type, and annotate those places with the correct type so that Typescript won't complain about them. In a couple places, we do `if foo.hasOwnProperty(bar)` followed by getting the value of `foo[bar]`, but Typescript warns that "string" isn't a valid property name of `foo`. It should recognize that the hasOwnProperty check means it's safe to access `foo[bar]`, but it doesn't. We can either change those to be `if bar in foo` which Typescript *does* recognize as a type guard, or else we can just leave the code as-is and add @ts-expect-error comments. Since `bar in foo` is not quite identical to `foo.hasOwnProperty(bar)` (`bar in foo` climbs inheritance hierarchies whereas `.hasOwnProperty` doesn't), I chose to leave the code as-is rather than subtly change its behavior. * Remove suppressImplicitAnyIndexErrors from tsconfig Now that we've fixed the implicit "any" index errors, we can remove this line from tsconfig. (It will be going away in Typescript 5.5 anyway).
- Loading branch information
Showing
11 changed files
with
45 additions
and
39 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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