feat(repl): allow using "type" command on types/interfaces
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.
Codecov Report
Merging #1401 (29f103e) into main (e865076) will decrease coverage by
0.02%. The diff coverage is66.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%> (ø) |
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.
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.