-
Notifications
You must be signed in to change notification settings - Fork 86
TS versions for parsing source and linting rules differ #281
Comments
We experience the same issue on |
tslint has typescript as a peer dependency, so it should pick up whatever is installed. So it actually looks like the fault of dtslint's dependencies |
@sandersn Thanks for trying to address this issue 👍 We also use |
@IvanGoncharov try this PR locally: #295 it worked for me like a charm :) |
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 otherSyntaxKind.*
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!
The text was updated successfully, but these errors were encountered: