(field: string)
| 115 | |
| 116 | // } |
| 117 | function useSettingsField(field: string) { |
| 118 | const hook = useContext(SettingsValuesContext) |
| 119 | if (!hook) { |
| 120 | throw new Error("no settings context") |
| 121 | } |
| 122 | |
| 123 | const error = hook.getFieldError(field) |
| 124 | const value = hook.getFieldValue(field) |
| 125 | const setter = (value: any) => hook.setFieldValue(field, value) |
| 126 | |
| 127 | return { |
| 128 | value, |
| 129 | error, |
| 130 | setValue: setter, |
| 131 | } |
| 132 | } |
| 133 | |
| 134 | function stripUnknownFields(script: Script): SettingsOptionValue[] { |
| 135 | const clone = [] |
no test coverage detected