Skip to content

Commit

Permalink
updated param
Browse files Browse the repository at this point in the history
added second write for also printing type
  • Loading branch information
Schnides123 committed Dec 18, 2024
1 parent 22e6bfc commit 57c9091
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion generators/typescript-v2/ast/src/ast/Func.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export class Func extends AstNode {
writer.write("const ");
writer.write(`${this.name}`);
writer.write(" = ");
writer.delimit(this._parameters, ", ", (parameter) => parameter.write(writer), "(", ")");
writer.delimit(this._parameters, ", ", (parameter) => parameter.writeWithType(writer), "(", ")");
if (this._return_.length > 0) {
writer.write(": ");
if (this._return_.length === 1) {
Expand Down
2 changes: 1 addition & 1 deletion generators/typescript-v2/ast/src/ast/Method.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class Method extends Func {
// TODO: Add visibility, make this nest in an object eventually
writer.write(`function `);

Check failure on line 32 in generators/typescript-v2/ast/src/ast/Method.ts

View workflow job for this annotation

GitHub Actions / eslint

Strings must use doublequote
writer.write(`${this._name}`);
writer.delimit(this._parameters, ", ", (parameter) => parameter.write(writer), "(", ")");
writer.delimit(this._parameters, ", ", (parameter) => parameter.writeWithType(writer), "(", ")");
if (this._return_.length > 0) {
writer.write(": ");
if (this._return_.length === 1) {
Expand Down
7 changes: 7 additions & 0 deletions generators/typescript-v2/ast/src/ast/Parameter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ export class Parameter extends AstNode {
}

public write(writer: Writer): void {
writer.write(`${this.name}`);
}

public writeWithType(writer: Writer): void {
if (this.docs != null) {
writer.writeNode(new Comment({ docs: this.docs }));
}
writer.write(`${this.name}: `);
this.type.write(writer);
}
Expand Down

0 comments on commit 57c9091

Please sign in to comment.