-
-
Notifications
You must be signed in to change notification settings - Fork 133
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
fix(webpack): fix various TypeScript typing error #1091
Conversation
Manually tested on few selected skeletons but not all. |
@huochunpeng Unfortunately, I could not replicate the issue #1090. I have following package versions for my project. protractor in my package-lock does not have explicit It might not be the case, but I think fixing the typeroot in this way may cause problem in a monorepo setup with hoisted dependency installation. From TS documentation:
|
Did you try to create a new project? With latest vscode, node and Aurelia cli, on two different boxes, I can reproduce it. |
I created a new project using [email protected], latest vscode, node v10.15.3, npm v6.9.0. |
I am seeing different type issue on the default typescript app. cli v1.0.0-beta.15
|
@bigopon @EisenbergEffect question: do you know why aurelia-loader-nodejs has a reference to |
Probably unintended dep. Can just remove it |
Is it simply removing @bigopon can you clean up TS syntax? The project doesn't compile with latest TS v2, probably need to upgrade to TS v3 too. |
@huochunpeng I am also seeing the similar typings errors in the default TS app as pointed by you. However, I am wondering, what is the need for compiling the spec files for running/building the app. Those files can be built while testing the app, if I am not missing anything. Therefore, I have changed the ts-loader usage to following to get rid of the superfluous error messages. { test: /\.ts$/, loader: [{ loader: "ts-loader", options: { reportFiles: [ srcDir+'/**/*.ts'] } }], include: srcDir } However, in the default app I see dependency neither on |
I have revised this PR:
|
@MichaelPetrinolis could you create a demo repo with package-lock.json (or yarn.lock) committed for us to reproduce your issue? |
Thank you, i create a new project with the following command then npm install, au run and have the following error Here is the created file after npm i |
@MichaelPetrinolis thx! The conflicting
The fix from @Sayan751 doesn't help your case because that only deals with errors on test/ folder. |
using typesRoot fixes it. But don't know if it will have side effects. |
As @Sayan751 pointed out, typeRoot has a small problem that doesn’t work for user who uses lerna. Since it’s between cssnano and protractor for typescript, I can conditionally add typeRoot for the combination, so that the typeRoot’s problem on lerna would not affect most users. Will update this PR. |
… protractor are selected cssnano and protractor load different version of @types/q which confused TypeScript. It's likely only confusing ts-loader because only webpack app is affected, not cli-bundler app. Setting typeRoots is not flexible in lerna hoisting environment, that's why we did not turn it globally for webpack+TypeScript app. closes #1090
@Sayan751 can you do another review? |
For reference, protractor next version v6.0.0 (but v5.4.3 is still latest on npmjs.com) has removed |
The changes look good to me. Just as a side note, maybe a new issue needs to be opened to track the task of updating protractor version to 6.x when it is made latest in npm. |
@EisenbergEffect |
Sorry to note this late, but has anyone run the tests with new webpack config? As the config is changed, does that affect the unit tests? |
I have 2 different configurations for tests and dev that looks something like below. ...when(isTest,
[
{ test: /\.ts$/i,
use:[
//this is just for code-coverage and can be ignored for general setup.
{ loader: "istanbul-instrumenter-loader" },
{ loader: "ts-loader", options: { reportFiles: [ srcDir+'/**/*.ts'] } }
],
include: srcDir },
{ test: /\.ts$/i, loader: "ts-loader", include: testDir, options: { reportFiles: [testDir+'/**/*.ts'] } }
],
[ { test: /\.ts$/i, loader: [{ loader: "ts-loader", options: { reportFiles: [ srcDir+'/**/*.ts'] } }], include: srcDir } ]) |
@Sayan751 I was able to run karma for webpack+typescript+karma app without additional fix on the ts-loader. I have no idea why the |
@huochunpeng At least it is now known that the changed config does not affect the tests. 🙂 I think that is it. I cannot see any other immediate issue with the changes 👍 |
Thx. @EisenbergEffect let's merge this. |
No description provided.