File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed
Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -308,7 +308,8 @@ export default function extractSymbol(
308308 nodeSymbol . meta . returns = extractReturns ( node ) ;
309309 nodeSymbol . meta . type = "MethodDoc" ;
310310 } else if ( isTSPropertySignature ( node ) ) {
311- // TODO: dataType
311+ nodeSymbol . meta . readonly = node . readonly ;
312+ nodeSymbol . meta . dataType = extractType ( node ) ;
312313 nodeSymbol . meta . type = "PropertyDoc" ;
313314 }
314315
Original file line number Diff line number Diff line change @@ -52,6 +52,22 @@ describe("@webdoc/parser.LanguageIntegration{@lang ts}", function() {
5252 expect ( symbolInitProperty . meta . readonly ) . to . equal ( true ) ;
5353 } ) ;
5454
55+ it ( "should parse interfaces correctly" , function ( ) {
56+ const symbolTree = buildSymbolTree ( `
57+ interface IModelSchema {
58+ readonly schemaId: string;
59+ serialize(): any;
60+ }
61+ ` , "*.ts" ) ;
62+
63+ const schemaId = findSymbol ( "IModelSchema.schemaId" , symbolTree ) ;
64+ const serialize = findSymbol ( "IModelSchema.serialize" , symbolTree ) ;
65+
66+ expect ( schemaId . meta . readonly ) . to . equal ( true ) ;
67+ expect ( schemaId . meta . dataType [ 0 ] ) . to . equal ( "string" ) ;
68+ expect ( serialize . meta . returns [ 0 ] . dataType [ 0 ] ) . to . equal ( "any" ) ;
69+ } ) ;
70+
5571 it ( "should be able to parse type-casted objects for property symbols" , function ( ) {
5672 const symtree = buildSymbolTree ( `
5773 (objectName as ObjectType).propertyName = "dataValue";
You can’t perform that action at this time.
0 commit comments