fix(codegen): add explicit any to class fields
fixes #8204 Closes #8205
This commit is contained in:
parent
0b6865d6c6
commit
c8d00dc191
|
@ -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(`;`);
|
||||
}
|
||||
|
|
|
@ -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'));
|
||||
|
|
Loading…
Reference in New Issue