File tree Expand file tree Collapse file tree 8 files changed +321
-8
lines changed
Expand file tree Collapse file tree 8 files changed +321
-8
lines changed Original file line number Diff line number Diff line change @@ -15,22 +15,25 @@ export class ExportConverter extends ConverterNodeComponent<ts.ExportAssignment>
1515 ts . SyntaxKind . ExportAssignment
1616 ] ;
1717
18-
1918 convert ( context :Context , node :ts . ExportAssignment ) :Reflection {
20- if ( ! node . isExportEquals ) {
21- return context . scope ;
19+ let symbol : ts . Symbol = undefined ;
20+
21+ // default export
22+ if ( node . symbol && ( node . symbol . flags & ts . SymbolFlags . Alias ) === ts . SymbolFlags . Alias ) {
23+ symbol = context . checker . getAliasedSymbol ( node . symbol ) ;
24+ } else {
25+ let type = context . getTypeAtLocation ( node . expression ) ;
26+ symbol = type ? type . symbol : undefined ;
2227 }
23-
24- var type = context . getTypeAtLocation ( node . expression ) ;
25- if ( type && type . symbol ) {
28+ if ( symbol ) {
2629 var project = context . project ;
27- type . symbol . declarations . forEach ( ( declaration ) => {
30+ symbol . declarations . forEach ( ( declaration ) => {
2831 if ( ! declaration . symbol ) return ;
2932 var id = project . symbolMapping [ context . getSymbolID ( declaration . symbol ) ] ;
3033 if ( ! id ) return ;
3134
3235 var reflection = project . reflections [ id ] ;
33- if ( reflection instanceof DeclarationReflection ) {
36+ if ( node . isExportEquals && reflection instanceof DeclarationReflection ) {
3437 ( < DeclarationReflection > reflection ) . setFlag ( ReflectionFlag . ExportAssignment , true ) ;
3538 }
3639 markAsExported ( reflection ) ;
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ var Assert = require("assert");
77function compareReflections ( fixture , spec , path ) {
88 var key ;
99 path = ( path ? path + '/' : '' ) + spec . name ;
10+ Assert . deepEqual ( fixture , spec ) ;
1011
1112 for ( key in spec ) {
1213 if ( ! spec . hasOwnProperty ( key ) ) continue ;
Original file line number Diff line number Diff line change 1+ /// <reference path="../lib.core.d.ts" />
2+
3+ function add ( x : number , y : number ) {
4+ return x + y ;
5+ }
6+
7+ export = add ;
Original file line number Diff line number Diff line change 1+ {
2+ "id" : 0 ,
3+ "name" : " typedoc" ,
4+ "kind" : 0 ,
5+ "flags" : {},
6+ "children" : [
7+ {
8+ "id" : 1 ,
9+ "name" : " \" export-assignment\" " ,
10+ "kind" : 1 ,
11+ "kindString" : " External module" ,
12+ "flags" : {
13+ "isExported" : true
14+ },
15+ "originalName" : " %BASE%/export-assignment/export-assignment.ts" ,
16+ "children" : [
17+ {
18+ "id" : 2 ,
19+ "name" : " add" ,
20+ "kind" : 64 ,
21+ "kindString" : " Function" ,
22+ "flags" : {
23+ "isExported" : true ,
24+ "hasExportAssignment" : true
25+ },
26+ "signatures" : [
27+ {
28+ "id" : 3 ,
29+ "name" : " add" ,
30+ "kind" : 4096 ,
31+ "kindString" : " Call signature" ,
32+ "flags" : {},
33+ "parameters" : [
34+ {
35+ "id" : 4 ,
36+ "name" : " x" ,
37+ "kind" : 32768 ,
38+ "kindString" : " Parameter" ,
39+ "flags" : {},
40+ "type" : {
41+ "type" : " instrinct" ,
42+ "name" : " number"
43+ }
44+ },
45+ {
46+ "id" : 5 ,
47+ "name" : " y" ,
48+ "kind" : 32768 ,
49+ "kindString" : " Parameter" ,
50+ "flags" : {},
51+ "type" : {
52+ "type" : " instrinct" ,
53+ "name" : " number"
54+ }
55+ }
56+ ],
57+ "type" : {
58+ "type" : " instrinct" ,
59+ "name" : " number"
60+ }
61+ }
62+ ],
63+ "sources" : [
64+ {
65+ "fileName" : " export-assignment.ts" ,
66+ "line" : 3 ,
67+ "character" : 12
68+ }
69+ ]
70+ }
71+ ],
72+ "groups" : [
73+ {
74+ "title" : " Functions" ,
75+ "kind" : 64 ,
76+ "children" : [
77+ 2
78+ ]
79+ }
80+ ],
81+ "sources" : [
82+ {
83+ "fileName" : " export-assignment.ts" ,
84+ "line" : 1 ,
85+ "character" : 0
86+ }
87+ ]
88+ }
89+ ],
90+ "groups" : [
91+ {
92+ "title" : " External modules" ,
93+ "kind" : 1 ,
94+ "children" : [
95+ 1
96+ ]
97+ }
98+ ]
99+ }
Original file line number Diff line number Diff line change 1+ /// <reference path="../lib.core.d.ts" />
2+
3+ const x = 5 ;
4+ export default x ;
Original file line number Diff line number Diff line change 1+ {
2+ "id" : 0 ,
3+ "name" : " typedoc" ,
4+ "kind" : 0 ,
5+ "flags" : {},
6+ "children" : [
7+ {
8+ "id" : 1 ,
9+ "name" : " \" export-default\" " ,
10+ "kind" : 1 ,
11+ "kindString" : " External module" ,
12+ "flags" : {
13+ "isExported" : true
14+ },
15+ "originalName" : " %BASE%/export-default/export-default.ts" ,
16+ "children" : [
17+ {
18+ "id" : 2 ,
19+ "name" : " x" ,
20+ "kind" : 32 ,
21+ "kindString" : " Variable" ,
22+ "flags" : {
23+ "isExported" : true
24+ },
25+ "sources" : [
26+ {
27+ "fileName" : " export-default.ts" ,
28+ "line" : 3 ,
29+ "character" : 7
30+ }
31+ ],
32+ "type" : {
33+ "type" : " instrinct" ,
34+ "name" : " number"
35+ },
36+ "defaultValue" : " 5"
37+ }
38+ ],
39+ "groups" : [
40+ {
41+ "title" : " Variables" ,
42+ "kind" : 32 ,
43+ "children" : [
44+ 2
45+ ]
46+ }
47+ ],
48+ "sources" : [
49+ {
50+ "fileName" : " export-default.ts" ,
51+ "line" : 1 ,
52+ "character" : 0
53+ }
54+ ]
55+ }
56+ ],
57+ "groups" : [
58+ {
59+ "title" : " External modules" ,
60+ "kind" : 1 ,
61+ "children" : [
62+ 1
63+ ]
64+ }
65+ ]
66+ }
Original file line number Diff line number Diff line change 1+ /// <reference path="../lib.core.d.ts" />
2+
3+ export const x = 5 ;
4+
5+ export function add ( x : number , y : number ) {
6+ return x + y ;
7+ }
Original file line number Diff line number Diff line change 1+ {
2+ "id" : 0 ,
3+ "name" : " typedoc" ,
4+ "kind" : 0 ,
5+ "flags" : {},
6+ "children" : [
7+ {
8+ "id" : 1 ,
9+ "name" : " \" export\" " ,
10+ "kind" : 1 ,
11+ "kindString" : " External module" ,
12+ "flags" : {
13+ "isExported" : true
14+ },
15+ "originalName" : " %BASE%/export/export.ts" ,
16+ "children" : [
17+ {
18+ "id" : 2 ,
19+ "name" : " x" ,
20+ "kind" : 32 ,
21+ "kindString" : " Variable" ,
22+ "flags" : {
23+ "isExported" : true
24+ },
25+ "sources" : [
26+ {
27+ "fileName" : " export.ts" ,
28+ "line" : 3 ,
29+ "character" : 14
30+ }
31+ ],
32+ "type" : {
33+ "type" : " instrinct" ,
34+ "name" : " number"
35+ },
36+ "defaultValue" : " 5"
37+ },
38+ {
39+ "id" : 3 ,
40+ "name" : " add" ,
41+ "kind" : 64 ,
42+ "kindString" : " Function" ,
43+ "flags" : {
44+ "isExported" : true
45+ },
46+ "signatures" : [
47+ {
48+ "id" : 4 ,
49+ "name" : " add" ,
50+ "kind" : 4096 ,
51+ "kindString" : " Call signature" ,
52+ "flags" : {},
53+ "parameters" : [
54+ {
55+ "id" : 5 ,
56+ "name" : " x" ,
57+ "kind" : 32768 ,
58+ "kindString" : " Parameter" ,
59+ "flags" : {},
60+ "type" : {
61+ "type" : " instrinct" ,
62+ "name" : " number"
63+ }
64+ },
65+ {
66+ "id" : 6 ,
67+ "name" : " y" ,
68+ "kind" : 32768 ,
69+ "kindString" : " Parameter" ,
70+ "flags" : {},
71+ "type" : {
72+ "type" : " instrinct" ,
73+ "name" : " number"
74+ }
75+ }
76+ ],
77+ "type" : {
78+ "type" : " instrinct" ,
79+ "name" : " number"
80+ }
81+ }
82+ ],
83+ "sources" : [
84+ {
85+ "fileName" : " export.ts" ,
86+ "line" : 5 ,
87+ "character" : 19
88+ }
89+ ]
90+ }
91+ ],
92+ "groups" : [
93+ {
94+ "title" : " Variables" ,
95+ "kind" : 32 ,
96+ "children" : [
97+ 2
98+ ]
99+ },
100+ {
101+ "title" : " Functions" ,
102+ "kind" : 64 ,
103+ "children" : [
104+ 3
105+ ]
106+ }
107+ ],
108+ "sources" : [
109+ {
110+ "fileName" : " export.ts" ,
111+ "line" : 1 ,
112+ "character" : 0
113+ }
114+ ]
115+ }
116+ ],
117+ "groups" : [
118+ {
119+ "title" : " External modules" ,
120+ "kind" : 1 ,
121+ "children" : [
122+ 1
123+ ]
124+ }
125+ ]
126+ }
You can’t perform that action at this time.
0 commit comments