# TypeScript to Candid compiler

**URL:** <https://forum.dfinity.org/t/typescript-to-candid-compiler/11413>\
**Category:** Developers\
**Created:** [March 10, 2022, 5:41am UTC](https://forum.dfinity.org/t/typescript-to-candid-compiler/11413 "2022-03-10T05:41:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lastmjs](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/lastmjs/32/3406_2.png) [@lastmjs](https://forum.dfinity.org/u/lastmjs)\
**Post date:** [March 10, 2022, 5:41am UTC](https://forum.dfinity.org/t/typescript-to-candid-compiler/11413/1 "2022-03-10T05:41:01Z")

</div>

Just checking before I embark on this journey for Azle (TypeScript CDK). Is there an existing TypeScript → Candid compiler?

If not then I (Demergent Labs) will be creating one. Demergent Labs will most likely create a Python → Candid compiler as well, I really doubt that has been touched.

---

<div class="post-metadata">

**Author:** ![paulyoung](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/paulyoung/32/5251_2.png) [@paulyoung](https://forum.dfinity.org/u/paulyoung)\
**Post date:** [March 10, 2022, 7:42am UTC](https://forum.dfinity.org/t/typescript-to-candid-compiler/11413/2 "2022-03-10T07:42:41Z")

</div>

> [@lastmjs](#):
>
> Is there an existing TypeScript → Candid compiler?

Probably not in the way you mean. The [candid package](https://github.com/dfinity/agent-js/blob/main/packages/candid) has provided something like this for a long time:

> We provide a library for serialization of native JavaScript values, and a visitor class for extending Candid for building generic tools such as UI and random testing.

I imagine what you’re trying to do would involve something similar to the developer experience of generating Candid from Rust; by providing TypeScript types and functions that you want to be part of the generated Candid interface.

I think that probably means going from the TypeScript AST to the IDL types in the following file, and then leveraging the encoding it already provides.

> <https://github.com/dfinity/agent-js/blob/main/packages/candid/src/idl.ts>
