AshTypescript.Codegen.Helpers (ash_typescript v0.18.1)

Copy Markdown View Source

Shared helper functions for code generation.

Summary

Functions

Builds a TypeScript type name from a resource module. Uses the custom typescript_type_name if defined, otherwise derives from module name.

Converts a PascalCase name to camelCase by lowercasing the first character.

Determines if a return type is complex (requires special metadata handling).

Functions

build_resource_type_name(resource_module)

Builds a TypeScript type name from a resource module. Uses the custom typescript_type_name if defined, otherwise derives from module name.

camel_case_prefix(arg)

Converts a PascalCase name to camelCase by lowercasing the first character.

Examples

iex> AshTypescript.Codegen.Helpers.camel_case_prefix("Todo")
"todo"

iex> AshTypescript.Codegen.Helpers.camel_case_prefix("OrgTodo")
"orgTodo"

is_complex_return_type(arg1, constraints)

Determines if a return type is complex (requires special metadata handling).