Add "undefined" as return type

This commit is contained in:
Kanchalai Tanglertsampan
2017-06-13 15:20:52 -07:00
parent d392f1edab
commit 3062d36463

View File

@@ -2721,11 +2721,11 @@ namespace ts {
* Gets the effective type annotation of a variable, parameter, or property. If the node was
* parsed in a JavaScript file, gets the type annotation from JSDoc.
*/
export function getEffectiveTypeAnnotationNode(node: VariableLikeDeclaration): TypeNode {
export function getEffectiveTypeAnnotationNode(node: VariableLikeDeclaration): TypeNode | undefined {
if (node.type) {
return node.type;
}
if (node.flags & NodeFlags.JavaScriptFile) {
if (isInJavaScriptFile(node)) {
return getJSDocType(node);
}
}
@@ -2734,11 +2734,11 @@ namespace ts {
* Gets the effective return type annotation of a signature. If the node was parsed in a
* JavaScript file, gets the return type annotation from JSDoc.
*/
export function getEffectiveReturnTypeNode(node: SignatureDeclaration): TypeNode {
export function getEffectiveReturnTypeNode(node: SignatureDeclaration): TypeNode | undefined {
if (node.type) {
return node.type;
}
if (node.flags & NodeFlags.JavaScriptFile) {
if (isInJavaScriptFile(node)) {
return getJSDocReturnType(node);
}
}