Fix: Center rectangle now works again, works with new LiteralValue structure (#5172)
* fix: new Literal data structure update * fix: updated the LiteralValue dereferencing and added some type narrowing helpers * fix: updating formatting * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * fix: implementing a safer dereference method until we update createLiteraly() * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * why is this fallback here * fix: updating the type narrowing function * fix: restore this... see if snapshots trigger again * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * bump * bump * Add number with units formatting as KCL (#5195) * Add number with units formatting as KCL * Change type assertion helper to check what we need * Fix rectangle unit test * fix: adding a wait for execution to prevent clicking before lines are rendered --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
This commit is contained in:
@ -6,6 +6,8 @@ import {
|
||||
ArrayExpression,
|
||||
BinaryExpression,
|
||||
ArtifactGraph,
|
||||
LiteralValue,
|
||||
NumericSuffix,
|
||||
} from './wasm'
|
||||
import { filterArtifacts } from 'lang/std/artifactGraph'
|
||||
import { isOverlap } from 'lib/utils'
|
||||
@ -69,3 +71,15 @@ export function isLiteral(e: any): e is Literal {
|
||||
export function isBinaryExpression(e: any): e is BinaryExpression {
|
||||
return e && e.type === 'BinaryExpression'
|
||||
}
|
||||
|
||||
export function isLiteralValueNumber(
|
||||
e: LiteralValue
|
||||
): e is { value: number; suffix: NumericSuffix } {
|
||||
return (
|
||||
typeof e === 'object' &&
|
||||
'value' in e &&
|
||||
typeof e.value === 'number' &&
|
||||
'suffix' in e &&
|
||||
typeof e.suffix === 'string'
|
||||
)
|
||||
}
|
||||
|
Reference in New Issue
Block a user