fix(types): resolve TS2411 errors under strict TypeScript settings#1
Open
nbouvrette wants to merge 1 commit intoimportantimport:mainfrom
Open
fix(types): resolve TS2411 errors under strict TypeScript settings#1nbouvrette wants to merge 1 commit intoimportantimport:mainfrom
nbouvrette wants to merge 1 commit intoimportantimport:mainfrom
Conversation
Change index signatures from `[k: string]: string` to `[k: string]: string | undefined` in three locations: - `engines` object (node? optional property) - `volta` object (extends? optional property) - `esnext` object variant (main? and browser? optional properties) Under strict TypeScript, optional named properties have type `string | undefined`, which is incompatible with an index signature typed as `[k: string]: string`. Widening the index signature to `string | undefined` resolves all four TS2411 errors. Fixes: - TS2411: Property 'node' of type 'string | undefined' is not assignable to 'string' index type 'string'. - TS2411: Property 'extends' of type 'string | undefined' is not assignable to 'string' index type 'string'. - TS2411: Property 'main' of type 'string | undefined' is not assignable to 'string' index type 'string'. - TS2411: Property 'browser' of type 'string | undefined' is not assignable to 'string' index type 'string'. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
[k: string]: stringto[k: string]: string | undefinedin three locations (engines,volta,esnextobject variant) insrc/types.d.tsstring | undefined, which conflicts with an index signature typed as[k: string]: string, producing TS2411 errorsstring | undefinedresolves all four errorsErrors fixed
Changes
enginesnode?: stringvoltaextends?: stringesnextobject variantmain?: string,browser?: stringNote on source
src/types.d.tsis auto-generated from the upstream JSON Schema at schemastore.org viapnpm build:upstream. Since the upstream schema cannot be changed here, the fix is applied directly to the generated source file — consistent with the existingsrc/patch/pattern used in this repo.🤖 Generated with Claude Code