Skip to content

Commit b185cd4

Browse files
committed
tiding: lint suggestions
1 parent 0791091 commit b185cd4

3 files changed

Lines changed: 4 additions & 10 deletions

File tree

src/api/builder.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,7 @@ import { Python, type PythonGeneratorOptions } from "@root/api/writer-generator/
1414
import { generateTypeSchemas } from "@root/typeschema";
1515
import { registerFromManager } from "@root/typeschema/register";
1616
import { mkTypeSchemaIndex, type TreeShake, type TypeSchemaIndex, treeShake } from "@root/typeschema/utils";
17-
import {
18-
extractNameFromCanonical,
19-
npmToPackageMeta,
20-
packageMetaToFhir,
21-
packageMetaToNpm,
22-
type TypeSchema,
23-
} from "@typeschema/types";
17+
import { extractNameFromCanonical, packageMetaToFhir, packageMetaToNpm, type TypeSchema } from "@typeschema/types";
2418
import type { TypeSchemaConfig } from "../config";
2519
import { CodegenLogger, createLogger } from "../utils/codegen-logger";
2620
import { TypeScript, type TypeScriptOptions } from "./writer-generator/typescript";

src/api/writer-generator/python/python.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ export class Python extends Writer {
421421
}
422422

423423
private generateFields(schema: RegularTypeSchema): void {
424-
const sortedFields = Object.entries(schema.fields!).sort(([a], [b]) => a.localeCompare(b));
424+
const sortedFields = Object.entries(schema.fields ?? []).sort(([a], [b]) => a.localeCompare(b));
425425

426426
for (const [fieldName, field] of sortedFields) {
427427
if ("choices" in field && field.choices) continue;

src/api/writer-generator/writer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,8 @@ export abstract class Writer<T extends WriterOptions = WriterOptions> extends Fi
201201
let line = "";
202202

203203
while (remaining.length > 0 && line.length < maxImportLineLength) {
204-
const entity = remaining.shift()!;
204+
const entity = remaining.shift();
205+
if (!entity) throw new Error("Unexpected empty entity");
205206
if (line.length > 0) {
206207
line += ", ";
207208
}
@@ -214,5 +215,4 @@ export abstract class Writer<T extends WriterOptions = WriterOptions> extends Fi
214215

215216
return line;
216217
}
217-
218218
}

0 commit comments

Comments
 (0)