diff --git a/.changeset/mail-react-strict-mode.md b/.changeset/mail-react-strict-mode.md new file mode 100644 index 00000000000..827a04aa769 --- /dev/null +++ b/.changeset/mail-react-strict-mode.md @@ -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`. diff --git a/packages/mail-react/src/components/text/HtmlText.tsx b/packages/mail-react/src/components/text/HtmlText.tsx index 6f560fcf538..dd7f2ec88d9 100644 --- a/packages/mail-react/src/components/text/HtmlText.tsx +++ b/packages/mail-react/src/components/text/HtmlText.tsx @@ -43,7 +43,6 @@ interface HtmlTextImplementationProps extends HtmlTextOwnProps { className?: string; style?: CSSProperties; children?: ReactNode; - [key: string]: unknown; } export type HtmlTextProps = HtmlTextOwnProps & { diff --git a/packages/mail-react/src/storybook/MjmlWarningsPanel.tsx b/packages/mail-react/src/storybook/MjmlWarningsPanel.tsx index cda7fb9ef34..33c98fc59d1 100644 --- a/packages/mail-react/src/storybook/MjmlWarningsPanel.tsx +++ b/packages/mail-react/src/storybook/MjmlWarningsPanel.tsx @@ -27,21 +27,23 @@ export function MjmlWarningsPanel({ active }: { active: boolean }) { return ( - {renderResult && ( -
- {renderResult.mjmlWarnings.length === 0 ? ( -

✓ No MJML warnings

- ) : ( -
    - {renderResult.mjmlWarnings.map((warning, index) => ( -
  • - {warning.tagName} (line {warning.line}): {warning.message} -
  • - ))} -
- )} -
- )} + + {renderResult && ( +
+ {renderResult.mjmlWarnings.length === 0 ? ( +

✓ No MJML warnings

+ ) : ( +
    + {renderResult.mjmlWarnings.map((warning, index) => ( +
  • + {warning.tagName} (line {warning.line}): {warning.message} +
  • + ))} +
+ )} +
+ )} +
); } diff --git a/packages/mail-react/tsconfig.json b/packages/mail-react/tsconfig.json index 0e4fb778f69..316920064e8 100644 --- a/packages/mail-react/tsconfig.json +++ b/packages/mail-react/tsconfig.json @@ -5,6 +5,7 @@ "moduleResolution": "NodeNext", "outDir": "lib", "rootDir": "src", + "strict": true, "target": "ES2022" }, "exclude": ["node_modules", "lib"],