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,11 +1,13 @@
import { SetVarNameModal } from 'components/SetVarNameModal'
import {
SetVarNameModal,
createSetVarNameModal,
} from 'components/SetVarNameModal'
import { moveValueIntoNewVariable } from 'lang/modifyAst'
import { isNodeSafeToReplace } from 'lang/queryAst'
import { useEffect, useState } from 'react'
import { create } from 'react-modal-promise'
import { useStore } from 'useStore'
const getModalInfo = create(SetVarNameModal as any)
const getModalInfo = createSetVarNameModal(SetVarNameModal)
export function useConvertToVariable() {
const { guiMode, selectionRanges, ast, programMemory, updateAst } = useStore(
@ -37,7 +39,7 @@ export function useConvertToVariable() {
try {
const { variableName } = await getModalInfo({
valueName: 'var',
} as any)
})
const { modifiedAst: _modifiedAst } = moveValueIntoNewVariable(
ast,