3 ms·
Cool! Thanks for sharing. What do you mean that Ts transformers aren’t supported by default? Is this like a runtime modification of types?
by JackHopkins 3y ago
Cool! 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