Type assertion on object literals is forbidden, use a type annotation instead.
const [params, setParams] = useState({ valueType: '' } as {
valueType: string
connectingText?: string
})
改为下面的写法就好了
const initParams: {
valueType: string
connectingText?: string
} = { valueType: '' }
const [params, setParams] = useState(initParams)