diff --git a/__tests__/lib/infer/properties.js b/__tests__/lib/infer/properties.js index 0c468767c..cb4a98e57 100644 --- a/__tests__/lib/infer/properties.js +++ b/__tests__/lib/infer/properties.js @@ -29,6 +29,20 @@ test('inferProperties', function() { } ]); + expect( + evaluate('/** @property {number} b */ type a = { b: 1 };').properties + ).toEqual([ + { + lineNumber: 0, + name: 'b', + title: 'property', + type: { + name: 'number', + type: 'NameExpression' + } + } + ]); + expect( evaluate('/** */interface a { b: 1, c: { d: 2 } };').properties ).toEqual([ diff --git a/src/infer/properties.js b/src/infer/properties.js index 6a7f3f479..e7f609967 100644 --- a/src/infer/properties.js +++ b/src/infer/properties.js @@ -35,7 +35,7 @@ function inferProperties(comment) { const explicitProperties = new Set(); // Ensure that explicitly specified properties are not overridden // by inferred properties - comment.properties.forEach(prop => explicitProperties.add(prop)); + comment.properties.forEach(prop => explicitProperties.add(prop.name)); function inferProperties(value, prefix) { if (value.type === 'ObjectTypeAnnotation') {