Improve Prop Typings for Modals. Remove instances of any. (#792)

* Update typings for modals. Remove instances of `any`

* Fix generic type for creating modals
This commit is contained in:
Jason Rametta
2023-10-06 16:34:21 -04:00
committed by GitHub
parent 89b880d9ae
commit 629f326f4c
9 changed files with 210 additions and 130 deletions

View File

@ -1,5 +1,4 @@
import { useState, useEffect } from 'react'
import { create } from 'react-modal-promise'
import { toolTips, useStore } from '../../useStore'
import { BinaryPart, Value, VariableDeclarator } from '../../lang/wasm'
import {
@ -12,12 +11,12 @@ import {
transformSecondarySketchLinesTagFirst,
getTransformInfos,
} from '../../lang/std/sketchcombos'
import { GetInfoModal } from '../SetHorVertDistanceModal'
import { GetInfoModal, createInfoModal } from '../SetHorVertDistanceModal'
import { createVariableDeclaration } from '../../lang/modifyAst'
import { removeDoubleNegatives } from '../AvailableVarsHelpers'
import { updateCursors } from '../../lang/util'
const getModalInfo = create(GetInfoModal as any)
const getModalInfo = createInfoModal(GetInfoModal)
export const SetAngleBetween = () => {
const { guiMode, selectionRanges, ast, programMemory, updateAst, setCursor } =
@ -95,20 +94,19 @@ export const SetAngleBetween = () => {
variableName,
newVariableInsertIndex,
sign,
}: {
segName: string
value: number
valueNode: Value
variableName?: string
newVariableInsertIndex: number
sign: number
} = await getModalInfo({
segName: tagInfo?.tag,
isSegNameEditable: !tagInfo?.isTagExisting,
value: valueUsedInTransform,
initialVariableName: 'angle',
} as any)
if (segName === tagInfo?.tag && value === valueUsedInTransform) {
})
if (
segName === tagInfo?.tag &&
value ===
(valueUsedInTransform === undefined
? ''
: String(Math.abs(valueUsedInTransform)))
) {
updateAst(modifiedAst, true, {
callBack: updateCursors(setCursor, selectionRanges, pathToNodeMap),
})