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

TypeScript types got broken by this project installation #107

Closed
ColCh opened this issue Mar 23, 2018 · 6 comments
Closed

TypeScript types got broken by this project installation #107

ColCh opened this issue Mar 23, 2018 · 6 comments

Comments

@ColCh
Copy link

ColCh commented Mar 23, 2018

We have pure-FrontEnd project, but after this project install, we have strange errors about Timer type, like this.

src/foo.ts(85,13): error TS2322: Type 'Timer' is not assignable to type 'number'.

85             this.timeout = setTimeout(loop, 0);
               ~~~~~~~~~~~~

this is because of node typings installed.

~/W/foo $ stat node_modules/@types/node/
16777220 8595635200 drwxr-xr-x 7 colch Users 0 224 "Mar 23 14:24:40 2018" "Mar 23 14:24:47 2018" "Mar 23 14:24:47 2018" "Mar 23 14:24:40 2018" 4194304 0 0 node_modules/@types/node/

these typings got installed because of this chain:

~/W/foo $ yarn why @types/node/
yarn why v1.5.1
warning package.json: No license field
[1/4] 🤔  Why do we have the module "@types/node/"...?
[2/4] 🚚  Initialising dependency graph...
warning yandex-pcode@0.0.1: No license field
[3/4] 🔍  Finding dependency...
[4/4] 🚡  Calculating file sizes...
=> Found "@types/node@9.4.6"
info Reasons this module exists
   - "fork-ts-checker-webpack-plugin#vue-parser#parse5" depends on it
   - Hoisted from "fork-ts-checker-webpack-plugin#vue-parser#parse5#@types#node"
info Disk size without dependencies: "20MB"
info Disk size with unique dependencies: "20MB"
info Disk size with transitive dependencies: "20MB"
info Number of shared dependencies: 0
✨  Done in 1.24s.

So, the question is, why vue-parser exists in dependencies anyway? We have no vue in project installed anyway, as well as react.

It seems that this introduced by #77

@johnnyreilly
Copy link
Member

If you use window.setTimeout does that work?

@ColCh
Copy link
Author

ColCh commented Mar 23, 2018

Thank you for your answer. Yes, it does. It's a proposed solution?

I wonder if there is possibility to remove node typings from project if it's not used actually

@johnnyreilly
Copy link
Member

They're only devDependencies aren't they? Shouldn't being impacting you?

@ColCh
Copy link
Author

ColCh commented Mar 24, 2018

Sorry but what do you mean about devDependencies?

vue-parser is listed in regular dependencies section https://github.com/Realytics/fork-ts-checker-webpack-plugin/blob/master/package.json#L96

And fork-ts-checker-webpack-plugin - yes, it's development dependency. But we can't build project because TS errors

@johnnyreilly
Copy link
Member

Oh sorry I misunderstood you. vue-parser is in play for Vue support. @prograhammer can likely advise why.

I'm unclear why vue-parser would have @types/node as a dependency but then I don't use Vue so it's not really my area ...

@ColCh
Copy link
Author

ColCh commented Mar 27, 2018

May be just make vue-parser as peerDependency ? I can send PR. What do you think @prograhammer @johnnyreilly ?

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

Successfully merging a pull request may close this issue.

3 participants