Repository navigation
Add TypeScript type checking - #6862
Merged
Merged
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Wanted to try using TypeScript with
allowJsandcheckJsto see if it can improve code correctness.Webpack is a good case study for using TypeScript compiler on JavaScript projects. This is still a work in progress and I'm not sure if we can use TypeScript to check for errors without any code modifications.
Issues in TypeScript and DefiantlyTyped
_thisas a variable name.Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference.class Foo {}; let f = new Foo(); f.bar = 1undefinedas value in class constructor to surpass those errorsAdd class member initializations for multiple classes #6987@types/tappabletypes are not accurateClass 'Module' defines instance member property 'identifier', but extended class 'ExternalModule' defines it as instance member function.Add _nodeModulePaths to node Module class DefinitelyTyped/DefinitelyTyped#24526Add deprecated process.bindings to node.js DefinitelyTyped/DefinitelyTyped#24521declarations.d.ts// @ts-ignoredirectivemodule.exportsassignmentsvm.runInThisContextis wrong. it does not accept string filename for optionsstringfor iterator offor..ininObject.keysIssues found in Webpack by TypeScript
compilationDependenciesinCompilation(Fix: Initialize compilationDependencies in Compilation as undefined #6885)WebAssemblyImportDependencyRemove extra argument from WebAssemblyImportDependency constructor call site #6882JavascriptGeneratorhas no constructor but getting arguments Remove extra argument passed to JavascriptGenerator constructor #6881hideStackis being appended toErrorclass.dependencyTemplatesHashMapweak map Use a Map for dependencyTemplatesHashMap instead of a WeakMap #6922cacheMergedwill not work with more than 2 argumentsWhen this is complete?
This is going to be a lot of work to get it to the finish line and I'm not sure if it is inline with the project goals. This is why I'm opening the pull request early. Hoping we can overcome all of those TypeScript issues and make use of TypeScript compiler in Webpack! 🙏
Only comment changes
This pull request on its own should not hav any code changes. TypeScript type checking should be non-invasive and should not make users to change their code. At most, changes should be comments only. If any code change is necessary due to bugs or TS limitations, we are going to propose and merge them in separate pull request.
TypeScript 2.9
The amazing TypeScript team have fixed many issues with the compiler when checking JavaScript code. Those changes are currently (April 11) in the nightly builds of version 2.9. We can merge while depending on nightly version but it would be nicer to depend to
betarelease in master. We should eventually depend on a stable release.@TheLarkInn @DanielRosenwasser @mhegazy