Support "medium-sized" projects
Problem
Listening to @nycdotnet has me fired up to tackle this one. Thanks, Steve. (btw, you can check out his good interview here: http://www.dotnetrocks.com/default.aspx?showNum=1149) The proposal here was first started in times prehistoric (even before #11), when dinosaurs walked the scorched earth. While nothing in this proposal is novel, per se, I believe it's high time we tackled the issue. Steve's own proposal is #3394. The Problem Currently, in TypeScript, it's rather easy to start and get going, and we're making it easier with each day (with the help of things like #2338 and the work on System.js). This is wonderful. But there is a bit of a hurdle as project size grows. We currently have a mental model that goes something like this: - Small-sized projects: use tsconfig.json, keep most of your source in the current directory - Large-sized projects: use custom builds, put source where you need it For small-sized projects, tsconfig.json gives you an easy-to-setup way of getting going with any of the editors in a cross platform way. For large-scale projects, you will likely end up switching to build systems because of the varied requirements of large-scale projects, and the end result will be something that works for your scenarios but is difficult to tool because it's far too difficult to tool the variety of build systems and options. Steve, in his interview, points out that this isn't quite the right model of the world, and I tend to agree with him. Instead, ther
Error Output
exception that the project is built from multiple components. The hypothesis here is that there are quite a number of projects at this level that could be well-served by this support.
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Enhance TypeScript Support for Medium-Sized Projects
The current TypeScript project structure is optimized for small and large projects, leaving a gap for medium-sized projects. This leads to difficulties in managing dependencies and configurations as project complexity increases, resulting in developers needing to switch to custom build systems that are harder to maintain and tool.
Awaiting Verification
Be the first to verify this fix
- 1
Define a New Project Structure
Introduce a new project structure that accommodates medium-sized projects. This structure should allow for a combination of tsconfig.json and modular component organization, enabling better management of dependencies and configurations.
jsontsconfig.json example: { "compilerOptions": { "target": "es6", "module": "commonjs", "baseUrl": "./src", "paths": { "@components/*": ["components/*"], "@utils/*": ["utils/*"] } }, "include": ["src/**/*"], "exclude": ["node_modules"] } - 2
Implement Module Resolution
Enhance the TypeScript compiler to support module resolution for medium-sized projects. This will allow developers to reference components across different directories without needing to configure complex build systems.
typescript// Example of importing a component import { MyComponent } from '@components/MyComponent'; - 3
Update Documentation
Revise the TypeScript documentation to include guidelines and best practices for setting up medium-sized projects. This should include examples of the new project structure and how to utilize the enhanced module resolution.
markdown// Example documentation snippet ## Setting Up a Medium-Sized Project To set up a medium-sized project, create a tsconfig.json file with the following structure... - 4
Test the New Structure
Create a sample medium-sized project using the new structure and module resolution features. Ensure that all components can be imported and that the project builds successfully without errors.
plaintext// Sample project structure /src /components MyComponent.ts /utils helper.ts index.ts
Validation
To confirm the fix worked, create a medium-sized project using the new structure and ensure that all components are correctly resolved and the project builds without errors. Additionally, review the updated documentation for clarity and completeness.
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep