Skip to content

Add "allowImplicitAnyImports" compiler option for usage with "noImplicitAny" #15878

@rummelsworth

Description

@rummelsworth

TypeScript Version: 2.3.2

Code

import _ = require('lodash')
// with 'noImplicitAny' compiler option and without '@types/lodash' package dependency

Desired behavior:

The compiler emits no error.

Actual behavior:

The compiler emits this error:

Could not find a declaration file for module 'lodash'. '/project/node_modules/lodash/lodash.js' implicitly has an 'any' type.

Motivation:

  • I want to use lodash (or any non-TS package) without types.
  • I want to have noImplicitAny turned on for my own code.
  • I want to not depend on @types packages, which for many JS packages do not exist. (And unfortunately some of the ones that do exist are poorly maintained.)
  • I want to not add .d.ts files for every non-typed third-party JS package I need to use.
  • I want to use TS's import-require (not var-require).

Metadata

Metadata

Assignees

No one assigned

    Labels

    DeclinedThe issue was declined as something which matches the TypeScript visionSuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions