fix: add missing typescript export for init args #510
Merged
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.
Overview
The JavaScript bindings generated by Candid include an
init
function that can prepare the IDL object necessary to encode init args. There is no corresponding export on the TypeScript bindings so TypeScript will complain when trying to import this function.Requirements
The TypeScript bindings should match the JavaScript bindings and export the
init
function.Considered Solutions
This can be worked around on the developer side by adding a custom declaration file.
Recommended Solution
I recommend to add this to Candid's declaration generation so it's not necessary to workaround on the developer side.
Considerations
This will have no impact on security or performance.
It is not a breaking change because it's only adding a new exported type.
Maintenance cost should be minimal on this.