We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ref:
typed-html/src/jsx/element-types.d.ts
Line 150 in 88a6a62
As this is a string|undefined, it denotes required or not defined as per html spec... but... If you pass in undefined the following error occurs:
string|undefined
required
undefined
typed-html/src/elements.tsx
Line 66 in 88a6a62
TypeError: Cannot read properties of undefined (reading 'toString')
2 step recommendation:
required?: string;
required?: boolean;
return makeAttribute(escapeAttrNodeValue(value.toString()));
To:
return makeAttribute(value !== undefined && value !== null && typeof value.toString === 'function' ? escapeAttrNodeValue(value.toString()) : '');
const attributeToString = (attributes: Attributes) => (name: string): string => { const value = attributes[name]; const formattedName = toKebabCase(name); const makeAttribute = (value: string) => `${formattedName}="${value}"`; if (typeof value === 'undefined') { return ''; } if (value instanceof Date) { return makeAttribute(value.toISOString()); } else switch (typeof value) { case 'boolean': // https://www.w3.org/TR/2008/WD-html5-20080610/semantics.html#boolean if (value) { return formattedName; } else { return ''; } default: return makeAttribute(escapeAttrNodeValue(value.toString())); } };
Happy to push a PR for this, let me know.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Ref:
typed-html/src/jsx/element-types.d.ts
Line 150 in 88a6a62
As this is a
string|undefined
, it denotesrequired
or not defined as per html spec... but...If you pass in
undefined
the following error occurs:typed-html/src/elements.tsx
Line 66 in 88a6a62
2 step recommendation:
typed-html/src/jsx/element-types.d.ts
Line 150 in 88a6a62
From:
required?: string;
To:
required?: boolean;
typed-html/src/elements.tsx
Line 66 in 88a6a62
From:
To:
Happy to push a PR for this, let me know.
The text was updated successfully, but these errors were encountered: