Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/mail-react-strict-mode.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@dextinity/mail-react": patch
---

Type the return value of `OneOfBlock` and `OptionalBlock` as nullable

Both components already returned `null` (when no block is selected, respectively when the optional block is hidden), but the emitted types claimed they always return an element. They now include `null`.
1 change: 0 additions & 1 deletion packages/mail-react/src/components/text/HtmlText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ interface HtmlTextImplementationProps extends HtmlTextOwnProps {
className?: string;
style?: CSSProperties;
children?: ReactNode;
[key: string]: unknown;
Comment thread
VPS-thodax marked this conversation as resolved.
}

export type HtmlTextProps<E extends keyof JSX.IntrinsicElements = "td"> = HtmlTextOwnProps & {
Expand Down
32 changes: 17 additions & 15 deletions packages/mail-react/src/storybook/MjmlWarningsPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,23 @@ export function MjmlWarningsPanel({ active }: { active: boolean }) {

return (
<AddonPanel active={active}>
{renderResult && (
<div style={{ padding: 16 }}>
{renderResult.mjmlWarnings.length === 0 ? (
<p style={{ color: "green" }}>✓ No MJML warnings</p>
) : (
<ul style={{ margin: 0, padding: 0, listStyle: "none" }}>
{renderResult.mjmlWarnings.map((warning, index) => (
<li key={index} style={{ marginBottom: 8 }}>
<strong>{warning.tagName}</strong> (line {warning.line}): {warning.message}
</li>
))}
</ul>
)}
</div>
)}
<React.Fragment>
{renderResult && (
<div style={{ padding: 16 }}>
{renderResult.mjmlWarnings.length === 0 ? (
<p style={{ color: "green" }}>✓ No MJML warnings</p>
) : (
<ul style={{ margin: 0, padding: 0, listStyle: "none" }}>
{renderResult.mjmlWarnings.map((warning, index) => (
<li key={index} style={{ marginBottom: 8 }}>
<strong>{warning.tagName}</strong> (line {warning.line}): {warning.message}
</li>
))}
</ul>
)}
</div>
)}
</React.Fragment>
</AddonPanel>
);
}
Expand Down
1 change: 1 addition & 0 deletions packages/mail-react/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"moduleResolution": "NodeNext",
"outDir": "lib",
"rootDir": "src",
"strict": true,
"target": "ES2022"
},
"exclude": ["node_modules", "lib"],
Expand Down
Loading