as

Settings
Sign out
Notifications
Alexa
Amazon Appstore
AWS
Documentation
Support
Contact Us
My Cases
Get Started
Design and Develop
Publish
Reference
Support

Vega Codegen FAQ

  • Is there support for advanced TypeScript types like aliases, generics?

    Aliases, enums, and unions have some basic support, but are limited – for example, enums and unions which contain aliases will assume that the alias represents an Object. Enums and unions of strings or numbers are supported, but not of heterogeneous types. Generics are not supported.

  • What types can I use in my TypeScript interface?

    Most basic TypeScript types are supported, in addition to some custom types such as Int32, Float, and ArrayBuffer. See the type mapping table for a full list.

  • Why am I seeing .bak files?

    When you run Codegen with the --new flag, it generates template files for your Turbo Module implementation. Existing implementations with the same name are preserved via the .bak extension in case you have in-progress or previous implementation code which you want to transfer into the new files. You can delete the backup files once you no longer need to reference their contents.

  • I'm familar with React Native's Codegen tool, how does this compare?

    The basic idea of "converts TypeScript interface to native code template" is the same. There are differences in the exact set of types supported, since Vega's native type support is not 1:1 with React Native, but they are similar. There are also differences in where it integrates with the build system and development process. React Native Codegen is still experimental, so there may be major changes in the future.

  • Why does Codegen generate Spec files?

    Separating the boilerplate specification from the human-provided implementation details allows codegen to confidently generate and re-generate the boilerplate without overriding anything important. This also allows us to enforce that the implementation matches the specification–the compiler requires the functions defined in the specification to be implemented.
    If you do find yourself needing to modify the Spec files, be aware that re-running codegen will re-generate those files, overwriting your changes.

  • Can I have multiple Turbo Modules in one package?

    Vega Codegen currently only supports generating one module at a time. This is in order to better support customization options such as CLI flags for module names which may vary from module to module. That being said, your package can still contain multiple Turbo Modules, you will just need to run Codegen on them independently.

Common error messages

  • 'throw new Error('Optional args are not supported by Vega TurboModules.');'

    Optional arguments are not supported by Vega Turbo Modules. This is not a Codegen limitation, but a check introduced by Codegen. If your TypeScript interface has optional arguments (arg?: type), they should be required instead, as the Turbo Module will fail at runtime if the argument is not passed.
    Optional arguments can be supported by JavaScript wrappers around the Turbo Module.

  • 'Unrecognized generic type 'undefined' in NativeModule spec.'

    Most likely, you are importing types from another file. This is not supported by Codegen. We recommend movingg those types into the same file as the TypeScript interface. Certain types (Int32, Double, Float, etc.), can be imported from @amazon-devices/keplerscript-turbomodule-api and are supported by Codegen when imported that way.

  • 'Unrecognized generic type 'T' in Native Module spec.'

    Generics are not supported by Vega Turbo Modules.

  • 'TypeScript type annotation 'TSAnyKeyword' is unsupported in NativeModule specs.'

    any is not a supported type for Codegen. Consider using a stricter type definition. If you have a callback typed like (event: any) => void which actually accepts multiple types, you can use the CallbackParam type from @amazon-devices/keplerscript-turbomodule-api.

  • 'npm ERR! 404 Not Found - GET https://registry.npmjs.org/keplerscript-turbomodule-api - Not found'

    You need to install the package in your local workspace before you can run the script.


Last updated: Sep 30, 2025