| 192 | * Handles array suffix ([]) and generic brackets. |
| 193 | */ |
| 194 | export function normalizeTypeName(name: string): string { |
| 195 | // Strip array suffix: "String[]" → "string" (arrays of allowed types are allowed) |
| 196 | // Strip generic args: "List[int]" → "list" (conservative — the generic wrapper |
| 197 | // might be unsafe even if the type arg is safe, so we check the outer type) |
| 198 | return name |
| 199 | .toLowerCase() |
| 200 | .replace(/\[\]$/, '') |
| 201 | .replace(/\[.*\]$/, '') |
| 202 | .trim() |
| 203 | } |
| 204 | |
| 205 | /** |
| 206 | * True if typeName (from AST) is in Microsoft's CLM allowlist. |