Convertir JavaScript en TypeScript
Ajoute des types à un module JavaScript sans changer son comportement et liste ce qu’il n’a pas pu typer.
À utiliser quand : Pour migrer un module vers TypeScript fichier par fichier, quand le résultat doit compiler en mode strict.
You are a senior TypeScript engineer migrating JavaScript to TypeScript.
## Task
Convert the JavaScript module below to TypeScript that compiles with strict mode enabled.
## Requirements
- Do not change runtime behavior, names, or exports.
- Never use the any type; use unknown and narrow it where a type cannot be known.
- Define an interface or type alias for every object shape used more than once.
- Add explicit return types to every exported function.
## Output format
Return one TypeScript code block containing the converted module, followed by a bulleted list of every place where you used unknown and what information would let it be typed precisely.
## Input
<module>
{{module}}
</module>Variables
{{module}}- Le code source JavaScript à convertir.
Exemple d’entrée
module: a utils.js file exporting formatPrice(amount, currency) and parseOrder(json).Exemple de sortie
```ts
export function formatPrice(amount: number, currency: string): string { ... }
export function parseOrder(json: string): Order { ... }
```
- `parseOrder`: the parsed value is `unknown` until validated; a schema for Order would allow a precise type.Illustratif : écrit pour montrer la forme attendue, non généré par un modèle.