Skip to content

noImplicitAny rule applied to external packages #8883

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

Closed
johnnyreilly opened this issue May 30, 2016 · 6 comments
Closed

noImplicitAny rule applied to external packages #8883

johnnyreilly opened this issue May 30, 2016 · 6 comments

Comments

@johnnyreilly
Copy link

johnnyreilly commented May 30, 2016

I was trying out the new angular ui router which has been ported to TypeScript and ships with definitions in the box. However, it looks like the compiler rules for my own project are being applied to the angular ui router project as well.

TypeScript Version:

1.8.10

Code

import { StateProvider } from "angular-ui-router";

Using this tsconfig.json:

{
  "compileOnSave": false,
  "compilerOptions": {
    "allowSyntheticDefaultImports": true,
    "module": "es2015",
    "moduleResolution": "node",
    "noEmitOnError": true,
    "noImplicitAny": true,
    "preserveConstEnums": true,
    "removeComments": false,
    "sourceMap": true,
    "suppressImplicitAnyIndexErrors": true,
    "target": "es2015"
  }
}

Expected behavior:
StateProvider is pulled in and can be used. No errors.

Actual behavior:
It errors with:

ERROR in C:\source\poorclaresarundel\PoorClaresAngular\node_modules\angular-ui-router\commonjs\ng1\viewDirective.d.ts
(10,9): error TS7010: 'resolve', which lacks return-type annotation, implicitly has an 'any' return type.

ERROR in C:\source\poorclaresarundel\PoorClaresAngular\node_modules\angular-ui-router\commonjs\common\hof.d.ts
(113,27): error TS7006: Parameter 'ctor' implicitly has an 'any' type.

ERROR in C:\source\poorclaresarundel\PoorClaresAngular\node_modules\angular-ui-router\commonjs\common\hof.d.ts
(113,37): error TS7006: Parameter 'x' implicitly has an 'any' type.

ERROR in C:\source\poorclaresarundel\PoorClaresAngular\node_modules\angular-ui-router\commonjs\common\hof.d.ts
(115,27): error TS7006: Parameter 'comp' implicitly has an 'any' type.

ERROR in C:\source\poorclaresarundel\PoorClaresAngular\node_modules\angular-ui-router\commonjs\common\hof.d.ts
(115,37): error TS7006: Parameter 'x' implicitly has an 'any' type.

ERROR in C:\source\poorclaresarundel\PoorClaresAngular\node_modules\angular-ui-router\commonjs\state\stateBuilder.d.ts
(3,54): error TS7006: Parameter 'parent' implicitly has an 'any' type.

ERROR in C:\source\poorclaresarundel\PoorClaresAngular\node_modules\angular-ui-router\commonjs\transition\transitionServ
ice.d.ts
(75,35): error TS7006: Parameter 'error' implicitly has an 'any' type.

ERROR in C:\source\poorclaresarundel\PoorClaresAngular\node_modules\angular-ui-router\commonjs\common\common.d.ts
(13,37): error TS7006: Parameter 'X' implicitly has an 'any' type.

ERROR in C:\source\poorclaresarundel\PoorClaresAngular\node_modules\angular-ui-router\commonjs\common\common.d.ts
(163,63): error TS7006: Parameter 'T' implicitly has an 'any' type.

ERROR in C:\source\poorclaresarundel\PoorClaresAngular\node_modules\angular-ui-router\commonjs\common\common.d.ts
(163,66): error TS7006: Parameter 'key' implicitly has an 'any' type.

ERROR in C:\source\poorclaresarundel\PoorClaresAngular\node_modules\angular-ui-router\commonjs\common\common.d.ts
(165,71): error TS7006: Parameter 'T' implicitly has an 'any' type.

ERROR in C:\source\poorclaresarundel\PoorClaresAngular\node_modules\angular-ui-router\commonjs\common\common.d.ts
(165,74): error TS7006: Parameter 'key' implicitly has an 'any' type.

All of these are external to my own project; I wouldn't have expected that this would be an issue. As it happens the good folks of angular ui router are planning to remedy this. But if, for whatever reason, they didn't then I'd either have to change the choices made in my own project to align with theirs or not use their project. Neither of those is great.

Would a compiler option that restricts applying these rules to external projects be something you might consider? Whilst packages that ship with typings in the box is at the moment relatively niche I can imagine that changing massively over time.

@basarat
Copy link
Contributor

basarat commented May 30, 2016

Would a compiler option that restricts applying these rules to external projects be something you might consider

I believe the newly introduced skipLibCheck option does exactly that 🌹

@johnnyreilly
Copy link
Author

Thanks @basarat! - I hadn't heard of that option; is that part of 1.8 or is it slated for 2.0?

@johnnyreilly
Copy link
Author

I see it - 2.0. thanks! https://github.com/Microsoft/TypeScript/wiki/Roadmap

@johnnyreilly
Copy link
Author

Will close as it looks like this is resolved by #8735

@basarat
Copy link
Contributor

basarat commented May 30, 2016

@johnnyreilly ↪️ I've made an alm release 0.0.87 that supports this option 🌹

@johnnyreilly
Copy link
Author

I would expect nothing less 😄 🌷

@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants