Skip to Main Content

MongoByte MongoDB Logo

Welcome to the new MongoDB Feedback Portal!

{Improvement: "Your idea"}
We’ve upgraded our system to better capture and act on your feedback.
Your feedback is meaningful and helps us build better products.

117 VOTE
Status Submitted
Created by Guest
Created on Jun 10, 2020

Support TypeScript

I know this is probably a very complex feature, but I'd like to work with TypeScript when writing functions. Some stretch goals: - full integration with VSCode so we no longer have to use the web editor - add support for testing functions (through CI/CD)
  • Guest
    Apr 22, 2024
    Bump for this - Is it at all taken into account ?
  • Guest
    Nov 8, 2022
    OP created this message more than two years ago. Since then we don't have any news from MongoDB. It is not in their roadmap. To be honest I'm not sure we'll see this feature in 2023... Therefore on our projects, we are migrating all of our Realm Functions to Azure Functions. It's much better: TypeScript support, local development server, efficient CLI, etc.
  • Guest
    Nov 8, 2022
    Yes please! Having to go to the docs to find out what's in Context or globals like https://www.mongodb.com/docs/atlas/app-services/functions/globals/#std-label-bson feels like going back to 2018 It's relatively easy to set up manual transpilation through a Husky pre-commit hook, but the .ts source file needs to be outside of your realm directory structure otherwise it is cleared later when doing an update from the UI, and you still lack type definitions for the Mongo variables. Native Typescript support, offering IntelliSense autocompletion and type safety would be a great fit for Atlas Functions as it is usually critical these run safely. It is hard to take Atlas as a platform seriously without it.
  • Guest
    Sep 19, 2022
    I do not know if it's appropriate to write here, but still, it might help someone who is looking for a way to develop functions in typescript. I actually went for my approach, which I asked about in the comment below. You may use the CLI build tool made for making functions development easier: https://www.npmjs.com/package/@realm-fun/cli. It is far from delivering the full-fledged typescript support, but it is something / replacement for the time being before Mongo team comes up with their own approach to the issue XD
  • Guest
    Sep 7, 2022
    As an alternative, there is a very poor way to transpile a typescript function file to JavaScript, described at "https://dev.to/stasbar/writing-mongo-realm-serverless-functions-in-typescript-5fdo". If typescript support is too much to handle, maybe, someone on your team could try to work out a transpiler for typescript (with imports/exports) etc. to be honest, I tried to write one, but, because of my lack of experience and poor understanding of how Atlas Functions system works, obviously, failed. Maybe something like Wrangler for Cloudflare Workers?
  • Guest
    May 19, 2022
    not only typescript support, we need to see which line and function is causing the error. right now 1 function calling other function does not show which function is causing the error and which line. we dont have stack information, its very very difficult to debug. plus error logs are limited in length, this is a huge disadvantage when app scale in terms of complexity
  • Guest
    Mar 10, 2022
    Give it to me, baby! TypeScript is awesome and must be supported!
  • Guest
    Nov 18, 2020
    TS support would be great! (We use github for deploys so we're able to edit/test locally, but some sort of integrated way to simulate function payloads etc locally would be nice.)
  • Guest
    Oct 14, 2020
    Bump for this - we've got a massive chunk of function code that we'd love to move to realm, but it's all in typescript! Migrating it would be an excessive amount of work right now...
  • +17