Get jsDoctype for property assignment

This commit is contained in:
Yui T 2017-05-31 12:05:31 -07:00
parent 3eda9c627b
commit 8a28e15146

View File

@ -13273,6 +13273,7 @@ namespace ts {
let patternWithComputedProperties = false;
let hasComputedStringProperty = false;
let hasComputedNumberProperty = false;
const isInJSFile = isInJavaScriptFile(node);
let offset = 0;
for (let i = 0; i < node.properties.length; i++) {
@ -13281,6 +13282,11 @@ namespace ts {
if (memberDecl.kind === SyntaxKind.PropertyAssignment ||
memberDecl.kind === SyntaxKind.ShorthandPropertyAssignment ||
isObjectLiteralMethod(memberDecl)) {
let jsdocType: Type;
if (isInJSFile) {
jsdocType = getTypeForDeclarationFromJSDocComment(memberDecl);
}
let type: Type;
if (memberDecl.kind === SyntaxKind.PropertyAssignment) {
type = checkPropertyAssignment(<PropertyAssignment>memberDecl, checkMode);
@ -13293,6 +13299,11 @@ namespace ts {
type = checkExpressionForMutableLocation((<ShorthandPropertyAssignment>memberDecl).name, checkMode);
}
if (jsdocType) {
checkTypeAssignableTo(type, jsdocType, memberDecl);
type = jsdocType;
}
typeFlags |= type.flags;
const prop = createSymbol(SymbolFlags.Property | member.flags, member.name);
if (inDestructuringPattern) {