File tree 1 file changed +7
-14
lines changed 1 file changed +7
-14
lines changed Original file line number Diff line number Diff line change @@ -361,31 +361,24 @@ function rustArtifactGraphToMap(
361
361
return map
362
362
}
363
363
364
- // TODO: In the future, make the parameter be a KclValue.
365
364
export function sketchFromKclValueOptional (
366
- obj : any ,
365
+ obj : KclValue | undefined ,
367
366
varName : string | null
368
367
) : Sketch | Reason {
369
- if ( obj ?. value ?. type === 'Sketch' ) return obj . value
370
- if ( obj ?. value ?. type === 'Solid' ) return obj . value . sketch
371
368
if ( obj ?. type === 'Sketch' ) return obj . value
372
369
if ( obj ?. type === 'Solid' ) return obj . value . sketch
373
370
if ( ! varName ) {
374
371
varName = 'a KCL value'
375
372
}
376
- const actualType = obj ?. value ?. type ?? obj ?. type
377
- if ( actualType ) {
378
- return new Reason (
379
- `Expected ${ varName } to be a sketch or solid, but it was ${ actualType } instead.`
380
- )
381
- } else {
382
- return new Reason ( `Expected ${ varName } to be a sketch, but it wasn't.` )
383
- }
373
+
374
+ const actualType = obj ?. type ?? 'unknown'
375
+ return new Reason (
376
+ `Expected ${ varName } to be a sketch or solid, but it was ${ actualType } instead.`
377
+ )
384
378
}
385
379
386
- // TODO: In the future, make the parameter be a KclValue.
387
380
export function sketchFromKclValue (
388
- obj : any ,
381
+ obj : KclValue | undefined ,
389
382
varName : string | null
390
383
) : Sketch | Error {
391
384
const result = sketchFromKclValueOptional ( obj , varName )
You can’t perform that action at this time.
0 commit comments