Proposal: Type-only .property<T>
in Embind (generate TS only, no getter/setter)
#25146
mkl-ableton
started this conversation in
Ideas
Replies: 1 comment
-
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all,
I’d like to propose a type-only property option in Embind that emits TypeScript declarations for class properties without requiring a getter or setter or generating any runtime code.
Motivation
I’m mirroring a C++ data structure on the JS side and updating a JS object from C++ whenever the C++ object changes (using my own plumbing). I don’t need Embind to wire up accessors; I only need accurate
.d.ts
declarations.Proposed API
Extend
class_<T>
with a type-only property form:Desired behavior
Emit only the TypeScript declaration in the generated
.d.ts
:No JS runtime emitted for the property (no
Object.defineProperty
, noprototype wiring).
If this direction makes sense, I can prepare a patch (with docs/tests). If there’s an existing hook for declaration-only members, I’d appreciate pointers.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions