Skip to content

Commit

Permalink
klass generator nonstatic
Browse files Browse the repository at this point in the history
  • Loading branch information
asarazan committed Apr 29, 2024
1 parent e3886c4 commit 8806339
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/martok/declarations/DeclarationGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class DeclarationGenerator {

private generateDeclaration(node: Statement): (Klass | string)[] {
try {
if (!KlassGenerator.isSupportedDeclaration(node)) {
if (!this.klasses.isSupportedDeclaration(node)) {
return [];
}
const result = [this.klasses.generate(node)];
Expand Down
8 changes: 3 additions & 5 deletions src/martok/declarations/KlassGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,7 @@ export class KlassGenerator {
this.tagged = new TaggedUnionGenerator(this.martok);
}

public static isSupportedDeclaration(
node: Node
): node is SupportedDeclaration {
public isSupportedDeclaration(node: Node): node is SupportedDeclaration {
return (
isTypeAliasDeclaration(node) ||
isInterfaceDeclaration(node) ||
Expand Down Expand Up @@ -96,7 +94,7 @@ export class KlassGenerator {
}
try {
let name = options?.forceName;
if (!name && KlassGenerator.isSupportedDeclaration(node)) {
if (!name && this.isSupportedDeclaration(node)) {
name = node.name.escapedText.toString()!;
}
if (!name) {
Expand Down Expand Up @@ -250,7 +248,7 @@ export class KlassGenerator {
if (isPropertySignature(value)) {
return this.generateProperty(value);
}
if (KlassGenerator.isSupportedDeclaration(value)) {
if (this.isSupportedDeclaration(value)) {
return this.generate(value) as Klass;
}

Check warning on line 253 in src/martok/declarations/KlassGenerator.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement

Check warning on line 253 in src/martok/declarations/KlassGenerator.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🌿 Branch is not covered

Warning! Not covered branch
throw new Error(`Can't handle inner type ${value.kind}`);
Expand Down
6 changes: 3 additions & 3 deletions src/martok/processing/ZodProcessor.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import ts from "typescript";
import ts, { isVariableStatement } from "typescript";
import { Martok } from "../Martok";

export class ZodProcessor {
Expand All @@ -8,7 +8,7 @@ export class ZodProcessor {
return file.fileName.includes("/martok/node_modules/zod/lib/");
}

public isZodDeclaration(): boolean {
return true;
public isZodStatement(node: ts.Node): boolean {

Check warning on line 11 in src/martok/processing/ZodProcessor.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🕹️ Function is not covered

Warning! Not covered function
return true; // TODO

Check warning on line 12 in src/martok/processing/ZodProcessor.ts

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement
}
}

0 comments on commit 8806339

Please sign in to comment.