Change suggestions to readonly arrays in index.d.ts - #5
Open
Finchasaurus wants to merge 1 commit into
Open
Conversation
Changed suggestions to be readonly arrays and provided suggestion fields for other argument types.
Loner1536
added a commit
to Loner1536/Konsole
that referenced
this pull request
Jul 24, 2026
…ever-hole on player/players Konsole never mutates these after handing them back out - Command.args/aliases, Rank.aliases, KommandModule.schemas(), and the default config's input.activationKeys/commands.aliases are all live references into internal tables, so exposing them as mutable arrays let consumers silently corrupt shared state. Also caught the same "suggestions on player/players" gap Finchasaurus flagged on the Argument union in KYRORBLX#5 - those variants never read .suggestions, so it should be excluded there too, not just on string/number/boolean.
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.
This PR changed the suggestions field of Arguments to be readonly, which allows code such as this to work:
This PR also added a suggestions field of
neverto Player and Players argument types which allow indexing of arguments through context (ctx.kommand.args[0].suggestions). Previously, TypeScript didn't recognize the suggestions field because it may or may not have been applicable.