{"record":{"id":"f5265d2cda18e19e","repo":"ianstormtaylor/slate","slug":"properties-specified-for-a-hyperscript-shorthand-s","errorCode":null,"errorMessage":"Properties specified for a hyperscript shorthand should be an object, but for the custom element <${tagName}>  tag you passed: ${props}","messagePattern":"Properties specified for a hyperscript shorthand should be an object, but for the custom element <(.+?)>  tag you passed: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/slate-hyperscript/src/hyperscript.ts","lineNumber":114,"sourceCode":"    const ret = creator(tagName, attributes, children)\n    return ret\n  }\n\n  return jsx\n}\n\n/**\n * Normalize a dictionary of element shorthands into creator functions.\n */\n\nconst normalizeElements = (elements: HyperscriptShorthands) => {\n  const creators: HyperscriptCreators<Element> = {}\n\n  for (const tagName in elements) {\n    const props = elements[tagName]\n\n    if (typeof props !== 'object') {\n      throw new Error(\n        `Properties specified for a hyperscript shorthand should be an object, but for the custom element <${tagName}>  tag you passed: ${props}`\n      )\n    }\n\n    creators[tagName] = (\n      tagName: string,\n      attributes: { [key: string]: any },\n      children: any[]\n    ) => {\n      return createElement('element', { ...props, ...attributes }, children)\n    }\n  }\n\n  return creators\n}\n\nexport { createHyperscript, HyperscriptCreators, HyperscriptShorthands }\n","sourceCodeStart":96,"sourceCodeEnd":132,"githubUrl":"https://github.com/ianstormtaylor/slate/blob/72a37c701e5da4bb13a305d416d9c070d19d3a45/packages/slate-hyperscript/src/hyperscript.ts#L96-L132","documentation":"Thrown by normalizeElements in createHyperscript when a custom element shorthand maps a tag name to a non-object value. Each entry of the elements option must be a props object merged into the created element.","triggerScenarios":"Passing elements: { block: 'paragraph' } (a string) or elements: { block: null / 42 } to createHyperscript instead of elements: { block: { type: 'paragraph' } }.","commonSituations":"Confusing the elements shorthand format (assuming a string type is accepted); copy-pasting config from older hyperscript examples; passing arrays or undefined values.","solutions":["Change every elements entry to a plain object of props, e.g. { type: 'paragraph' }","If you need full control, provide a creator function via creators instead of elements","Verify no entry is null/undefined/string/number before creating the hyperscript"],"exampleFix":"// before\nconst jsx = createHyperscript({ elements: { block: 'paragraph' } })\n// after\nconst jsx = createHyperscript({ elements: { block: { type: 'paragraph' } } })","handlingStrategy":"type-guard","validationCode":"for (const [tag, props] of Object.entries(elements)) {\n  if (typeof props !== 'object' || props === null || Array.isArray(props)) {\n    throw new Error(`elements.${tag} must be a props object, got ${typeof props}`)\n  }\n}","typeGuard":"const isElementProps = (p: unknown): p is Record<string, unknown> =>\n  typeof p === 'object' && p !== null && !Array.isArray(p)","tryCatchPattern":"null","preventionTips":["Use object props for every elements entry: { type: 'paragraph' }","Provide creator functions for advanced cases","Centralize hyperscript config in one module and type it"],"tags":["slate","hyperscript","config","elements"],"backgroundTag":"hyperscript-invalid-elements-config","analyzedSha":"72a37c701e5da4bb13a305d416d9c070d19d3a45","analyzedAt":"2026-08-27T23:04:51.145Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}