Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tsc: Display source line and mark position where error occurred #4024

Closed
darrylring opened this issue Jul 24, 2015 · 6 comments
Closed

tsc: Display source line and mark position where error occurred #4024

darrylring opened this issue Jul 24, 2015 · 6 comments
Assignees
Labels
Committed The team has roadmapped this issue Fixed A PR has been merged for this issue Suggestion An idea for TypeScript

Comments

@darrylring
Copy link

It would be super helpful to see the source line with the position of the error marked in the output from tsc. I've done a very quick, naive implementation of this (darrylring/TypeScript@0dfcc3ad7d664f622fcd5f139759bd6801d50b5d) and it seems to work nicely:

$ node built/local/tsc.js tests/cases/compiler/errorOnContextuallyTypedReturnType.ts 
tests/cases/compiler/errorOnContextuallyTypedReturnType.ts(1,5): error TS2322: Type '() => void' is not assignable to type '() => boolean'.
  Type 'void' is not assignable to type 'boolean'.
    >>> var n1: () => boolean = function () { }; // expect an error here
            ^~
tests/cases/compiler/errorOnContextuallyTypedReturnType.ts(2,37): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement.
    >>> var n2: () => boolean = function ():boolean { }; // expect an error here
                                            ^~~~~~~
@darrylring darrylring changed the title Display source line and mark position where error occurs tsc: Display source line and mark position where error occurred Jul 24, 2015
@danquirk
Copy link
Member

I believe @DanielRosenwasser was looking at this kind of thing.

@danquirk danquirk added Suggestion An idea for TypeScript In Discussion Not yet reached consensus labels Jul 24, 2015
@darrylring
Copy link
Author

Would a pull request be welcome on this?

@mhegazy
Copy link
Contributor

mhegazy commented Aug 5, 2015

@DanielRosenwasser can you share your work with @darrylring?

@adidahiya
Copy link
Contributor

+1 better compiler UX

@RyanCavanaugh RyanCavanaugh added Committed The team has roadmapped this issue and removed In Discussion Not yet reached consensus labels Nov 3, 2015
@RyanCavanaugh
Copy link
Member

👍 @DanielRosenwasser can you link your PR?

Feedback from meeting was to colorize instead of squiggle, and cap multi-line error spans at one line (not sure if this means one line leading and trailing, or just one total)

@DanielRosenwasser
Copy link
Member

#5140

Give it a try with --pretty when tonight's nightly build goes out.

@DanielRosenwasser DanielRosenwasser added the Fixed A PR has been merged for this issue label Nov 3, 2015
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Committed The team has roadmapped this issue Fixed A PR has been merged for this issue Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

6 participants