File tree 9 files changed +25
-2
lines changed
9 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -461,18 +461,23 @@ class Annotator extends Rewriter {
461
461
private emitInterface ( iface : ts . InterfaceDeclaration ) {
462
462
if ( this . options . untyped ) return ;
463
463
this . emit ( `\n/** @record */\n` ) ;
464
- this . emit ( `function ${ getIdentifierText ( iface . name ) } () {}\n` ) ;
464
+ let name = getIdentifierText ( iface . name ) ;
465
+ this . emit ( `function ${ name } () {}\n` ) ;
465
466
if ( iface . typeParameters ) {
466
467
this . emit ( `// TODO: type parameters.\n` ) ;
467
468
}
468
469
if ( iface . heritageClauses ) {
469
470
this . emit ( `// TODO: derived interfaces.\n` ) ;
470
471
}
471
472
472
- const memberNamespace = [ getIdentifierText ( iface . name ) , 'prototype' ] ;
473
+ const memberNamespace = [ name , 'prototype' ] ;
473
474
for ( let elem of iface . members ) {
474
475
this . visitProperty ( memberNamespace , elem ) ;
475
476
}
477
+
478
+ if ( iface . flags & ts . NodeFlags . Export ) {
479
+ this . emit ( `export {${ name } };\n` ) ;
480
+ }
476
481
}
477
482
478
483
// emitTypeAnnotationsHelper produces a
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ exports.export1 = 3;
7
7
exports . export2 = 3 ;
8
8
/** @record */
9
9
function Bar ( ) { }
10
+ exports . Bar = Bar ;
10
11
/** @type {number } */
11
12
Bar . prototype . barField ;
12
13
exports . export3 = null ;
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ export let /** @type {number} */ export2 = 3;
7
7
function Bar ( ) { }
8
8
/** @type {number } */
9
9
Bar . prototype . barField ;
10
+ export { Bar } ;
10
11
11
12
12
13
export interface Bar { barField : number ; }
Original file line number Diff line number Diff line change @@ -6,3 +6,4 @@ goog.module('tsickle_test.jsdoc_types.jsdoc_types');/**
6
6
var module1 = goog . require ( 'tsickle_test.jsdoc_types.module1' ) ;
7
7
// Check that imported types get the proper names in JSDoc.
8
8
let /** @type {module1.Class } */ x1 = new module1 . Class ( ) ;
9
+ let /** @type {module1.Interface } */ x2 = null ;
Original file line number Diff line number Diff line change @@ -7,3 +7,4 @@ import * as module1 from './module1';
7
7
8
8
// Check that imported types get the proper names in JSDoc.
9
9
let x1 = new module1 . Class ( ) ;
10
+ let x2 : module1 . Interface = null ;
Original file line number Diff line number Diff line change @@ -7,3 +7,4 @@ import * as module1 from './module1';
7
7
8
8
// Check that imported types get the proper names in JSDoc.
9
9
let /** @type {module1.Class } */ x1 = new module1 . Class ( ) ;
10
+ let /** @type {module1.Interface } */ x2 : module1 . Interface = null ;
Original file line number Diff line number Diff line change @@ -2,3 +2,8 @@ goog.module('tsickle_test.jsdoc_types.module1');
2
2
class Class {
3
3
}
4
4
exports . Class = Class ;
5
+ /** @record */
6
+ function Interface ( ) { }
7
+ exports . Interface = Interface ;
8
+ /** @type {number } */
9
+ Interface . prototype . x ;
Original file line number Diff line number Diff line change 1
1
export class Class { }
2
+ export interface Interface { x : number }
Original file line number Diff line number Diff line change 1
1
export class Class { }
2
+ /** @record */
3
+ function Interface ( ) { }
4
+ /** @type {number } */
5
+ Interface . prototype . x ;
6
+ export { Interface } ;
7
+
8
+ export interface Interface { x : number }
You can’t perform that action at this time.
0 commit comments