(
value: string,
setTypedThing: (value: string) => void,
isThing: (thing: any) => boolean,
setTypedClassName: (className: string) => void,
)
| 188 | }; |
| 189 | |
| 190 | const handleJsonThingChange = ( |
| 191 | value: string, |
| 192 | setTypedThing: (value: string) => void, |
| 193 | isThing: (thing: any) => boolean, |
| 194 | setTypedClassName: (className: string) => void, |
| 195 | ) => { |
| 196 | setTypedThing(value); |
| 197 | try { |
| 198 | const object = jsonParse(value); |
| 199 | if (isThing(object)) { |
| 200 | setCurrentThing(() => object); |
| 201 | props.onThingChange(object); |
| 202 | setTypedClassName(''); |
| 203 | } |
| 204 | } catch { |
| 205 | setTypedClassName('invalid'); |
| 206 | } |
| 207 | }; |
| 208 | |
| 209 | const handleTypeChange = () => { |
| 210 | if (!props.hasSchema?.()) { |
no outgoing calls
no test coverage detected
searching dependent graphs…