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:
2026-07-31 23:52:42 +02:00
parent 5efb026a80
commit ac659c42f2

View File

@ -118,19 +118,19 @@ function safePluginId(entry: unknown): string {
} }
function commandIdsFromContributes(contributes: PluginContributionDto): Set<string> { function commandIdsFromContributes(contributes: PluginContributionDto): Set<string> {
return new Set( return new Set<string>(
contributes.menuItems.flatMap((item) => { contributes.menuItems.flatMap<string>((item) => {
const command = objectOrEmpty(item).command; const command = nonEmptyString(objectOrEmpty(item).command);
return nonEmptyString(command) ? [command] : []; return command ? [command] : [];
}), }),
); );
} }
function layoutTypesFromContributes(contributes: PluginContributionDto): Set<string> { function layoutTypesFromContributes(contributes: PluginContributionDto): Set<string> {
return new Set( return new Set<string>(
contributes.layouts.flatMap((layout) => { contributes.layouts.flatMap<string>((layout) => {
const type = objectOrEmpty(layout).type; const type = nonEmptyString(objectOrEmpty(layout).type);
return nonEmptyString(type) ? [type] : []; return type ? [type] : [];
}), }),
); );
} }