export function createElement<K extends keyof HTMLElementTagNameMap>(
  tagName: K,
  {
    style,
    children,
    ...attributes
  }: Omit<Partial<HTMLElementTagNameMap[K]>, "style"> & {
    style?: React.CSSProperties
    children?: (string | Node)[]
  },
) {
  const element = document.createElement(tagName)
  if (attributes) {
    Object.assign(element, attributes)
  }
  if (style) {
    Object.assign(element.style, style)
  }
  if (children) {
    element.append(...children)
  }
  return element
}
