ts-node icon indicating copy to clipboard operation
ts-node copied to clipboard

feat(repl): allow using "type" command on types/interfaces

Open ejose19 opened this issue 4 years ago • 3 comments

This makes "type" command return a more accurate description than the currently any for types/interfaces. It's worth noting that until https://github.com/microsoft/TypeScript/issues/25894 is fixed, interfaces/enums will be shown as just "$kind $identifier".

Based on https://stackoverflow.com/a/55777714.

ejose19 avatar Jul 18 '21 22:07 ejose19

Codecov Report

Merging #1401 (29f103e) into main (e865076) will decrease coverage by 0.02%. The diff coverage is 66.66%.

Impacted Files Coverage Δ
src/index.ts 77.92% <0.00%> (-0.79%) :arrow_down:
src/repl.ts 76.66% <72.72%> (+2.56%) :arrow_up:
src/transpilers/swc.ts 73.80% <0.00%> (-1.20%) :arrow_down:
src/bin.ts 91.40% <0.00%> (ø)

codecov[bot] avatar Jul 18 '21 22:07 codecov[bot]

Regarding the undefined as unknown as ${identifier}, it's required due https://github.com/TypeStrong/ts-node/issues/1126 (https://github.com/TypeStrong/ts-node/issues/1126#issuecomment-721392645), so it's done this way to avoid having errors in subsequent commands.

ejose19 avatar Jul 19 '21 18:07 ejose19

Had to split the type tests into 2 due to the current linked issue, as getQuickInfoAtPosition is using an invalid position after the first type call.

ejose19 avatar Jul 19 '21 18:07 ejose19