Skip to content

Import path not checked when not importing any symbols #20534

@jamietre

Description

@jamietre

Typescript version: 2.6.1

Code

import foo from 'some/valid/module'
> no errors!

import foo from 'something/nonexistent'
> TS2307: Cannot find module 'something/nonexistent'

import 'something/nonexistent'
> no errors!

Expected behavior:

Import statements that don't import any symbols should be checked the same as any other.

Actual behavior:

If you don't import a symbol, the import target is not validated to resolve correctly.

tsconfig.json:

{
  "compilerOptions": {
    "jsx": "react",
    "moduleResolution": "node",
    "noImplicitReturns": true,
    "noImplicitThis": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "removeComments": true,
    "strictNullChecks": true,
    "target": "ES6"
  },
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions