fix(plugins): renforce le typage des Set filtrés dans loader.ts
Point de départ de la réinvestigation #120 : commandIdsFromContributes et layoutTypesFromContributes typaient implicitement leurs Set en unknown, masquant les valeurs vides potentielles issues des contributions de plugin (piste du crash d'affichage à l'installation). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@ -118,19 +118,19 @@ function safePluginId(entry: unknown): string {
|
||||
}
|
||||
|
||||
function commandIdsFromContributes(contributes: PluginContributionDto): Set<string> {
|
||||
return new Set(
|
||||
contributes.menuItems.flatMap((item) => {
|
||||
const command = objectOrEmpty(item).command;
|
||||
return nonEmptyString(command) ? [command] : [];
|
||||
return new Set<string>(
|
||||
contributes.menuItems.flatMap<string>((item) => {
|
||||
const command = nonEmptyString(objectOrEmpty(item).command);
|
||||
return command ? [command] : [];
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
function layoutTypesFromContributes(contributes: PluginContributionDto): Set<string> {
|
||||
return new Set(
|
||||
contributes.layouts.flatMap((layout) => {
|
||||
const type = objectOrEmpty(layout).type;
|
||||
return nonEmptyString(type) ? [type] : [];
|
||||
return new Set<string>(
|
||||
contributes.layouts.flatMap<string>((layout) => {
|
||||
const type = nonEmptyString(objectOrEmpty(layout).type);
|
||||
return type ? [type] : [];
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user