Minimal fixes for type declarations to resolve errors when importing transformers.js via typescript (partially resolves #1093) #1122
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hey; I hope the holiday season is treating you well.
As of 3.1.0,
transformers.js
will result in errors when importing it via typescript (see #1093). Some of these errors are due to limitations in how typescript interprets jsdoc type declarations, and some are architectural design issues with how subclasses extending from a parent class can have methods with differing call/return signatures. (See attached error log below).I notice #1081 is still open - that PR would make errors like this more visible, but it's still yet to be merged, and that's fine (there's a lot of changes in there to review, so I understand the wait).
In the mean time, I've applied the minimum possible fix without resorting to
@ts-ignore
and without any changes to architecture/design to at least get transformers.js usable via typescript.This only partially resolves #1093, because the other errors they report with HTML elements not being found are partially issues with their own typescript config - they should add "DOM" to "lib" in their tsconfig (or transfomers.js should provide duck typed shims for HTMLCanvasElement, etc. but this is out of scope of this minimal fix PR).
Thanks!