Full typescript tsc errors?


#1

So if I have an error that typescript detects, I want to get some full error message that shows the ascii of the code that failed with a marker for exactly where it is. What I am only getting from the webpack scripts generated by “yo openfl” is an error but no “visual” showing of the source. Which makes it hard when there are errors that don’t make sense to my lame human brain w/out more context. I /ass/u/me that “tsc -p .” on a “normal” typescript project would give me such context, but i cannot just do “tsc -p .” with the stuff that “yo openfl” generated, apparently, because it seems to go trying to look for things in node_modules which results in a guhzillion errors.

$ npm run build:dev

test1@1.0.0 build:dev C:\Users\Administrator\Documents\tmp
webpack --config webpack.dev.js

Hash: 6023edc20f45b51d775c
Version: webpack 3.12.0
Time: 6681ms
Asset Size Chunks Chunk Names
app.js 4.81 MB 0 [emitted] [big] main
[0] (webpack)/buildin/global.js 509 bytes {0} [built]
[141] ./src/app.ts 1.33 kB {0} [built] [1 error]
+ 313 hidden modules

ERROR in ./src/app.ts
[tsl] ERROR in C:\Users\Administrator\Documents\tmp\src\app.ts(17,7)
TS2339: Property ‘bar’ does not exist on type ‘Foo’.
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! test1@1.0.0 build:dev: webpack --config webpack.dev.js
npm ERR! Exit status 2


#2

Well for haxe I’d get the error line when using npm from the build.hxml file try to locate a central file in which your app code is compiled. My guess would be app.ts for type script.


#3

The output is a bit different because we use a TypeScript “loader” for Webpack, which compiles files on the fly, which enables hot-reloading using TypeScript sources, rather than a one-off tsc compile.

Isn’t app.ts(17,7) the file, line and column of the error?


#4

one would hope so! …but the line & character # spit out in the error makes no sense compared to my actual sources, hence my desire to be able to actually see what in the heck the tools are thinking. :-}


#5

p.s. i think we should somehow ideally still be able to do “tsc -p .” to get the full compiler’s attention to our code. unfortunately the setup from “yo openfl” doesn’t make a tsconfig.p that seems to actually work re: command line?


#6

The tsc command appears to work, though it throws errors from the TypeScript standard library. That seems like a setup issue, from a global typescript package and a project-specific typescript core types? Not sure