TS versions for parsing source and linting rules differ #281
Description
It all started here, when our CI for linting type definitions for Google APIs started failing after dtslint update: Maxim-Mazurok/google-api-typings-generator#101
First, I thought that something is wrong with TS itself, so I opened issue there with my investigation details: microsoft/TypeScript#37551
But then I found out that dtslint
uses different TS versions for parsing source and for applying linting rules (see microsoft/TypeScript#37551 (comment)).
When parsing source, dtslint uses Linter.createProgram(tsconfigPath)
which resolves to project's TS. But then in rules, it requires internal (bundled) TS: import * as ts from "typescript";
. Which results in unpredicted behavior, because version might not match at all.
In my case, SyntaxKind.VoidKeyword
and other SyntaxKind.*
s values were changed because of microsoft/TypeScript#35998 PR to TS.
I think we should either use projects TS, or use bundled TS version for both tasks. I'll be happy to investigate more and open PR with this change. Let me know what you think, thanks!