tsdjs / tsd

Check TypeScript type definitions
MIT License
2.4k stars 67 forks source link

fix: print the column value of the location more precise #129

Closed mrazauskas closed 2 years ago

mrazauskas commented 2 years ago

It seems that typescript’s programatic API is reporting the location of top left character as 0:0.

See here: https://github.com/microsoft/TypeScript/blob/e1a2c2c5a96760f841e461195ec7ccc59621431a/src/compiler/types.ts#L6225

And here: https://github.com/microsoft/TypeScript/wiki/Using-the-Compiler-API#a-minimal-compiler

In tsc the location of top left character is 1:1. The same with eslint or VS Code.

Currently tsd is correcting the line number with + 1, but the column value is left as is. Hence, the location of top left character is reported as 1:0.

It would be more consistent and precise to + 1 the column as well and to report the top left character as 1:1. (Or to remove + 1 from the line. Somehow 1:1 sounds like better idea.)

mrazauskas commented 2 years ago

Simply run eslint, tsc, and tsd on the same failing test file. Look at column numbers. This is more obvious than my explanation above (;