3 ms·
Would love to try a typescript implementation. Any plans to do that?
by whoiskatrin 3y ago
Would love to try a typescript implementation. Any plans to do that?
- JackHopkins 3y agoGreat to know! We're working on extending MonkeyPatch to typescript, the work-in-progress repository can be found here https://github.com/monkeypatch/monkey-patch.ts https://github.com/monkeypatch/monkey-patch.ts We will keep you posted on when it'll be ready for trying out!
- jumploops 3y agoI built a similar library for Typescript: https://github.com/jumploops/magic https://github.com/jumploops/magic Please note: it requires the use of ttypescript or ts-patch, as Typescript transformers aren’t supported by default!
- JackHopkins 3y agoCool! Thanks for sharing. What do you mean that Ts transformers aren’t supported by default? Is this like a runtime modification of types?
- jumploops 3y agotl;dr - TypeScript transformers are used to modify the AST before Javascript is emitted. The magic functions library uses a transformer to take the TypeScript types and port them to JSON schema, such that they're available during runtime. This JSON schema is then used to validate that the response from the LLM matches the expected type signature of the function (and err if it doesn't). Because TypeScript doesn't support 3rd party "transformers" by default, you're forced to hack around it (via ttypescript or ts-patch). This is especially problematic when TypeScript has a major version change, as the workarounds need to be modified accordingly; this often takes significant time. Here's the long-lived Github issue: https://github.com/microsoft/TypeScript/issues/14419 https://github.com/microsoft/TypeScript/issues/14419 And here's the newest proposal to add official support: https://github.com/microsoft/TypeScript/issues/54276 https://github.com/microsoft/TypeScript/issues/54276