{"id":15044198,"url":"https://github.com/ynixt/another-typescript-generator","last_synced_at":"2026-01-27T23:06:10.397Z","repository":{"id":251997617,"uuid":"839086997","full_name":"ynixt/another-typescript-generator","owner":"ynixt","description":"A Gradle plugin that generates Typescript interfaces from Kotlin/Java classes","archived":false,"fork":false,"pushed_at":"2024-09-09T06:23:04.000Z","size":45,"stargazers_count":2,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-09-27T12:41:57.168Z","etag":null,"topics":["gradle","kotlin","plugin","typescript"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ynixt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-07T00:15:20.000Z","updated_at":"2024-09-09T06:22:52.000Z","dependencies_parsed_at":"2024-09-09T07:46:45.375Z","dependency_job_id":"de44ca5e-4ceb-4e34-991b-c04e93c936d2","html_url":"https://github.com/ynixt/another-typescript-generator","commit_stats":null,"previous_names":["ynixt/another-typescript-generator"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ynixt%2Fanother-typescript-generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ynixt%2Fanother-typescript-generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ynixt%2Fanother-typescript-generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ynixt%2Fanother-typescript-generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ynixt","download_url":"https://codeload.github.com/ynixt/another-typescript-generator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219867141,"owners_count":16555821,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gradle","kotlin","plugin","typescript"],"created_at":"2024-09-24T20:50:12.141Z","updated_at":"2025-10-24T03:30:40.993Z","avatar_url":"https://github.com/ynixt.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"Another Typescript Generator\n====================\n\nAnother Typescript Generator is a Gradle plugin that generates Typescript interfaces from Kotlin/Java classes. Each class generates a new\nfile to prevent collision.\n\n# Important notes\n\n- This plugin reads the bytecode (class) and not the source. Do not forget to run `classes` command before.\n- This plugin don't have yet any unit tests.\n\n# Example\n\n```kotlin\nclass Company(\n    id: String? = null,\n    val name: String,\n    val money: BigDecimal,\n    val imageUrl: String,\n) : DatabaseEntity(\n    id,\n) {\n    @ManyToOne(fetch = FetchType.LAZY)\n    var owner: Player? = null\n}\n```\n\nwill generate\n\n```typescript\nimport {DatabaseEntity} from './database-entity';\nimport {Player} from './player';\n\nexport interface Company extends DatabaseEntity {\n    imageUrl: string;\n    money: number;\n    name: string;\n    owner?: Player | null;\n    id?: string | null;\n}\n```\n\n# Using\n\n## Installing\n\nAdd `id(\"io.github.ynixt.another-typescript-generator\") version \"1.2.0\"` at plugins section\n\n```kotlin\nplugins {\n    id(\"io.github.ynixt.another-typescript-generator\") version \"1.2.0\"\n}\n```\n\n## Default mappings\n\n| Kotlin type                                                   | Typescript type      | Note                                                               |\n|---------------------------------------------------------------|----------------------|--------------------------------------------------------------------|\n| LocalDate, LocalDateTime, ZonedDateTime, Date                 | string               | Can be easily modified using the configuration parameter \"mapDate\" |\n| String                                                        | string               |                                                                    |\n| Byte, Short, Int, Long, Float, Double, BigDecimal, BigInteger | number               |                                                                    |\n| Boolean                                                       | boolean              |                                                                    |\n| Collection\u003cT\u003e                                                 | Array\\\u003cT\u003e            |                                                                    |\n| Map\u003cK, T\u003e                                                     | { [key: string]: T } |                                                                    |\n| any other type                                                | any                  |                                                                    |\n\nYou can change or add any mapping using the configuration parameter `customTypes`.\n\n## Configuring\n\nModify the task named `generateTypescriptInterfaces`. Here's a simple example:\n\n```kotlin\ntasks.named\u003cGenerateTypescriptInterfacesTask\u003e(\"generateTypescriptInterfaces\") {\n    outputPath = \"./src/models/generated\"\n    classPackages =\n        listOf(\n            \"io.github.ynixt.example\",\n        )\n}\n```\n\n## Configuration parameters\n\n### outputPath (Required)\n\nPath, relative or absolute, that will placed the generated \\*.ts files.\n\n#### Example\n\n```kotlin\noutputPath = \"./src/models/generated\"\n```\n\n### classPackages\n\nA permissive list of packages that contain the classes that will be used to generate the files.\n\nNote: A class not listed here can be read if a listed class has a reference for it.\n\n#### Example\n\n```kotlin\nclassPackages = listOf(\n    \"io.github.ynixt.example\",\n)\n```\n\n### excludeClassPackages\n\nA prohibitive list of packages. It takes priority over the permissive list.\n\nNote: A class listed here can be read if a not listed class has a reference for it. If you really don't want this class use \"ignoredClasses\"\nparam\n\n#### Example\n\n```kotlin\nexcludeClassPackages = listOf(\n    \"io.github.ynixt.example\",\n)\n```\n\n### ignoredClasses\n\nA list of classes that will not be read, no matter what. If there is any reference to it, this reference will be replaced by `any`.\n\n#### Example\n\n```kotlin\nignoredClasses = listOf(\n    \"io.github.ynixt.example.Book\",\n)\n```\n\n### ignoredFieldsByClass\n\nA map of fields of classes that should be ignored.\n\n#### Example\n\n```kotlin\nignoredClasses = mutableMapOf(\n    \"io.github.ynixt.example.Person\" to setOf(\"name\", \"age\")\n)\n``` \n\n### mapDate\n\nDefines which Typescript type should be used when a date type field is encountered (Date, LocalDate, LocalDateTime, ZonedDateTime).\n\n| MapDateOption | Typescript type | Default |\n|---------------|-----------------|---------|\n| AS_STRING     | string          | X       |\n| AS_LUXON      | DateTime        |         |\n| AS_MOMENT     | moment.Moment   |         |\n| AS_DATE       | Date            |         |\n| AS_NUMBER     | number          |         |\n\n#### Example\n\n```kotlin\nmapDate = MapDateOption.AS_LUXON\n``` \n\n### customTypes\n\nAdd or replace the mapping between Typescript and Kotlin.\n\n#### Example\n\n```kotlin\n customTypes = listOf(\n    CustomType(\n        kotlin = AbsoluteKotlinType(String::class),\n        typescript = AbsoluteTypescriptType(name = \"any\")\n    ),\n    CustomType(\n        kotlin = AbsoluteKotlinTypeString(\"io.github.ynixt.entities.Book\"),\n        typescript = AbsoluteTypescriptType(name = \"string\", ignoreGenerics = true)\n    )\n)\n``` \n\n### generateEnumOptions\n\nDefines whether the enum should also generate an array containing all its options.\n\n**Note:** default value is `true`.\n\n#### Example\n\n##### True\n\n```kotlin\ngenerateEnumOptions = true\n``` \n\nfor enum\n\n```kotlin\nenum class GroupPermissions {\n    CHANGE_ROLE,\n    ADD_MEMBER,\n    REMOVE_MEMBER,\n\n    SEND_ENTRIES,\n}\n```\n\ngenerates\n\n```typescript\nexport type GroupPermissions = 'CHANGE_ROLE' | 'ADD_MEMBER' | 'REMOVE_MEMBER' | 'SEND_ENTRIES';\n\nexport const GroupPermissions__Options: GroupPermissions[] = ['CHANGE_ROLE', 'ADD_MEMBER', 'REMOVE_MEMBER', 'SEND_ENTRIES'];\n```\n\n##### False\n\n```kotlin\ngenerateEnumOptions = false\n``` \n\nfor enum\n\n```kotlin\nenum class GroupPermissions {\n    CHANGE_ROLE,\n    ADD_MEMBER,\n    REMOVE_MEMBER,\n\n    SEND_ENTRIES,\n}\n```\n\ngenerates\n\n```typescript\nexport type GroupPermissions = 'CHANGE_ROLE' | 'ADD_MEMBER' | 'REMOVE_MEMBER' | 'SEND_ENTRIES';\n```\n\n### generateEnumObject\n\nDefines whether the enum should also generate an object containing all its options.\n\n**Note:** default value is `false`.\n\n#### Example\n\n##### True\n\n```kotlin\ngenerateEnumObject = true\n``` \n\nfor enum\n\n```kotlin\nenum class GroupPermissions {\n    CHANGE_ROLE,\n    ADD_MEMBER,\n    REMOVE_MEMBER,\n\n    SEND_ENTRIES,\n}\n```\n\ngenerates\n\n```typescript\nexport type GroupPermissions = 'CHANGE_ROLE' | 'ADD_MEMBER' | 'REMOVE_MEMBER' | 'SEND_ENTRIES';\n\nexport const GroupPermissions__Obj: { [K in GroupPermissions]: GroupPermissions } = {\n    'CHANGE_ROLE': 'CHANGE_ROLE',\n    'ADD_MEMBER': 'ADD_MEMBER',\n    'REMOVE_MEMBER': 'REMOVE_MEMBER',\n    'SEND_ENTRIES': 'SEND_ENTRIES',\n};\n```\n\n##### False\n\n```kotlin\ngenerateEnumObject = false\n``` \n\nfor enum\n\n```kotlin\nenum class GroupPermissions {\n    CHANGE_ROLE,\n    ADD_MEMBER,\n    REMOVE_MEMBER,\n\n    SEND_ENTRIES,\n}\n```\n\ngenerates\n\n```typescript\nexport type GroupPermissions = 'CHANGE_ROLE' | 'ADD_MEMBER' | 'REMOVE_MEMBER' | 'SEND_ENTRIES';\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fynixt%2Fanother-typescript-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fynixt%2Fanother-typescript-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fynixt%2Fanother-typescript-generator/lists"}