{"id":18513429,"url":"https://github.com/fishplusorange/ts-babel","last_synced_at":"2026-04-25T11:34:37.222Z","repository":{"id":42898227,"uuid":"252499534","full_name":"FishPlusOrange/ts-babel","owner":"FishPlusOrange","description":":motor_scooter: Compile TypeScript with Babel.","archived":false,"fork":false,"pushed_at":"2023-01-05T18:29:46.000Z","size":257,"stargazers_count":0,"open_issues_count":6,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-06-08T09:06:39.197Z","etag":null,"topics":["babel","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FishPlusOrange.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-04-02T15:50:34.000Z","updated_at":"2020-05-12T15:37:36.000Z","dependencies_parsed_at":"2023-02-04T10:16:06.474Z","dependency_job_id":null,"html_url":"https://github.com/FishPlusOrange/ts-babel","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/FishPlusOrange/ts-babel","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FishPlusOrange%2Fts-babel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FishPlusOrange%2Fts-babel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FishPlusOrange%2Fts-babel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FishPlusOrange%2Fts-babel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FishPlusOrange","download_url":"https://codeload.github.com/FishPlusOrange/ts-babel/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FishPlusOrange%2Fts-babel/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32261116,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-25T09:15:33.318Z","status":"ssl_error","status_checked_at":"2026-04-25T09:15:31.997Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["babel","typescript"],"created_at":"2024-11-06T15:38:15.277Z","updated_at":"2026-04-25T11:34:37.196Z","avatar_url":"https://github.com/FishPlusOrange.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TS Babel\n\n## TypeScript VS Babel\n\nTypeScript 和 Babel 都能把 `ts(x)` 编译成 `ES3/5/6` 以及其他更高版本。\n\nTypeScript 优势是为我们提供了**静态类型检查**功能，而 Babel 优势则是其**插件更加丰富、周边生态系统更加完善**。\n\n## With Babel 7+\n\n不使用 TypeScript 进行编译（比如使用 Webpack 搭配 `ts-loader` 或 `awesome-typescript-loader` 对 TS 进行编译），完全基于 Babel 生态写 TS 大致思路可以是：\n\n```text\nTS =\u003e Babel =\u003e JS\n|_______________|\n        |\ntsc for type checking\n```\n\n在整个流程中，TypeScript 仅提供目前 Babel 相比于其还不支持的一个重要功能——**静态类型检查**：\n\n- 可以使用 VSCode TypeScript 插件\n\n- 或者安装 TypeScript 依赖包，开启 `tsconfig.json` 配置项 `noEmit`，再使用命令 `tsc --watch` 开启监听模式，让 TypeScript 不输出任何文件仅做静态类型检查\n\n这样就不需要也没必要同时配置两个编译器，使得整个构建系统更加统一、更加可维护。\n\n\u003e 以上基于 Babel 7+，因为 Babel 7 之前并不支持 TS。\n\n## Tips for Using Babel\n\nBabel 编译 TS 存在一些小缺陷，其不支持个别 TS 语法，比如：\n\n- 命名空间\n\n- 常量枚举\n\n- 默认导出\n\n## How to Choose\n\n- 如果没有使用 Babel，首选还是 TypeScript 编译器，可使用 `ts-loader` 进行编译\n\n- 工程中已经使用了 Babel，可使用 `@babel/preset-typescript` 进行编译，并使用 TypeScript 配合做静态类型检查\n\n- 建议不要混用 TypeScript 和 Babel 进行编译\n\n- 个人更喜欢使用 TypeScript 作为编译器，毕竟 Babel 目前还不支持个别 TS 语法\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffishplusorange%2Fts-babel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffishplusorange%2Fts-babel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffishplusorange%2Fts-babel/lists"}