fix(codegen): add explicit any to class fields

fixes #8204

Closes #8205
This commit is contained in:
Alex Eagle 2016-04-23 22:02:30 -07:00 committed by Alex Eagle
parent 0b6865d6c6
commit c8d00dc191
2 changed files with 3 additions and 1 deletions

View File

@ -130,6 +130,8 @@ class _TsEmitterVisitor extends AbstractEmitterVisitor implements o.TypeVisitor
if (isPresent(field.type)) {
ctx.print(`:`);
field.type.visitType(this, ctx);
} else {
ctx.print(`: any`);
}
ctx.println(`;`);
}

View File

@ -235,7 +235,7 @@ export function main() {
it('should support declaring fields', () => {
expect(emitStmt(new o.ClassStmt('SomeClass', null, [new o.ClassField('someField')], [],
null, [])))
.toEqual(['class SomeClass {', ' someField;', '}'].join('\n'));
.toEqual(['class SomeClass {', ' someField: any;', '}'].join('\n'));
expect(emitStmt(new o.ClassStmt('SomeClass', null,
[new o.ClassField('someField', o.INT_TYPE)], [], null, [])))
.toEqual(['class SomeClass {', ' someField:number;', '}'].join('\n'));