jackbsteinberg / get-originals-rewriter

BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Change script type to ts.scriptKind.JS #77

Closed jackbsteinberg closed 5 years ago

jackbsteinberg commented 5 years ago

Currently the ts-ast-viewer seems to ignore JSDoc comments on function declarations, e.g.:

/**
 * @param {Element} elt
 */
function fn(elt) {
    elt.remove();
}

Where type for elt shows up as "any." This, however, changes when I change the script kind to ts.scriptKind.JS, at which point the type shows up as expected due to the JSDoc.

Currently there are no tests that cover function behavior (reflected in issue #31), but if the default script kind is the same in the rewriter as it is in the ast-viewer (ts.scriptKind.TSX), then JSDoc function tests will fail. So it would probably be a good idea to change this.

domenic commented 5 years ago

I've noticed this issue before but I want to find a test that fails before the change and passes after to really confirm it, before actually making the change.

fergald commented 5 years ago

On Thu, 12 Sep 2019 at 13:57, Domenic Denicola notifications@github.com wrote:

I've noticed this issue before but I want to find a test that fails before the change and passes after to really confirm it, before actually making the change.

Doesn't this fix types that are only known from jsdoc comments?

F

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jackbsteinberg/get-originals-rewriter/issues/77?email_source=notifications&email_token=ABAO5ZYTK4YMH5EVS6UOCX3QJHD43A5CNFSM4IV67VHKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6QU4OY#issuecomment-530665019, or mute the thread https://github.com/notifications/unsubscribe-auth/ABAO5Z7ZJMFKOHOCYNFBLVTQJHD43ANCNFSM4IV67VHA .

domenic commented 5 years ago

Per the discussion in #80 it doesn't seem to be necessary.