File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,7 @@ tests/cases/**/*.js.map
41
41
scripts /debug.bat
42
42
scripts /run.bat
43
43
scripts /word2md.js
44
+ scripts /buildProtocol.js
44
45
scripts /ior.js
45
46
scripts /buildProtocol.js
46
47
scripts /* .js.map
Original file line number Diff line number Diff line change @@ -42,7 +42,14 @@ class DeclarationsWalker {
42
42
return ;
43
43
}
44
44
// splice declaration in final d.ts file
45
- const text = decl . getFullText ( ) ;
45
+ let text = decl . getFullText ( ) ;
46
+ if ( decl . kind === ts . SyntaxKind . EnumDeclaration && ! ( decl . flags & ts . NodeFlags . Const ) ) {
47
+ // patch enum declaration to make them constan
48
+ const declStart = decl . getStart ( ) - decl . getFullStart ( ) ;
49
+ const prefix = text . substring ( 0 , declStart ) ;
50
+ const suffix = text . substring ( declStart + "enum" . length , decl . getEnd ( ) - decl . getFullStart ( ) ) ;
51
+ text = prefix + "const enum" + suffix ;
52
+ }
46
53
this . text += `${ text } \n` ;
47
54
48
55
// recursively pull all dependencies into result dts file
You can’t perform that action at this time.
0 commit comments