Skip to content

Commit

Permalink
Merge pull request #1 from glomdom/master
Browse files Browse the repository at this point in the history
fix generics being lowercase during codegen and other things
  • Loading branch information
R-unic authored Mar 28, 2024
2 parents eba7951 + 30cdc21 commit 0b9bd11
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
4 changes: 3 additions & 1 deletion default_tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@

"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
"skipLibCheck": true,

/* Type Checking */
"strict": true /* Enable all strict type-checking options. */
}
},
"exclude": ["examples"]
}
4 changes: 3 additions & 1 deletion src/code-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export default class CodeGenerator extends StringBuilder {
case SyntaxKind.Identifier: {
const { text } = <Identifier>node;
const isTypeIdent = this.consumeFlag("TypeIdent");
this.append(isTypeIdent ? this.getMappedType(text) : this.getMappedIdentifier(text));
this.append(isTypeIdent ? this.getMappedIdentifier(text) : this.getMappedType(text));
break;
}
case SyntaxKind.VariableDeclaration: {
Expand Down Expand Up @@ -1313,6 +1313,7 @@ export default class CodeGenerator extends StringBuilder {
this.append(" forall ");
for (const typeParam of typeParameters) {
this.walk(typeParam.name);

if (Util.isNotLast(typeParam, typeParameters))
this.append(", ");
}
Expand Down Expand Up @@ -1456,6 +1457,7 @@ export default class CodeGenerator extends StringBuilder {
case SyntaxKind.TypeReference: {
const ref = <TypeReferenceNode>type;
const typeName = this.getMappedType(ref.typeName.getText(this.sourceNode));

this.append(typeName);
this.walkTypeArguments(ref.typeArguments);
if (ref.typeArguments && typeName === "Hash") {
Expand Down
2 changes: 1 addition & 1 deletion src/tests/code-generator-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe("CodeGenerator", () => {
describe("should transpile literals", () => {
it("basic datatypes", () => {
testGenerate("69.420").should.equal("69.42");
testGenerate("'hello world!'").should.equal('"hello world!"');
testGenerate("'hello world!'").should.equal("'hello world!'");
testGenerate("false && true").should.equal('false && true');
});
it("arrays", () => {
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
"skipLibCheck": true, /* Skip library checks. */

/* Type Checking */
"strict": true /* Enable all strict type-checking options. */
Expand Down

0 comments on commit 0b9bd11

Please sign in to comment.