Skip to content

Commit

Permalink
set enum declaration values (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
mbarzda authored and englercj committed May 21, 2019
1 parent 7050017 commit a6d2608
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/create_helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,9 @@ export function createEnum(doclet: IMemberDoclet): ts.EnumDeclaration
for (let i = 0; i < doclet.properties.length; ++i)
{
const p = doclet.properties[i];
const l = p.defaultvalue !== undefined ? ts.createLiteral(p.defaultvalue) : undefined;

props.push(ts.createEnumMember(p.name, undefined));
props.push(ts.createEnumMember(p.name, l));
}
}

Expand Down
6 changes: 3 additions & 3 deletions test/expected/enum_all.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
* @enum {number}
*/
declare enum triState {
TRUE,
FALSE,
MAYBE
TRUE = 1,
FALSE = -1,
MAYBE = true
}


0 comments on commit a6d2608

Please sign in to comment.