Closed
Description
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
^~~~~~~