( tool: K, existing?: Partial<ToolPropertiesMap[K]> )
| 178 | * Only the supported fields are returned (i.e. defaults auto-fill only valid fields). |
| 179 | */ |
| 180 | const mergeWithDefaults = <K extends ToolKey>( |
| 181 | tool: K, |
| 182 | existing?: Partial<ToolPropertiesMap[K]> |
| 183 | ): ToolPropertiesMap[K] => { |
| 184 | const defaults = getDefaultForTool(tool) as ToolPropertiesMap[K]; |
| 185 | return { |
| 186 | ...defaults, |
| 187 | ...(existing ?? {}), |
| 188 | } as ToolPropertiesMap[K]; |
| 189 | }; |
| 190 | |
| 191 | /** |
| 192 | * Create the store |
no test coverage detected