Skip to content

noImplicitAny rule applied to external packages #8883

Closed
@johnnyreilly

Description

@johnnyreilly

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions