Skip to content

automatic import confuses relative paths and package imports #25279

Closed
@ajafff

Description

@ajafff

TypeScript Version: 3.0.0-dev.20180628

Search Terms: import path, relative

Code

  • clone https://github.com/fimbullinter/wotan
  • yarn
    • creates a symlink node_modules/@fimbul/<name> for each packages/<name>
  • create a new file packages/mimir/src/test.ts and paste the following content:
    expressionNeedsParensWhenReplacingNode;
    getWrappedNodeAtPosition;
    AbstractRule;
  • add imports for all identifiers using quick fixes

Expected behavior:

import { expressionNeedsParensWhenReplacingNode } from "./utils";
import { getWrappedNodeAtPosition } from 'tsutils';
import { AbstractRule } from '@fimbul/ymir';

expressionNeedsParensWhenReplacingNode;
getWrappedNodeAtPosition;
AbstractRule;

Actual behavior:

import { expressionNeedsParensWhenReplacingNode } from "@fimbul/mimir/src/utils";
import { getWrappedNodeAtPosition } from '../../../node_modules/tsutils';
import { AbstractRule } from '../../../node_modules/@fimbul/ymir/src';

expressionNeedsParensWhenReplacingNode;
getWrappedNodeAtPosition;
AbstractRule;

Playground Link:

Related Issues:
#25029

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: Refactoringse.g. extract to constant or function, rename symbolFixedA PR has been merged for this issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions