JavaScript: provide type definitions for TypeScript#578
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds TypeScript type definition generation and packaging for the Emscripten JavaScript bindings, including post-processing to align the generated .d.ts with runtime EM_ASM patches and publishing a separate @opencor/libopencor-types package.
Changes:
- Enable Emscripten
--emit-tsdand post-process the emitted.d.tsduring the build. - Update Embind bindings (smart pointers + safer
EM_ASMpatches) to improve generated typings consistency. - Adjust npm packaging/publishing to ship
libopencor.d.tsand publish a standalone types package.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| VERSION.txt | Version bump for the release containing TypeScript typings. |
| src/CMakeLists.txt | Adds --emit-tsd, post-processing, packaging/copying of .d.ts, and types package packaging logic. |
| src/bindings/javascript/solver.cpp | Adds smart pointer binding + guards EM_ASM patches to reduce runtime/type-gen edge cases. |
| src/bindings/javascript/sed.cpp | Adds smart pointer bindings for additional SED-ML types to improve typings. |
| src/bindings/javascript/postprocess.dts.js | New script to patch/normalize the generated .d.ts. |
| src/bindings/javascript/package.types.in.json | New package template for publishing a standalone types-only package. |
| src/bindings/javascript/package.in.json | Updates npm package metadata/exports to include TypeScript types. |
| src/bindings/javascript/main.cpp | Makes vector prototype patching resilient when specific vector classes are absent. |
| src/bindings/javascript/logger.cpp | Guards EM_ASM patching for Issue to avoid accessing missing symbols. |
| src/bindings/javascript/file.cpp | Guards EM_ASM patching for File to avoid accessing missing symbols. |
| src/bindings/javascript/CMakeLists.txt | Generates package.types.json alongside the main JS package metadata. |
| cmake/environmentchecks.cmake | Updates advanced Nanobind-related cache variables list. |
| cmake/common.cmake | Updates advanced variables list for CURL/libssh2-related cache variables. |
| .github/workflows/cd.yml | Publishes the main npm package and the new types package. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #577.