chore(cli): migrate JS files to TypeScript#1944
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
👷 Deploy request for cedarjs pending review.Visit the deploys page to approve it
|
|
| Command | Status | Duration | Result |
|---|---|---|---|
nx run-many -t build:pack --exclude create-ceda... |
✅ Succeeded | <1s | View ↗ |
nx run-many -t build |
✅ Succeeded | 8s | View ↗ |
nx run-many -t test --minWorkers=1 --maxWorkers=4 |
✅ Succeeded | 1m 15s | View ↗ |
nx run-many -t test:types |
✅ Succeeded | 7s | View ↗ |
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗
☁️ Nx Cloud last updated this comment at 2026-06-18 20:13:54 UTC
|
| Command | Status | Duration | Result |
|---|---|---|---|
nx run-many -t build |
✅ Succeeded | 5s | View ↗ |
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗
☁️ Nx Cloud last updated this comment at 2026-06-18 00:10:39 UTC
1 similar comment
|
| Command | Status | Duration | Result |
|---|---|---|---|
nx run-many -t build |
✅ Succeeded | 5s | View ↗ |
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗
☁️ Nx Cloud last updated this comment at 2026-06-18 00:10:39 UTC
Greptile SummaryMigrates 10 CLI JavaScript files to TypeScript with minimal, non-breaking changes — adding structural interfaces for Prisma field shapes and Listr task params, narrowing catch blocks to
Confidence Score: 5/5Safe to merge — this is a type-annotation-only migration with no intentional logic changes and no modified runtime paths for production code. All ten files add types without altering control flow. The catch-block narrowing and composite-FK fix are strict improvements. The only behavioral change found is in test-data generation for BigInt Prisma fields, which was already broken in the original JS (runtime TypeError); the migration converts that crash into a silent no-op, which is noted as a suggestion. serviceHandler.ts — the BigInt update-value encoding path; sdlHandler.ts — worth a final tsc --noEmit pass to confirm the previous thread's strict-mode issues are fully resolved. Important Files Changed
Reviews (6): Last reviewed commit: "fix(cli): remove all remaining `as` type..." | Re-trigger Greptile |
Add ModelSchema/ModelSchemaField interfaces, fix idType return type, and resolve strict-mode errors flagged by Greptile review. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…s in sdl/service handlers Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- sdlHandler: remove unnecessary `as ModelSchema` cast (types is Record<string,ModelSchema>)
- sdlHandler: use optional chain `idField?.default` instead of `idField && idField.default`
- sdlHandler: use `includes()` instead of `indexOf() === -1`
- sdlHandler: use `ModelSchemaField[]` array syntax instead of `Array<ModelSchemaField>`
- sdlHandler: widen `idType` return type cast from narrow inline type to `ModelSchemaField[]`
- serviceHandler: use `{ name; dbName? }[]` array syntax instead of `Array<{...}>`
- serviceHandler: change `let scalarFields` to `const` (never reassigned)
- jobHandler: use optional catch binding `catch { }` instead of `catch (_e)`
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- buildPackagesTask: `w.split('/').at(-1) ?? ''` instead of `as string`;
`instanceof Error` + `'stderr' in e` narrowing for execa errors
- setupOpentelemetryHandler/setupRscHandler/jobHandler/realtimeHandler/
uploadsHandler: `instanceof Error` + exitCode narrowing in all catch blocks
- setupRscHandler: extract `entryClient = rwPaths.web.entryClient ?? ''`
(non-null guaranteed by 'Check prerequisites' task that throws if null)
- filesTask: `Promise.resolve<Record<string, string>>({})` generic form
- realtimeHandler: `return incl ?? false` instead of `as boolean`
- sdlHandler: replace `idType() as string` with `typeof resolvedType === 'string'`
guard — also fixes silent `field.type = undefined` corruption from original JS
- sdlHandler: replace `as ModelSchemaField[]` cast with `.filter((f): f is
ModelSchemaField => f !== undefined)` — undefined elements now filtered
rather than hidden by the cast
- serviceHandler: `typeof value === 'bigint/number/string'` narrowing in switch
cases instead of `newValue as T` casts
- serviceHandler: `Array.isArray(fieldName)` guard + `Object.fromEntries` for
composite FK case instead of `fieldName as string` cast
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Summary
Migrates 10 JavaScript files in
packages/cli/src/to TypeScript. Each file was given appropriate types while keeping changes minimal — no logic changes, no refactoring.Files migrated
commands/build/buildPackagesTask.tstaskparam with structural type; catch error asunknowncommands/experimental/setupOpentelemetryHandler.tscommands/experimental/setupRscHandler.tsfilesvar tocssFilesto avoid shadowingcommands/generate/job/jobHandler.tsfiles()andhandler()params; typed catch blockscommands/generate/package/filesTask.tsfiles()commands/generate/sdl/sdlHandler.tscommands/generate/service/serviceHandler.tsPrismaFieldinterface; typed scenario/field helperscommands/setup/realtime/addRealtimeToGraphql.tsctxandtaskparamscommands/setup/realtime/realtimeHandler.tshandlerargs and internal callbackscommands/setup/uploads/uploadsHandler.tsType decisions
ListrTasktypes, to stay lightweightPrismaFieldinterface inserviceHandler.tsandsdlHandler.tsfor the Prisma DMMF field shape used throughoute as { message: string; exitCode?: number }— consistent with rest of the codebasebuildPackagesTask'staskparam uses a structural type since it's a Listr task context passed at runtime🤖 Generated with Claude Code