shellscape / jsx-email

Build emails with a delightful DX
https://jsx.email
MIT License
902 stars 28 forks source link

Infer TemplateProps & optinal props #63

Closed sysmat closed 7 months ago

sysmat commented 8 months ago

Documentation Is:

Please Explain in Detail...

import { defaulted, number, object, string, type Infer } from 'superstruct';
export const TemplateStruct = object({
  email: defaulted(string(), 'batman@example.com'),
  name: defaulted(string(), 'Bruce Wayne')
});

export type TemplateProps = Infer<typeof TemplateStruct>;
export const Template = ({ email, name }: TemplateProps) => (
}
import { Template as  BatmanTemplate} from './emails/BatmanEmail';

const html = render(<BatmanTemplate email="Bruce" name="Wayne" />);

Your Proposal for Changes

shellscape commented 8 months ago

Sorry, not following you on this one.

shellscape commented 7 months ago

Closing this one as abandoned. Please ping if you'd like it reopened. For anyone who runs across this issue, superstruct has an optional that can be wrapped around any optional properties on props.

sysmat commented 7 months ago

const html = render(<BatmanTemplate email="Bruce" />); then name should be 'Bruce Wayne' but is not

shellscape commented 7 months ago

@sysmat would you like to put together a reproduction? I'm afraid I'm still not understanding you.

https://stackblitz.com/fork/jsx-email-repro

sysmat commented 7 months ago