Skip to content
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

Export more types to enhance TypeScript support #443

Merged
merged 4 commits into from
Dec 5, 2018
Merged

Export more types to enhance TypeScript support #443

merged 4 commits into from
Dec 5, 2018

Conversation

ntietz
Copy link
Contributor

@ntietz ntietz commented Nov 29, 2018

While using PptxGenJS with TypeScript, I wanted to do something like this:

function addChartToSlide(slide: Slide, chartData: ChartData): void {
  ...
}

With the existing type definitions, type inference works as expected but the Slide type (among others) are not exported and thus are not able to be referenced from client code, making it more difficult to write correct type definitions.

This PR exports all the types defined within the PptxGenJS namespace, while retaining the current behavior (export the PptxGenJS class as the default export).

@gitbrent
Copy link
Owner

gitbrent commented Dec 3, 2018

Hi @ntietz

The current changes are not passing validation:

screen shot 2018-12-03 at 10 58 00

@ntietz
Copy link
Contributor Author

ntietz commented Dec 4, 2018

@gitbrent Good catch. I didn't notice that as I had a problem in my local workflow. This is resolved, and I've verified that no problems were detected locally - for my machine. Thanks for taking the time to check out this PR 😄

I've updated the diff to be smaller, based on a template from the TypeScript Handbook. I think this is cleaner, and results in the same end result: now Slide, CommonOptions, etc. can all be referenced as well to allow more typechecking in client code.

@gitbrent gitbrent added this to the 2.5.0 milestone Dec 5, 2018
@gitbrent gitbrent merged commit 57f0f5e into gitbrent:master Dec 5, 2018
@gitbrent
Copy link
Owner

gitbrent commented Dec 5, 2018

Great work and thanks for the contribution @ntietz !

@ntietz
Copy link
Contributor Author

ntietz commented Dec 5, 2018

Thanks for creating and maintaining this and being responsive!

ericrockey pushed a commit to WeTransfer/PptxGenJS that referenced this pull request Mar 24, 2020
Export more types to enhance TypeScript support
ericrockey pushed a commit to WeTransfer/PptxGenJS that referenced this pull request Mar 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants