Skip to content

Diagnostics should not include absolute paths #25747

Closed

Description

@evmar

TypeScript Version: 3.1.0-dev.20180717, older verisons too

Search Terms: absolute path diagnostics

Code

// foo.ts
export {};
// bar.ts
import {nosuch} from './foo';

Expected behavior:
Error message about nosuch that mentions paths relative to the project.

Actual behavior:
Error message includes absolute path:

$ tsc
bar.ts:1:9 - error TS2305: Module '"/usr/local/google/home/evanm/t/foo"' has no exported member 'nosuch'.

1 import {nosuch} from './foo';
          ~~~~~~

This matters because:

  • it's confusing and inconsistent with other error messages
  • we don't want to include private paths in error messages
  • if the editor services is running in the cloud or whatever then it references bogus paths

Activity

  1. mhegazy commented on Jul 18, 2018

    @mhegazy
    Contributor

    Internally a module is represented by its full name. i see how this is not desirable in error messages.. we will have to audit all places where we use symbolToString on a module symbol and ensure we show a module specifier that users can understand without being overly verbose. one option is to have a name relative to the current module. another is to make it relative to the current directory (on the command line).

  2. added
    Suggestion
    Domain: Error Messages
    on Jul 18, 2018
  3. evmar commented on Jul 18, 2018

    @evmar
    ContributorAuthor

    I would expect it to be relative to baseUrl (?) like the paths printed in the front of diagnostic messages.

  4. added
    Fixed
    on Nov 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Domain: Error MessagesExperience EnhancementFixedSuggestion

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions