refactor(types): remove any usages and strengthen typings across web and base (#26677)
This commit is contained in:
@@ -120,7 +120,7 @@ const JsonSchemaConfig: FC<JsonSchemaConfigProps> = ({
|
||||
setJson(JSON.stringify(schema, null, 2))
|
||||
}, [currentTab])
|
||||
|
||||
const handleSubmit = useCallback((schema: any) => {
|
||||
const handleSubmit = useCallback((schema: Record<string, unknown>) => {
|
||||
const jsonSchema = jsonToSchema(schema) as SchemaRoot
|
||||
if (currentTab === SchemaView.VisualEditor)
|
||||
setJsonSchema(jsonSchema)
|
||||
|
||||
@@ -152,14 +152,16 @@ const EditCard: FC<EditCardProps> = ({
|
||||
}, [isAdvancedEditing, emitPropertyOptionsChange, currentFields])
|
||||
|
||||
const handleAdvancedOptionsChange = useCallback((options: AdvancedOptionsType) => {
|
||||
let enumValue: any = options.enum
|
||||
if (enumValue === '') {
|
||||
let enumValue: SchemaEnumType | undefined
|
||||
if (options.enum === '') {
|
||||
enumValue = undefined
|
||||
}
|
||||
else {
|
||||
enumValue = options.enum.replace(/\s/g, '').split(',')
|
||||
const stringArray = options.enum.replace(/\s/g, '').split(',')
|
||||
if (currentFields.type === Type.number)
|
||||
enumValue = (enumValue as SchemaEnumType).map(value => Number(value)).filter(num => !Number.isNaN(num))
|
||||
enumValue = stringArray.map(value => Number(value)).filter(num => !Number.isNaN(num))
|
||||
else
|
||||
enumValue = stringArray
|
||||
}
|
||||
setCurrentFields(prev => ({ ...prev, enum: enumValue }))
|
||||
if (isAdvancedEditing) return
|
||||
|
||||
Reference in New Issue
Block a user