{"id":18497125,"url":"https://github.com/arthurhub/ts-project-reference","last_synced_at":"2025-10-20T00:39:03.803Z","repository":{"id":259100997,"uuid":"873839521","full_name":"ArthurHub/ts-project-reference","owner":"ArthurHub","description":null,"archived":false,"fork":false,"pushed_at":"2024-11-07T18:25:00.000Z","size":315,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-14T04:36:02.467Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ArthurHub.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-10-16T20:06:18.000Z","updated_at":"2024-11-07T18:25:05.000Z","dependencies_parsed_at":"2024-12-25T17:27:19.625Z","dependency_job_id":"67d764ca-cf06-476a-8bd4-c81d1921174c","html_url":"https://github.com/ArthurHub/ts-project-reference","commit_stats":null,"previous_names":["arthurhub/ts-project-reference"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArthurHub%2Fts-project-reference","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArthurHub%2Fts-project-reference/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArthurHub%2Fts-project-reference/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArthurHub%2Fts-project-reference/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ArthurHub","download_url":"https://codeload.github.com/ArthurHub/ts-project-reference/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254071520,"owners_count":22009803,"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":"2024-11-06T13:33:32.234Z","updated_at":"2025-10-20T00:38:58.753Z","avatar_url":"https://github.com/ArthurHub.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Code sample for my [Sharing Code in TypeScript and Project References](https://theartofdev.com/2024/11/07/sharing-code-in-typescript-and-project-references/).\n\n### tl;dr\n\n- Strategies for sharing code and how they integrate within the TypeScript ecosystem.\n- [Project References](https://www.typescriptlang.org/docs/handbook/project-references.html) enable code sharing across multiple TypeScript projects within a single codebase (monorepo), offering modularization, dependency management, and incremental builds.\n- The [simple](https://theartofdev.com/2024/11/07/sharing-code-in-typescript-and-project-references/#3-esm) use of Project References is straightforward but can result in cumbersome import paths like `../../../../../libs/dist/data-access/loader/common.js`, which expose the project's internal folder structure.\n- This post explores solutions to the import path issue, balancing complexity and elegance:\n  - [TypeScript `paths` aliasing](https://theartofdev.com/2024/11/07/sharing-code-in-typescript-and-project-references/#4-esm-with-paths-aliases) adds complexity by requiring extra tooling for runtime import resolution.\n  - [Bundlers](https://theartofdev.com/2024/11/07/sharing-code-in-typescript-and-project-references/#5-esm-with-bundler), while somewhat cumbersome, largely resolve these issues and provide production deployment tools.\n  - [`npm workspaces`](https://theartofdev.com/2024/11/07/sharing-code-in-typescript-and-project-references/#6-esm-with-npm-workspaces) mimic external `npm` dependencies using symlinks in `node_modules`, addressing import paths without aliasing or extra tooling and enabling package export management for better modularization.\n- In conclusion, TypeScript [Project References](https://www.typescriptlang.org/docs/handbook/project-references.html) combined with [npm workspaces](https://docs.npmjs.com/cli/v8/using-npm/workspaces) provide an optimal solution for multi-project code sharing within a single codebase in TypeScript.\n\n[...continue reading](https://theartofdev.com/2024/11/07/sharing-code-in-typescript-and-project-references/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farthurhub%2Fts-project-reference","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farthurhub%2Fts-project-reference","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farthurhub%2Fts-project-reference/lists"}