(key: keyof TParams, value: TParams[keyof TParams])
| 34 | } |
| 35 | |
| 36 | set(key: keyof TParams, value: TParams[keyof TParams]) { |
| 37 | //check it matches the schema |
| 38 | const newParams = { ...this.params, [key]: value }; |
| 39 | const result = parseSearchParams(newParams, this.schema); |
| 40 | |
| 41 | if (!result.success) { |
| 42 | return { success: false, error: result.error }; |
| 43 | } |
| 44 | |
| 45 | this.params = newParams; |
| 46 | return { success: true }; |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | type SearchParamsResult<TParams extends ParamType> = |
no test coverage detected