mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-10 18:04:18 -05:00
@@ -2621,7 +2621,7 @@ namespace ts {
|
||||
function getJSDocTypeForVariableLikeDeclarationFromJSDocComment(declaration: VariableLikeDeclaration): JSDocType {
|
||||
// First, see if this node has an @type annotation on it directly.
|
||||
const typeTag = getJSDocTypeTag(declaration);
|
||||
if (typeTag) {
|
||||
if (typeTag && typeTag.typeExpression) {
|
||||
return typeTag.typeExpression.type;
|
||||
}
|
||||
|
||||
@@ -2631,7 +2631,7 @@ namespace ts {
|
||||
|
||||
// @type annotation might have been on the variable statement, try that instead.
|
||||
const annotation = getJSDocTypeTag(declaration.parent.parent);
|
||||
if (annotation) {
|
||||
if (annotation && annotation.typeExpression) {
|
||||
return annotation.typeExpression.type;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -947,6 +947,9 @@ namespace Harness {
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (name === 'suppressOutputPathCheck') {
|
||||
options.suppressOutputPathCheck = true;
|
||||
}
|
||||
else {
|
||||
throw new Error(`Unknown compiler option '${name}'.`);
|
||||
}
|
||||
|
||||
17
tests/baselines/reference/malformedTags.js
Normal file
17
tests/baselines/reference/malformedTags.js
Normal file
@@ -0,0 +1,17 @@
|
||||
//// [myFile02.js]
|
||||
|
||||
/**
|
||||
* Checks if `value` is classified as an `Array` object.
|
||||
*
|
||||
* @type Function
|
||||
*/
|
||||
var isArray = Array.isArray;
|
||||
|
||||
|
||||
//// [myFile02.js]
|
||||
/**
|
||||
* Checks if `value` is classified as an `Array` object.
|
||||
*
|
||||
* @type Function
|
||||
*/
|
||||
var isArray = Array.isArray;
|
||||
13
tests/baselines/reference/malformedTags.symbols
Normal file
13
tests/baselines/reference/malformedTags.symbols
Normal file
@@ -0,0 +1,13 @@
|
||||
=== tests/cases/conformance/salsa/myFile02.js ===
|
||||
|
||||
/**
|
||||
* Checks if `value` is classified as an `Array` object.
|
||||
*
|
||||
* @type Function
|
||||
*/
|
||||
var isArray = Array.isArray;
|
||||
>isArray : Symbol(isArray, Decl(myFile02.js, 6, 3))
|
||||
>Array.isArray : Symbol(ArrayConstructor.isArray, Decl(lib.d.ts, --, --))
|
||||
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>isArray : Symbol(ArrayConstructor.isArray, Decl(lib.d.ts, --, --))
|
||||
|
||||
13
tests/baselines/reference/malformedTags.types
Normal file
13
tests/baselines/reference/malformedTags.types
Normal file
@@ -0,0 +1,13 @@
|
||||
=== tests/cases/conformance/salsa/myFile02.js ===
|
||||
|
||||
/**
|
||||
* Checks if `value` is classified as an `Array` object.
|
||||
*
|
||||
* @type Function
|
||||
*/
|
||||
var isArray = Array.isArray;
|
||||
>isArray : (arg: any) => arg is any[]
|
||||
>Array.isArray : (arg: any) => arg is any[]
|
||||
>Array : ArrayConstructor
|
||||
>isArray : (arg: any) => arg is any[]
|
||||
|
||||
10
tests/cases/conformance/salsa/malformedTags.ts
Normal file
10
tests/cases/conformance/salsa/malformedTags.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
// @allowJS: true
|
||||
// @suppressOutputPathCheck: true
|
||||
|
||||
// @filename: myFile02.js
|
||||
/**
|
||||
* Checks if `value` is classified as an `Array` object.
|
||||
*
|
||||
* @type Function
|
||||
*/
|
||||
var isArray = Array.isArray;
|
||||
Reference in New Issue
Block a user