-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
single-run inference should work with default program creation #3627
Comments
I don't think we should support this. Ideally I wanted to remove createDefaultProgram in the next major. This option is only really used by bad configs from what I've seen. |
I’m afraid it’s required for the Angular ecosystem right now, the Angular CLI scaffolds projects which do not cover all their files with tsconfigs because they invented a paradigm around environment files being magically swapped as part of the build. |
FWIW I believe they regret doing it that way, but AFAIK there is no alternative on the horizon |
Just to add more important context, it actually goes further than that magical environment file swapping... They don't use glob patterns for source E.g. tsconfig.app.json {
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/app",
"types": []
},
"files": [
"src/main.ts",
"src/polyfills.ts"
],
"include": [
"src/**/*.d.ts"
]
} ...so this also means that that when you create new files as part of normal development they are not covered by the Programs either (until you import the new files into existing ones which are) and you will therefore also get eager red squigglies and errors from typescript-eslint If it were only the environment file swapping we could work around it with ignorePatterns, but this DX above is just awful and so that is why I am forced to leverage createDefaultProgram |
Perhaps thats something we should take up with the TS team instead? The watch program builder should be able to update the set of files after a rebuild if you're using the files option. |
@bradzacher Sorry maybe I didn't make the example clear enough. The entrypoints in files are main.ts and polyfills.ts - let's ignore polyfills because it doesn't change. Let's say our whole app is:
As part of normal development we want to work on a new component, so we create a new file,
This is not something that relates to watch programs or an issue with TS. If we then update Do you see what I mean? |
Yeah that makes sense So why don't we just use a separate The lint can even extend the base config to keep everything the same. |
I suggested the same thing straight off the bat over a year ago and it was rejected by the Angular Team at the time because they did not want another file... Now having said that, things have changed since then and the decision was made to not include linting in the Angular CLI out of the box (and therefore the Angular Team will not maintain any linting stuff, it all falls to me), so it may be worth revisiting that constraint... I have always documented it as an option for users to explore if they are experience performance issues, but I could potentially invert it in the next major version and give people the extra file by default |
PS my vote would be in the next major version to rename the option to |
I do wonder if we could look to VSCode for inspiration here and move to an automatic hybrid model? We almost do this right now, but I think we create one program PER unknown file, instead of just a single catch-all program. |
Per #5857 this is deprecated behavior and we won't be accepting PRs to enhance it. Hooray! |
Opening this as a tracker for myself - I realized currently there is no way for single-run inference to be used if the project is also relying on
"createDefaultProject"
.It will probably require a little bit of refactoring to make this combination possible but hopefully it shouldn't be too bad. I'll hopefully be able to work on it this week.
The text was updated successfully, but these errors were encountered: