import { SSR } from './SSR' ; type Attributes = { - readonly [ Atttribute in keyof HTMLElement ] ? : HTMLElement [ Atttribute ] ; } ; type Tag = keyof HTMLElementTagNameMap ; export function createElement ( tag , attributes ) { if ( SSR ) return null ; const element = document . createElement ( tag ) ; Object . entries ( attributes ) . map ( ( [ attr , value ] ) => ( element [ attr ] = value ) ) ; return element ; }