Skip to content
This repository was archived by the owner on Nov 16, 2023. It is now read-only.
This repository was archived by the owner on Nov 16, 2023. It is now read-only.

TS versions for parsing source and linting rules differ #281

Closed
@Maxim-Mazurok

Description

@Maxim-Mazurok

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions