-
Notifications
You must be signed in to change notification settings - Fork 178
Ability to control a project scope #364
Comments
I think aligning with tsc makes the most sense as it reduces the "distance" between tsc and working with webpack. Ideally I'd like any TypeScript loader to be a minimal difference from working with the compiler straight - focused on bundling alone pretty much. Also the loader can be simpler as a result. That said I understand the alternative point of view and understand to a certain extent. But if it becomes a feature of a loader then you're starting down the road of creating a codebase that has a tight coupling to that loader behaviour. Which is bad if you ever want to move away from webpack. |
Oh and additionally: for tooling reasons. I want to see the same output in VSCode / atom / brackets etc as I do from webpack. Otherwise I have to code with red squigglies and learn to ignore them - which is a nasty development experience. |
The default should remain unchanged However I would also like loader options to support the following scenarios:'
Since I haven't figured out how to pass a virtual I propose the following two configuration options: {
entriesOnly: true, // default false
additionalFiles: ['src/app/app.module.ts'] // only parsed when entriesOnly is true
} These options simply generate a |
Some background on my use case: I have an Electron project with separate builds for main and renderer processes, as well as e2e tests and unit tests in TypeScript. They have conflicting Typings, so I get errors unless I am able to restrict type checking to the resolution graph. With Angular 2, lazy loaded modules don't show up in the dependency graph, so it is necessary to specify those files in addition to entry points. Since my project has lots of |
Has anyone raised an issue with the TypeScript team itself to implement this behaviour in tsc? If they did implement then I would naturally be in favour of supporting this. Likewise if there's a reason they've chosen not to that could well be relevant. Is anyone aware of any discussion on the topic? |
I'm with @colinskow. Having both options will be the perfect thing. |
@johnnyreilly TypeScript has implemented this behavior, but you have to specifically specify the entry files in the |
@colinskow are you sure that's correct? My understanding was that if you are going to specify |
@johnnyreilly you can test that out for yourself. Specify one entry file in the Checkout my personal setup here: |
Ah - well that's news; thanks for sharing @colinskow, However, the problem is that it doesn't allow for multiple distinct entry points; i.e 2 different clashing project scopes driven by 2 entries in the same |
@johnnyreilly again, you can test for yourself but in my experience it does allow for distinct entry points. TypeScript should parse all files in the |
Somewhere somewhere I have a setup that demonstrates an issue with this. Alas I can't remember where... Perhaps my fears were unfounded - sounds like it |
If I simply specify an empty files[] in my tsconfig.json, then tsc seems to ignore files that are not reachable from any of my entries. |
@oocx that could work if it weren't for lazy loaded modules. In order to get lazy loaded modules to work they need to be added manually to the resolution graph. |
I currently use grunt-ts and can pass in the files I want, this is useful since I have multiple apps and partners in the same project. With grunt I can specify the project and app to build and the associated files, right now this is unusable since I just get errors about duplicate identifiers. It also makes a slow transition from grunt-ts impossible since I want to continue to run some files through that while I am making the transition. |
I personally would like to state my support for option 2, even if that's as a non-default option. I think if you're using a loader with Webpack then you expect the loader to behave the "Webpack way" above all else. This is the only loader I've come across (used a few dozen total) thus far that doesn't determine which files to work on via the resolution graph. |
I'm the author of #348, I also would like this repo aligned with tsc. |
I'm using Would be nice to have |
I'm using |
2 would be nicer. Currently in |
any news about this issue? |
+1 |
i found that ts-loader offers an options named |
I've received several similar issues about how to control project scope.
#359
#351
#348
#330
It looks like that people want to typecheck only files directly included by an entry point. My opinion is that the loader should output the same errors as in direct
tsc
call.I decided to conduct a small survey about the preferred default behavior:
Align with TypeScript and IDEs, check errors in files, specified by
tsconfig.json
and included from a resolution graph.Don't align with TypeScript and IDEs, check errors in files from a resolution graph only. Ignore files from
tsconfig.json
Please answer in comments and elaborate your position.
CC @johnnyreilly
The text was updated successfully, but these errors were encountered: