You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Complain when a non-void/any function lacks a return expresson.
In effect this fixes#62.
Also
- Changes the error message for get accessors lacking return expressions.
- Actually checks for return expressions instead of return statements for get-accessors.
- Removes fancy quotes.
- Corrects errors in the compiler caught by the new check.
- Simplified `checkAndAggregateReturnTypes` by extracting it out to `visitReturnStatements`.
Copy file name to clipboardExpand all lines: src/compiler/diagnosticInformationMap.generated.ts
+2-1Lines changed: 2 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -113,8 +113,9 @@ module ts {
113
113
The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter: {code: 2117,category: DiagnosticCategory.Error,key: "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter."},
114
114
The_left_hand_side_of_an_in_expression_must_be_of_types_any_string_or_number: {code: 2118,category: DiagnosticCategory.Error,key: "The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'."},
115
115
The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: {code: 2119,category: DiagnosticCategory.Error,key: "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter"},
116
-
Getters_must_return_a_value: {code: 2126,category: DiagnosticCategory.Error,key: "Getters must return a value."},
116
+
A_get_accessor_must_return_a_value_or_consist_of_a_single_throw_statement: {code: 2126,category: DiagnosticCategory.Error,key: "A 'get' accessor must return a value or consist of a single 'throw' statement."},
117
117
Getter_and_setter_accessors_do_not_agree_in_visibility: {code: 2127,category: DiagnosticCategory.Error,key: "Getter and setter accessors do not agree in visibility."},
118
+
A_function_whose_declared_type_is_neither_void_nor_any_must_have_a_return_expression_or_consist_of_a_single_throw_statement: {code: 2131,category: DiagnosticCategory.Error,key: "A function whose declared type is neither 'void' nor 'any' must have a 'return' expression or consist of a single 'throw' statement."},
118
119
Untyped_function_calls_may_not_accept_type_arguments: {code: 2158,category: DiagnosticCategory.Error,key: "Untyped function calls may not accept type arguments."},
119
120
The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: {code: 2120,category: DiagnosticCategory.Error,key: "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter."},
120
121
The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: {code: 2121,category: DiagnosticCategory.Error,key: "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type."},
0 commit comments