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

Update TS definition to reference proper internal libraries #1089

Merged
merged 1 commit into from
Jan 27, 2020

Conversation

jakawell
Copy link
Contributor

Summary

  • Replace empty "Stream" interface with the Node internal "stream.Stream" interface
  • Replace empty "Writable" interface with the Node internal "events.EventEmitter" interface

Notes

When using the library with TypeScript, I noticed that a couple of empty interfaces were causing errors in the TS parsing. I checked the source code and verified the correct internal interfaces so that the typings are accurate.

I know unit tests are required for PRs, but I don't see anywhere in this project that it has unit tests for the TypeScript definition, and I'm not really sure how to do that (or if it would even be useful). Let me know if I'm wrong!

* Replace empty "Stream" interface with the Node internal "stream.Stream" interface
* Replace empty "Writable" interface with the Node internal "events.EventEmitter" interface
@guyonroche
Copy link
Collaborator

@jakawell thanks for the fix.
Regarding tests - I agree it would be useful to have a test that validates the type files. I think it could work by adding typescript, et al, as dev dependencies and having a new flavour "test:typescript" that would only work if the types parsed correctly. I'll see if I can make some that fail before merging this PR

@guyonroche guyonroche merged commit e8a0d2b into exceljs:master Jan 27, 2020
@guyonroche
Copy link
Collaborator

@jakawell - I've made a little progress. I've added a new test folder: spec/typescript with a couple of tests that execute ok but now they fail due to typescript compiler errors.
See: spec/typescript/exceljs.spec.ts - If I change the code to use:
const stream = wb2.xlsx.createInputStream() as any;
the test runs ok, but take away the "as any" and it fails. Do you know what is wrong?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants