-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
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
Fixes #8: Migrate code base to TypeScript #9
Conversation
Although, to be fair, manually importing from package files instead of the package itself is kind of like using private APIs and you really have to expect that to break in future versions. Eh, anyway. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good :)
// The `marginTop` is missing in the type definitions. | ||
type PdfMakeSignature = (ContentText | ContentImage) & { marginTop: number }; | ||
|
||
const _parseTags = (content: string) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could use a return type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anything wrong with the inferred type? Looks fine to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the code to be expressive actually.
} | ||
|
||
/** Render the letter as a string, used e.g. for emails. */ | ||
toString() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This also (even though it is obvious).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here. TS infers string
just fine. I'm not a big fan of being unnecessarily explicit with types when TS can infer them correctly.
This results in a (slight) external API change: `website` previously did imports like this: ```js import { formatAddress, stripTags } from 'letter-generator/utility'; import Letter from 'letter-generator/Letter'; import Template from 'letter-generator/Template'; ``` We don't support that anymore, you now need to import like this: ```js import { Letter, Template, formatAddress, stripTags } from 'letter-generator'; ``` So, I think it would make sense to start a new major version for this.
8ce4492
to
eb2cb55
Compare
This results in a (slight) external API change:
website
previously did imports like this:We don't support that anymore, you now need to import like this:
So, I think it would make sense to start a new major version for this.