{"id":28972576,"url":"https://github.com/ember-cli/babel-remove-types","last_synced_at":"2026-01-20T16:34:43.608Z","repository":{"id":257804508,"uuid":"864146075","full_name":"ember-cli/babel-remove-types","owner":"ember-cli","description":null,"archived":false,"fork":false,"pushed_at":"2025-01-29T11:59:40.000Z","size":199,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-06-14T04:37:15.664Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/ember-cli.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"zenodo":null}},"created_at":"2024-09-27T15:21:15.000Z","updated_at":"2025-01-29T11:58:30.000Z","dependencies_parsed_at":"2024-09-29T09:15:57.899Z","dependency_job_id":"2f0a8d8a-d82d-45f4-896d-a2b049605383","html_url":"https://github.com/ember-cli/babel-remove-types","commit_stats":null,"previous_names":["ember-cli/babel-remove-types"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/ember-cli/babel-remove-types","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ember-cli%2Fbabel-remove-types","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ember-cli%2Fbabel-remove-types/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ember-cli%2Fbabel-remove-types/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ember-cli%2Fbabel-remove-types/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ember-cli","download_url":"https://codeload.github.com/ember-cli/babel-remove-types/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ember-cli%2Fbabel-remove-types/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261394299,"owners_count":23152168,"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":[],"created_at":"2025-06-24T11:06:59.413Z","updated_at":"2026-01-20T16:34:43.555Z","avatar_url":"https://github.com/ember-cli.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `babel-remove-types`\n\n\u003e [!NOTE]\n\u003e This is a fork of https://github.com/cafreeman/remove-types. It's not marked as a fork because we want pull requests to target this repo and not \"upstream\".\n\nA small library for transforming TypeScript code into JavaScript code in the least destructive way possible. This library exports a single function whose purpose is to preserve everything else about the code except for the actual TypeScript syntax itself. As a result, things like decorators and class fields should pass straight through without being transformed in any way.\n\n## Usage\n\n```js\nimport { removeTypes } from 'babel-remove-types';\n\nconst original = `\ntype AnimalType = 'cat' | 'dog';\n\n// An interface for animals (this comment should be removed when transformed)\ninterface Animal {\n  type: AnimalType;\n  name: string;\n  age: number;\n}\n\nclass Cat implements Animal {\n  type: AnimalType = 'cat';\n  name: string;\n  age: number;\n\n  constructor(name: string, age: number) {\n    // This is the name of the animal (this comment should stay)\n    this.name = name;\n    this.age = age;\n  }\n}\n`;\n\nconsole.log(await removeTypes(original));\n\n/*\nclass Cat {\n  type = 'cat';\n\n  constructor(name, age) {\n    // This is the name of the animal (this comment should stay)\n    this.name = name;\n    this.age = age;\n  }\n}\n*/\n```\n\n## API\n\n### `removeTypes(code, prettierConfig = true): Promise\u003cstring\u003e`\n\n- `code`: A string containing TypeScript code\n- `prettierConfig`:\n\n  - defaults to `true`\n  - By default, `removeTypes` will run Prettier with a very basic config on the transformed code before returning it. This allows us to clean up some of the \"low-hanging\" fruit leftover from the Babel transform, e.g. newlines at the beginning or end of the file.\n  - If you'd prefer to not run Prettier _at all_, passing `false` will bypass the Prettier pass entirely.\n  - If you'd prefer to use your own Prettier configuration, you can pass an object containing [Prettier configuration options](https://prettier.io/docs/en/options.html) and `removeTypes` will use it instead.\n\n- returns `Promise\u003cstring\u003e`: a string containing the transformed JavaScript output.\n\n## Acknowledgements\n\nThis library is heavily indebted to [cyco130/detype](https://github.com/cyco130/detype) and began as an extraction and refactor of one of its core functions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fember-cli%2Fbabel-remove-types","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fember-cli%2Fbabel-remove-types","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fember-cli%2Fbabel-remove-types/lists"}