I've been following the development of TypeScript Content Mappers for quite a while, especially because it overlaps with another TypeScript extension project I'm working on, where I rely pretty heavily on Volar.js and God, it's a lot of code to keep all the language features working and in sync with TypeScript.
But now we finally have an official extension mechanism built directly into TypeScript, and now we can literally import anything.
I immediately started thinking about what else we could do with it. One thing that's been a particular pain for me is C++ lib interaction.
I'm building a small inference engine, and one of the biggest headaches has been N-API. Every time I need to call a C++ function from Node.js, I have to wrap it in special N-API bindings. It works, but it's a pain. There's also Koffi, which is pretty interesting, but it still doesn't give me the seamless type inference, IntelliSense, and development experience I'm looking for.
So I thought, why not take this a step further? What if we could just import C, C++, or Rust functions directly into TypeScript, as naturally as importing another TS file?
Using Content Mappers you can import functions from C, C++, and Rust source files directly into TypeScript, with inferred types and IntelliSense support, while generating and compiling the native bindings behind the scenes.
It's still early, and there's plenty of work ahead, but I think this opens up some really interesting possibilities.
Would love to hear your thoughts, especially from anyone who's worked with TypeScript language tooling, N-API, or native interoperability.
Hi all,
I've been following the development of TypeScript Content Mappers for quite a while, especially because it overlaps with another TypeScript extension project I'm working on, where I rely pretty heavily on Volar.js and God, it's a lot of code to keep all the language features working and in sync with TypeScript.
But now we finally have an official extension mechanism built directly into TypeScript, and now we can literally import anything.
I immediately started thinking about what else we could do with it. One thing that's been a particular pain for me is C++ lib interaction.
I'm building a small inference engine, and one of the biggest headaches has been N-API. Every time I need to call a C++ function from Node.js, I have to wrap it in special N-API bindings. It works, but it's a pain. There's also Koffi, which is pretty interesting, but it still doesn't give me the seamless type inference, IntelliSense, and development experience I'm looking for.
So I thought, why not take this a step further? What if we could just import C, C++, or Rust functions directly into TypeScript, as naturally as importing another TS file?
Well, here we are:
https://github.com/mykhailen/ts-polyglot
Using Content Mappers you can import functions from C, C++, and Rust source files directly into TypeScript, with inferred types and IntelliSense support, while generating and compiling the native bindings behind the scenes.
It's still early, and there's plenty of work ahead, but I think this opens up some really interesting possibilities.
Would love to hear your thoughts, especially from anyone who's worked with TypeScript language tooling, N-API, or native interoperability.