@@ -2,6 +2,8 @@ import React from "react";
22import { Box , Text , useInput } from "ink" ;
33import TextInput from "ink-text-input" ;
44import figures from "figures" ;
5+ import type { DevboxCreateParams , DevboxView } from "@runloop/api-client/resources/devboxes/devboxes" ;
6+ import type { LaunchParameters } from "@runloop/api-client/resources/shared" ;
57import { getClient } from "../utils/client.js" ;
68import { SpinnerComponent } from "./Spinner.js" ;
79import { ErrorMessage } from "./ErrorMessage.js" ;
@@ -13,7 +15,7 @@ import { useExitOnCtrlC } from "../hooks/useExitOnCtrlC.js";
1315
1416interface DevboxCreatePageProps {
1517 onBack : ( ) => void ;
16- onCreate ?: ( devbox : any ) => void ;
18+ onCreate ?: ( devbox : DevboxView ) => void ;
1719 initialBlueprintId ?: string ;
1820}
1921
@@ -77,7 +79,7 @@ export const DevboxCreatePage = ({
7779 > ( null ) ;
7880 const [ selectedMetadataIndex , setSelectedMetadataIndex ] = React . useState ( - 1 ) ; // -1 means "add new" row
7981 const [ creating , setCreating ] = React . useState ( false ) ;
80- const [ result , setResult ] = React . useState < any > ( null ) ;
82+ const [ result , setResult ] = React . useState < DevboxView | null > ( null ) ;
8183 const [ error , setError ] = React . useState < Error | null > ( null ) ;
8284
8385 const baseFields : Array < {
@@ -122,7 +124,7 @@ export const DevboxCreatePage = ({
122124
123125 const fields = [ ...baseFields , ...customFields , ...remainingFields ] ;
124126
125- const architectures = [ "arm64" , "x86_64" ] ;
127+ const architectures = [ "arm64" , "x86_64" ] as const ;
126128 const resourceSizes = [
127129 "X_SMALL" ,
128130 "SMALL" ,
@@ -131,7 +133,7 @@ export const DevboxCreatePage = ({
131133 "X_LARGE" ,
132134 "XX_LARGE" ,
133135 "CUSTOM_SIZE" ,
134- ] ;
136+ ] as const ;
135137
136138 const currentFieldIndex = fields . findIndex ( ( f ) => f . key === currentField ) ;
137139
@@ -318,13 +320,16 @@ export const DevboxCreatePage = ({
318320 architecture : architectures [ newIndex ] as "arm64" | "x86_64" ,
319321 } ) ;
320322 } else if ( currentField === "resource_size" ) {
321- const currentIndex = resourceSizes . indexOf ( formData . resource_size ) ;
323+ // Find current index, defaulting to 0 if not found (e.g., empty string)
324+ const currentSize = formData . resource_size || "SMALL" ;
325+ const currentIndex = resourceSizes . indexOf ( currentSize as typeof resourceSizes [ number ] ) ;
326+ const safeIndex = currentIndex === - 1 ? 0 : currentIndex ;
322327 const newIndex = key . leftArrow
323- ? Math . max ( 0 , currentIndex - 1 )
324- : Math . min ( resourceSizes . length - 1 , currentIndex + 1 ) ;
328+ ? Math . max ( 0 , safeIndex - 1 )
329+ : Math . min ( resourceSizes . length - 1 , safeIndex + 1 ) ;
325330 setFormData ( {
326331 ...formData ,
327- resource_size : resourceSizes [ newIndex ] as any ,
332+ resource_size : resourceSizes [ newIndex ] ,
328333 } ) ;
329334 }
330335 return ;
@@ -387,7 +392,7 @@ export const DevboxCreatePage = ({
387392 try {
388393 const client = getClient ( ) ;
389394
390- const launchParameters : any = { } ;
395+ const launchParameters : LaunchParameters = { } ;
391396
392397 if ( formData . architecture ) {
393398 launchParameters . architecture = formData . architecture ;
@@ -412,7 +417,7 @@ export const DevboxCreatePage = ({
412417 ) ;
413418 }
414419
415- const createParams : any = { } ;
420+ const createParams : DevboxCreateParams = { } ;
416421
417422 if ( formData . name ) {
418423 createParams . name = formData . name ;
0 commit comments