-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Open
Labels
Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featureThis means we'd like to hear from more people who would be helped by this featureDomain: JSDocRelates to JSDoc parsing and type generationRelates to JSDoc parsing and type generationSuggestionAn idea for TypeScriptAn idea for TypeScript
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
ackvf, tonivj5, occar421, senocular, elerocks and 12 more
Metadata
Metadata
Assignees
Labels
Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featureThis means we'd like to hear from more people who would be helped by this featureDomain: JSDocRelates to JSDoc parsing and type generationRelates to JSDoc parsing and type generationSuggestionAn idea for TypeScriptAn idea for TypeScript