microsoft / microsoft/TypeScript
Expect to use @throws in lib/*.d.ts to mark which methods may throw err
Personne n'a encore pris cette issue.
- Langage dominant
- Go
- Étoiles
- 111k
- Forks
- 14.3k
- Merge moyen
- 1 j 19 h
- PR mergées (30 j)
- 117
Description
Suggestion
Use @throws to mark the corresponding error on the method in the .d.ts file in the lib directory
🔍 Search Terms
@throws jsdoc comments
✅ Viability Checklist
My suggestion meets these guidelines:
- This wouldn't be a breaking change in existing TypeScript/JavaScript code
- This wouldn't change the runtime behavior of existing JavaScript code
- This could be implemented without emitting different JS based on the types of the expressions
- This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
- This feature would agree with the rest of TypeScript's Design Goals.
⭐ Suggestion
Use @throws to mark the corresponding error on the method in the .d.ts file in the lib directory
📃 Motivating Example
/**
* Converts a JavaScript Object Notation (JSON) string into an object.
* @param text A valid JSON string.
* @param reviver A function that transforms the results. This function is called for each member of the object.
+* @throws {SyntaxError} if the string to parse is not valid JSON.
* If a member contains nested objects, the nested objects are transformed before the parent object is.
*/
parse(text: string, reviver?: (this: any, key: string, value: any) => any): any;
💻 Use Cases
want to be able to write code when you know that you need to beware of these unpredictable behavior
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Examinez les déclarations dans lib/*.d.ts et recherchez dans leurs commentaires JSDoc les méthodes susceptibles de lever des erreurs. Utilisez comme référence l’exemple d’analyse JSON présent dans l’issue, puis vérifiez que chaque méthode concernée documente l’erreur correspondante avec @throws. Aucun fichier de test ni point d’entrée plus précis n’est indiqué ; le travail est terminé lorsque les déclarations pertinentes sont annotées de manière cohérente.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- typescript
- Domaine
- documentation
- Type d'issue
- Documentation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 35/100