Skip to content
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

[feature request] Enable typescript 3.8.3 support #1072

Closed
vladimiry opened this issue Mar 21, 2020 · 4 comments
Closed

[feature request] Enable typescript 3.8.3 support #1072

vladimiry opened this issue Mar 21, 2020 · 4 comments

Comments

@vladimiry
Copy link

vladimiry commented Mar 21, 2020

  • Webpack config is a TS file, not JS.
  • ts-loader@6.2.1
  • typescript 3.8.3
  • webpack@4.42.0
  • workaround: enabling skipLibCheck TS compilation flag (not for the entire code base but just for the code part that compiles/runs webpack using the config presented in TS code).

ERROR in node_modules/ts-loader/dist/interfaces.d.ts:57:18 - error TS2320: Interface 'SolutionBuilderWithWatchHost' cannot simultaneously extend types 'SolutionBuilderWithWatchHost' and 'WatchFactory'.
Named property 'watchDirectory' of types 'SolutionBuilderWithWatchHost' and 'WatchFactory' are not identical.

57 export interface SolutionBuilderWithWatchHost extends typescript.SolutionBuilderWithWatchHost<typescript.EmitAndSemanticDiagnosticsBuilderProgram>, WatchFactory {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/ts-loader/dist/interfaces.d.ts:57:18 - error TS2320: Interface 'SolutionBuilderWithWatchHost' cannot simultaneously extend types 'SolutionBuilderWithWatchHost' and 'WatchFactory'.
Named property 'watchFile' of types 'SolutionBuilderWithWatchHost' and 'WatchFactory' are not identical.

57 export interface SolutionBuilderWithWatchHost extends typescript.SolutionBuilderWithWatchHost<typescript.EmitAndSemanticDiagnosticsBuilderProgram>, WatchFactory {

@johnnyreilly
Copy link
Member

Is the problem presenting because your webpack config is TS and not JS?

I suspect this would be fixed by publishing a new version of ts-loader; we encountered this issue when upgrading from 3.7 to 3.8.

Can you do me a favour and compile the latest version of ts-loader and try it on your project. If that works then I'd feel justified publishing a new release.

@vladimiry
Copy link
Author

vladimiry commented Mar 21, 2020

Is the problem presenting because your webpack config is TS and not JS?

I think so, yes, since skipLibCheck enabled by default I got the issue of typings incompatibility noticed.

Can you do me a favour and compile the latest version of ts-loader and try it on your project. If that works then I'd feel justified publishing a new release.

Can confirm the issue is gone if I use compiled from the master branch ts-loader version.

But if I then downgrade typescript 3.8.3 => 3.7.5 I get not the exact but similar to original error:

ERROR in node_modules/ts-loader/dist/interfaces.d.ts:57:18 - error TS2320: Interface 'SolutionBuilderWithWatchHost' cannot simultaneously extend types 'SolutionBuilderWithWatchHost<EmitAndSemanticDiagnosticsBuilderProgram>' and 'WatchFactory'.
  Named property 'watchDirectory' of types 'SolutionBuilderWithWatchHost<EmitAndSemanticDiagnosticsBuilderProgram>' and 'WatchFactory' are not identical.

57 export interface SolutionBuilderWithWatchHost extends typescript.SolutionBuilderWithWatchHost<typescript.EmitAndSemanticDiagnosticsBuilderProgram>, WatchFactory {
                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/ts-loader/dist/interfaces.d.ts:57:18 - error TS2320: Interface 'SolutionBuilderWithWatchHost' cannot simultaneously extend types 'SolutionBuilderWithWatchHost<EmitAndSemanticDiagnosticsBuilderProgram>' and 'WatchFactory'.
  Named property 'watchFile' of types 'SolutionBuilderWithWatchHost<EmitAndSemanticDiagnosticsBuilderProgram>' and 'WatchFactory' are not identical.

57 export interface SolutionBuilderWithWatchHost extends typescript.SolutionBuilderWithWatchHost<typescript.EmitAndSemanticDiagnosticsBuilderProgram>, WatchFactory {

Errors diff (original and typescript@3.7.5 + ts-loader from master branch):

@@ -1,9 +1,9 @@
-ERROR in node_modules/ts-loader/dist/interfaces.d.ts:57:18 - error TS2320: Interface 'SolutionBuilderWithWatchHost' cannot simultaneously extend types 'SolutionBuilderWithWatchHost' and 'WatchFactory'.
-Named property 'watchDirectory' of types 'SolutionBuilderWithWatchHost' and 'WatchFactory' are not identical.
+ERROR in node_modules/ts-loader/dist/interfaces.d.ts:57:18 - error TS2320: Interface 'SolutionBuilderWithWatchHost' cannot simultaneously extend types 'SolutionBuilderWithWatchHost<EmitAndSemanticDiagnosticsBuilderProgram>' and 'WatchFactory'.
+  Named property 'watchDirectory' of types 'SolutionBuilderWithWatchHost<EmitAndSemanticDiagnosticsBuilderProgram>' and 'WatchFactory' are not identical.
 
 57 export interface SolutionBuilderWithWatchHost extends typescript.SolutionBuilderWithWatchHost<typescript.EmitAndSemanticDiagnosticsBuilderProgram>, WatchFactory {
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-node_modules/ts-loader/dist/interfaces.d.ts:57:18 - error TS2320: Interface 'SolutionBuilderWithWatchHost' cannot simultaneously extend types 'SolutionBuilderWithWatchHost' and 'WatchFactory'.
-Named property 'watchFile' of types 'SolutionBuilderWithWatchHost' and 'WatchFactory' are not identical.
+                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+node_modules/ts-loader/dist/interfaces.d.ts:57:18 - error TS2320: Interface 'SolutionBuilderWithWatchHost' cannot simultaneously extend types 'SolutionBuilderWithWatchHost<EmitAndSemanticDiagnosticsBuilderProgram>' and 'WatchFactory'.
+  Named property 'watchFile' of types 'SolutionBuilderWithWatchHost<EmitAndSemanticDiagnosticsBuilderProgram>' and 'WatchFactory' are not identical.
 
 57 export interface SolutionBuilderWithWatchHost extends typescript.SolutionBuilderWithWatchHost<typescript.EmitAndSemanticDiagnosticsBuilderProgram>, WatchFactory {

So technically, in terms of TS typings, it looks like a breaking change comes in next release and then "typescript": "*" peer dependency doesn't look accurate enough. But majority of users won't notice the issue due to the JS webpack config file use and skipLibCheck workaround is there for legacy/typescript@<3.8.x users. So not a big concern I think. Maybe it's worth to add some tests in this project with TS-based webpack config use that would run using several recent TS releases.

@johnnyreilly
Copy link
Member

johnnyreilly commented Mar 22, 2020

If you'd like to add one of those tests I'd be very grateful 😄

Yeah the issue will have been resolved by this change here: 87340f4#diff-a84f60e04d03dd963458bd8a12f9ac20R71

Technically this is a breaking change, but because it's a fairly niche use case I think I'm happy to just treat it as a bugfix. I've raised a release PR: #1073

I'll plan to ship it some time today unless you've any compelling reason not to?

@vladimiry
Copy link
Author

If you'd like to add one of those tests I'd be very grateful smile

I'm not ready to do that at the moment 😄

I'll plan to ship it some time today unless you've any compelling reason not to?

I don't, would be happy to update to a new version.

Closing the issue since version in master branch is working well and is about to be released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants