{"record":{"id":"00504e4045ea24d3","repo":"angular/angular-cli","slug":"ng-hmr-unknown-input-type-oldelement-type","errorCode":null,"errorMessage":"[NG HMR] Unknown input type ${oldElement.type}.","messagePattern":"\\[NG HMR\\] Unknown input type (.+?)\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/angular_devkit/build_angular/src/tools/webpack/plugins/hmr/hmr-accept.ts","lineNumber":219,"sourceCode":"        case 'month':\n        case 'number':\n        case 'password':\n        case 'range':\n        case 'search':\n        case 'tel':\n        case 'text':\n        case 'textarea':\n        case 'time':\n        case 'url':\n        case 'week':\n          newElement.value = oldElement.value;\n          break;\n        case 'file':\n          // Ignored due: Uncaught DOMException: Failed to set the 'value' property on 'HTMLInputElement':\n          // This input element accepts a filename, which may only be programmatically set to the empty string.\n          break;\n        default:\n          console.warn('[NG HMR] Unknown input type ' + oldElement.type + '.');\n          continue;\n      }\n\n      dispatchEvents(newElement);\n    }\n  } else if (oldInputs.length) {\n    console.warn('[NG HMR] Cannot restore input/textarea values.');\n  }\n\n  // Restore option\n  const newOptions = document.querySelectorAll('option');\n  if (newOptions.length && newOptions.length === oldOptions.length) {\n    console.log('[NG HMR] Restoring selected options.');\n    for (let index = 0; index < newOptions.length; index++) {\n      const newElement = newOptions[index];\n      newElement.selected = oldOptions[index].selected;\n\n      dispatchEvents(newElement);","sourceCodeStart":201,"sourceCodeEnd":237,"githubUrl":"https://github.com/angular/angular-cli/blob/bb72145f9ab45aee29f523236b3a25cd0813a841/packages/angular_devkit/build_angular/src/tools/webpack/plugins/hmr/hmr-accept.ts#L201-L237","documentation":"A console.warn emitted while the Angular CLI HMR helper restores form values after a hot reload. restoreFormValues copies old input values to new inputs, switching on the old element's type attribute. Any input type outside the handled list (button/image/submit/reset, radio/checkbox, common text-ish types, file) falls into default and warns, and that element's value is not restored.","triggerScenarios":"During restoreFormValues: an old input element has a type attribute not covered by the switch — e.g. custom/non-standard type values, new HTML input types added after the list was written, or a typeless input whose type property resolves to 'text' in exotic cases handled differently by the DOM.","commonSituations":"Using newer or exotic input types (e.g. type=\"searchbox\", custom web-component inputs exposing a type property) in forms during HMR; template sets an invalid/empty type attribute; a browser normalizes type differently than the switch expects; very old Angular CLI versions with a shorter supported-type list.","solutions":["Use a standard HTML input type covered by the switch (text, checkbox, radio, password, email, number, date, time, url, tel, search, color, range, month, week, datetime-local, file, button, submit, reset, image).","If the element is not really an input, switch it to a textarea or a custom component so it is not matched by 'input:not([type=\"hidden\"]), textarea'.","Treat the warning as benign for those fields and re-enter the values manually after the HMR update, or disable HMR.","Upgrade the Angular CLI, as the supported type list has been extended over time."],"exampleFix":"<!-- before -->\n<input type=\"fooBar\" name=\"token\">\n<!-- after -->\n<input type=\"text\" name=\"token\">","handlingStrategy":"validation","validationCode":"const SUPPORTED = new Set(['button','image','submit','reset','radio','checkbox','color','date','datetime-local','email','hidden','month','number','password','range','search','tel','text','time','url','week','file','textarea']);\nfor (const el of document.querySelectorAll('input')) {\n  if (!SUPPORTED.has(el.type)) console.warn('Unsupported input type for HMR restore:', el.type);\n}","typeGuard":"function isRestorableInput(el: HTMLInputElement): boolean {\n  return ['button','image','submit','reset','radio','checkbox','color','date','datetime-local','email','hidden','month','number','password','range','search','tel','text','time','url','week'].includes(el.type);\n}","tryCatchPattern":null,"preventionTips":["Stick to standard HTML input type values in templates.","Lint templates for exotic type attributes.","Use custom components instead of repurposed input types.","Keep the Angular CLI updated for extended type support."],"tags":["hmr","angular","forms","dom"],"backgroundTag":"hmr-unsupported-input-type","analyzedSha":"bb72145f9ab45aee29f523236b3a25cd0813a841","analyzedAt":"2026-08-30T02:47:34.745Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}