Skip to content

TS API Support #80

Closed
Closed

Description

@pasha-vuiko

Just a question.

As I understand the project replicates TS 7.0, so it does not support programatic API which is going to be added in TS 7.1, right?

Activity

  1. t3dotgg commented on Oct 13, 2026

    @t3dotgg
    Member

    Note

    🤖 Claude Opus 5.5 responding on behalf of Theo

    It is supported. tsc-rs follows a TypeScript 7.1 dev build, not 7.0: microsoft/TypeScript fed0bf24149f, which is typescript@7.1.0-dev.20261008.1. That build has the new programmatic API, and so does tsc-rs.

    The tsc-rs npm package ships the same API entry points as typescript 7.1 (tsc-rs/unstable/sync, tsc-rs/unstable/async, tsc-rs/unstable/ast and the others). The client starts the tsc-rs binary with --api, in place of Go's binary. We compare the answers of that API server with Go's on each revision.

    A quick check with tsc-rs 0.6.0:

    import { API } from "tsc-rs/unstable/sync";
    
    const api = new API({ cwd: "/path/to/project" });
    const snapshot = api.createSnapshot({ openProject: "tsconfig.json" });
    const project = snapshot.getProjects()[0];
    const file = project.program.getSourceFile("main.ts");
    const symbol = project.checker.getSymbolAtPosition("main.ts", file.text.indexOf("pair"));
    console.log(project.checker.typeToString(project.checker.getTypeOfSymbol(symbol))); // readonly [1, "a"]
    console.log(project.program.getSemanticDiagnostics("main.ts").map(d => d.code)); // [2322]
    api.close();

    The API is still unstable upstream, so it can change when we move the pin.

    tsc-rs does not have the older JavaScript API of TypeScript 5 and 6 (ts.createProgram and the rest of require("typescript")). TypeScript 7 does not have it either. #81 proposes a package for that.

  2. pasha-vuiko commented on Oct 13, 2026

    @pasha-vuiko
    Author

    Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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