chore(lint): enable unnecessary type parameter rule

This commit is contained in:
Peter Steinberger
2026-04-18 18:28:20 +01:00
parent 630f2bcabe
commit df525b90f2
94 changed files with 186 additions and 152 deletions

View File

@@ -10,14 +10,12 @@ export type CommandDescriptorCatalog<TDescriptor extends NamedCommandDescriptor>
getCommandsWithSubcommands: () => string[];
};
export function getCommandDescriptorNames<TDescriptor extends CommandDescriptorLike>(
descriptors: readonly TDescriptor[],
): string[] {
export function getCommandDescriptorNames(descriptors: readonly CommandDescriptorLike[]): string[] {
return descriptors.map((descriptor) => descriptor.name);
}
export function getCommandsWithSubcommands<TDescriptor extends NamedCommandDescriptor>(
descriptors: readonly TDescriptor[],
export function getCommandsWithSubcommands(
descriptors: readonly NamedCommandDescriptor[],
): string[] {
return descriptors
.filter((descriptor) => descriptor.hasSubcommands)
@@ -52,9 +50,9 @@ export function defineCommandDescriptorCatalog<TDescriptor extends NamedCommandD
};
}
export function addCommandDescriptorsToProgram<TDescriptor extends CommandDescriptorLike>(
export function addCommandDescriptorsToProgram(
program: Command,
descriptors: readonly TDescriptor[],
descriptors: readonly CommandDescriptorLike[],
existingCommands: Set<string> = new Set(),
): Set<string> {
for (const descriptor of descriptors) {

View File

@@ -46,8 +46,8 @@ export function resolveCommandGroupEntries<TDescriptor extends NamedCommandDescr
}));
}
export function buildCommandGroupEntries<TDescriptor extends NamedCommandDescriptor, TRegister>(
descriptors: readonly TDescriptor[],
export function buildCommandGroupEntries<TRegister>(
descriptors: readonly NamedCommandDescriptor[],
specs: readonly CommandGroupDescriptorSpec<TRegister>[],
mapRegister: (register: TRegister) => CommandGroupEntry["register"],
): CommandGroupEntry[] {

View File

@@ -27,10 +27,10 @@ function getDeclaredCommandJsonMode(command: Command): JsonMode | null {
function commandSelectedJsonFlag(command: Command, argv: string[]): boolean {
const commandWithGlobals = command as Command & {
optsWithGlobals?: <T extends Record<string, unknown>>() => T;
optsWithGlobals?: () => Record<string, unknown>;
};
if (typeof commandWithGlobals.optsWithGlobals === "function") {
const resolved = commandWithGlobals.optsWithGlobals<Record<string, unknown>>().json;
const resolved = commandWithGlobals.optsWithGlobals().json;
if (resolved === true) {
return true;
}