-
-
Notifications
You must be signed in to change notification settings - Fork 243
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
Re-Evaluate supported TypeScript versions, open bugs in older versions #257
Comments
So I tried hunting down this It boils down to the test finding an error that is not found with later TS versions: [ { rawMessage:
'ERROR TS2322: Type \'"1"\' is not assignable to type \'number\'.',
message:
'\u001b[1m\u001b[31mERROR in \u001b[39m\u001b[22m\u001b[1m\u001b[36m/home/weber/tmp/fork-ts-checker-webpack-plugin/test/integration/project/src/index.ts(2,7)\u001b[39m\u001b[22m\u001b[1m\u001b[31m:\u001b[39m\u001b[22m\n\u001b[90mTS2322: \u001b[39mType \'"1"\' is not assignable to type \'number\'.',
location: { line: 2, character: 7 },
file:
'/home/weber/tmp/fork-ts-checker-webpack-plugin/test/integration/project/src/index.ts' } ] Honestly, looking at the tests I would also expect to see this behaviour in TS >= 3.0 😩 Do you have any explanation? Did searching for source files somehow change with 3.0? |
This is a very sad thing!
When you mentioned that I remembered a change we made when we 1 point oh-ed: /~https://github.com/Realytics/fork-ts-checker-webpack-plugin/blob/master/CHANGELOG.md#v100
You get different behaviour for error reporting with the incremental API: #198 (comment) Essentially, the compiler starts reporting errors and stops checking for more of different kinds when using the incremental API. This may / may not explain the specific test you're talking about here. With regards all tests running with If you exclude incremental API tests running for < 3.0 how does that change the picture? Also, arguably the |
Unfortunately, this is not a The error in questions occurs for both On the other hand, we have no additional failures with As for modifying the |
Good shout. |
All tests running That's the only reason these tests are not failing. So yes, this seems to be a different behaviour between |
How many are in that camp? [hands over eyes] |
Just four. Assuming I haven't missed anything else. |
cool - which ones are they? are they all tslint related? |
so yes, all linting-related. |
But I think I found something far more concerning. I just copied the files from the test over to a copy of /~https://github.com/TypeStrong/ts-loader/tree/master/examples/fork-ts-checker-webpack-plugin In I'll make a production repo, maybe you can tell me what's going on there... |
You can check out this branch.
|
Yup, it's an edge case with the test suite here. As long as that syntactic error exists there, the ApiIIncrementalChecker bails on that syntactic error. Due to a syntactic error being present, the semantic errors are never found.
|
okay cool. Heart attack over 😄 |
So having the syntactic error there essentially nullifies all other tests. Also, this might be highly confusing in production. In this specific case, |
Yup, had the same heart attack until I re-stumbled over this by accident by reading the README xD. But this is still concerning - the case I described above might really impact real-life projects out there. Just go to your project, create a rogue |
Yes - granted. All suggestions to help fix this are welcome 🤗 I'm not certain what the best way forward here is. |
Hmm. Off the top of my head, I can think of three things:
|
In the scenario you discuss above I think you're suggesting that ts-loader won't report the syntactic error and fail the build. Is that right? If so that's disappointing. Options 1 and 3 sound interesting. Simplicity of use remains a strong motivation of the plugin. I'd be curious to hear you talk through the developer experience of using each. (Bearing in mind that the typical user of the plugin won't know that there is a distinction between semantic / syntactic errors I'm keen any solution is easy to consume.) Another thing to add into the mix is the default way people use the plugin. At present, and this is a result of the way the plugin evolved, error checking is curiously split across ts-loader and fork-ts-checker-webpack-plugin. ts-loader does syntactic errors by default, fork-ts-checker-webpack-plugin does semantic by default. A possible other option is changing the default behaviour so the plugin checks for both types of error. And change the advice in ts-loader to not report errors at all when working with the fork-ts-checker-webpack-plugin. Aka "happypack" mode: /~https://github.com/TypeStrong/ts-loader/blob/master/README.md#happypackmode-boolean-defaultfalse If we follow that route we might want to give some more meaningful names for options. 😁 All things to consider. Thanks for your efforts - I dig it 🤗 |
No, ts-loader will not fail the build, as it is a syntactic error that does not affect the build at all. (It is not directly referenced in webpack and not imported by any file directly referenced by webpack). The build will succeed without any errors. fork-ts-checker-webpack-plugin on the other hand sees a syntactic error and does not report errors, assuming that the build has failed. After all, fork-ts-checker-webpack-plugin has no way of knowing which files are being processed by webpack and which files aren't. Leaving the user will a successful compilation and reports of no errors, even though there might be any number of errors actually present :/ From the user's perspective:
From looking into it, 3. might be much more difficult that I thought. That TS code is a f**ing mess :/ But I'll keep investigating. |
Cool - what do you think the option of generally steering people to do all type checking with the fork-ts-checker-webpack-plugin? Codewise there's technically nothing to do. They can achieve the same goal right now by using ts-loader with Obviously having to supply those two options is rubbish. But if we're agreed that it works then a possibility is to do a breaking changes release of fork-ts-checker-webpack-plugin which sets The options you suggest may well be the better choice, I just want to establish whether this is a potential other option. |
I think that's a good option too, but it would need an update to As for option 3., I have got that one working. In
This makes the ApiIncrementalChecker emit errors even if there is a syntactic error. PS: passing this wrapping method to |
Question is: how would you like to go on from here? While option 3) feels a bit hacky at first sight, it is essentially how #231 would work internally, so this could be a first step in that direction. That should clear all errors for >=2.6. From then, I could investigate the additional vue error we have with 2.5. Also, I would suggest visiting the travis config. |
And yet you don't want to use proxies? 😉
Great question... Your plans sound good. I say go for it! Any thoughts @piotr-oles? |
Nah, the proxies are out of there for a while. Actually, while those things are interesting, it's really easy to shoot yourself in the foot with them. Make a change somewhere down the road and you got an infinite loop that's really difficult to debug (especially for future contributors). All that remains is the name of that PR 😁 |
The option 3 looks reasonable - as far as I understand we don't make breaking change with that option. Speaking about moving forward - in my opinion this plugin became hard to maintain. We have to take care about:
keeping compatibility with many typescript, webpack and tslint versions. We need to revise the architecture of the plugin. I think version 2 of this plugin should give up IncrementalChecker in favor for ApiIncrementalChecker. Also vue part should be handled in more generic way - that will allow to handle mdx using the same API (and possibly other formats in the future). That's what came to my mind - I saw promising PRs here but I think we need plan/roadmap 😃 |
Agreed - if you'd like to open an issue that's probably a good start. Here's my initial thoughts:
When we get to the point where ApiIncrementalChecker can do all of the things IncrementalChecker can then I'm totally sold! That's not where things are now; but hopefully that will happen...
Yup - that's what #231 is ideally going to lead us to.
I'm hoping we'll drop TSLint in the future (given it is deprecated) but I'd like us to add support for ESLint if we can. See more here: #203
I'd like to think about dropping support for older TypeScript versions. That's a given anyway if we move to the ApiIncrementalChecker anyway. If we move to have just that and not the IncrementalChecker then we start with a minimum TypeScript version of 2.9. All things to consider! Also, @piotr-oles would you be okay with making @phryneas a collaborator on the plugin? He's been doing some great work which has really helped us. |
when the options `checkSyntacticErrors: false` and `useTypescriptIncrementalApi: true` both were active, no semantic errors were emitted as soon as the first syntactic error was encountered this patches the `typescript` import to override that behavior see discussion in TypeStrong#257
@johnnyreilly I'm honored that you consider that. One thing though, just to get this off my chest: I can't make any guarantees how much time I can/will spend with this project in the future - but if that is okay, I'd be happy to continue contributing and try to stick around for a while. This is very much fun :) |
when the options `checkSyntacticErrors: false` and `useTypescriptIncrementalApi: true` both were active, no semantic errors were emitted as soon as the first syntactic error was encountered this patches the `typescript` import to override that behavior see discussion in TypeStrong#257
It's fine with me - people come and go. That's to be expected. But I'm always keen to make the best of people when they have time and energy to spare. Doing open source well is very much about catching the wind when it blows your way ⛵️ 😉 |
@phryneas Invitation sent - welcome aboard 🚢 |
when the options `checkSyntacticErrors: false` and `useTypescriptIncrementalApi: true` both were active, no semantic errors were emitted as soon as the first syntactic error was encountered this patches the `typescript` import to override that behavior see discussion in TypeStrong#257
when the options `checkSyntacticErrors: false` and `useTypescriptIncrementalApi: true` both were active, no semantic errors were emitted as soon as the first syntactic error was encountered this patches the `typescript` import to override that behavior see discussion in TypeStrong#257
when the options `checkSyntacticErrors: false` and `useTypescriptIncrementalApi: true` both were active, no semantic errors were emitted as soon as the first syntactic error was encountered this patches the `typescript` import to override that behavior see discussion in TypeStrong#257
when the options `checkSyntacticErrors: false` and `useTypescriptIncrementalApi: true` both were active, no semantic errors were emitted as soon as the first syntactic error was encountered this patches the `typescript` import to override that behavior see discussion in TypeStrong#257
# [1.2.0-beta.4](/~https://github.com/Realytics/fork-ts-checker-webpack-plugin/compare/v1.2.0-beta.3@beta...v1.2.0-beta.4@beta) (2019-04-23) ### Bug Fixes * **tests:** fix linter tests that were doing nothing ([d078278](d078278)) * **tests:** linter tests - useTypescriptIncrementalApi usage ([e0020d6](e0020d6)) ### Features * **apiincrementalchecker:** improve generation of diagnostics ([ae80e5f](ae80e5f)), closes [#257](#257)
I'm just running the tests again for the current From what I see:
Fixing these two tests (or potentially, bugs) we would be at "fork-ts-checker-webpack-plugin is compatible with TS 2.1, if you want vue support you need TS 2.3". I think we could live with that? |
I can take a look but not before next week at the earliest. In the meantime maybe they can be skipped? 2.5 is almost two years old 😅 |
@arcanis no worries, those are not the regular tests 😀 |
Frankly I'm happy with us just not supporting < 2.5 We should technically do a breaking change for that (and we likely will in future). But given how old that is, and that no-one is really knocking down our door about this, the pragmatist in me is fine with this. 😁 Interestingly, in ts-loader we have tests that are only executed when we are above a certain version of TypeScript: /~https://github.com/TypeStrong/ts-loader/tree/master/test/execution-tests (mainly as certain features aren't in older versions of TypeScript) That's also a strategy I am fine with. 😁 |
# [1.3.0-beta.1](/~https://github.com/Realytics/fork-ts-checker-webpack-plugin/compare/v1.2.0...v1.3.0-beta.1@beta) (2019-04-30) ### Bug Fixes * **tests:** fix linter tests that were doing nothing ([d078278](d078278)) * **tests:** linter tests - useTypescriptIncrementalApi usage ([e0020d6](e0020d6)) * **tests:** rework vue integration tests ([5ad2568](5ad2568)) ### Features * **apiincrementalchecker:** improve generation of diagnostics ([ae80e5f](ae80e5f)), closes [#257](#257)
Support was re-evaluated in the new alpha release (TypeScript >= 2.7.0 - because of the Watch API). The E2E tests check different versions of TypeScript :) |
# [1.2.0-beta.4](/~https://github.com/Realytics/fork-ts-checker-webpack-plugin/compare/v1.2.0-beta.3@beta...v1.2.0-beta.4@beta) (2019-04-23) ### Bug Fixes * **tests:** fix linter tests that were doing nothing ([d078278](TypeStrong/fork-ts-checker-webpack-plugin@d078278)) * **tests:** linter tests - useTypescriptIncrementalApi usage ([e0020d6](TypeStrong/fork-ts-checker-webpack-plugin@e0020d6)) ### Features * **apiincrementalchecker:** improve generation of diagnostics ([ae80e5f](TypeStrong/fork-ts-checker-webpack-plugin@ae80e5f)), closes [#257](TypeStrong/fork-ts-checker-webpack-plugin#257)
# [1.3.0-beta.1](/~https://github.com/Realytics/fork-ts-checker-webpack-plugin/compare/v1.2.0...v1.3.0-beta.1@beta) (2019-04-30) ### Bug Fixes * **tests:** fix linter tests that were doing nothing ([d078278](TypeStrong/fork-ts-checker-webpack-plugin@d078278)) * **tests:** linter tests - useTypescriptIncrementalApi usage ([e0020d6](TypeStrong/fork-ts-checker-webpack-plugin@e0020d6)) * **tests:** rework vue integration tests ([5ad2568](TypeStrong/fork-ts-checker-webpack-plugin@5ad2568)) ### Features * **apiincrementalchecker:** improve generation of diagnostics ([ae80e5f](TypeStrong/fork-ts-checker-webpack-plugin@ae80e5f)), closes [#257](TypeStrong/fork-ts-checker-webpack-plugin#257)
I just executed the current test suite against all supported TypeScript versions. The results aren't too promising:
https://travis-ci.org/phryneas/fork-ts-checker-webpack-plugin/builds/522776393
Here's a collection of the failing tests:
TS 2.1
TS 2.2
TS 2.3
TS 2.4
TS 2.5
TS 2.6
TS 2.7
TS 2.8
TS 2.9
All TS 3.X versions seem to be working fine.
So the question is: how to continue from here on?
From looking at the tests, I would suggest to drop support for TS<2.5 and investigating the other two failing tests.
But of course, this might be something you know and expect and I'm just over-interpreting those results.
What do you think?
PS: please keep in mind, all these test were only run in the following configuration:
linux node@10 webpack@^4.0.0 ts-loader@^5.0.0 vue-loader@^15.2.4
Running other configurations might uncover more errors, but for now I kept it at that.
The text was updated successfully, but these errors were encountered: