Skip to content

Snippet typechecking (snippet:types) silently passes / fails to run on Windows #145

Description

@Adityakk9031

Describe the bug

When running leadtype lint on Windows, TS/JS code snippet typechecking silently passes even when snippets contain compile/type errors. This happens because the virtual compiler host looks up virtual files using normalized paths (forward slashes /), while the virtual file cache keys are stored with mixed separators.

Steps to reproduce

  1. On Windows, create a document containing a TS code block with a type error (e.g. greet(42) where it expects string).
  2. Run leadtype lint (or run vitest on packages/leadtype/src/lint/snippet-typecheck.test.ts).
  3. Observe that the typechecking violations are not caught and the command returns exit code 0.

Cause

In packages/leadtype/src/lint/snippet-typecheck.ts, virtualDir is resolved via projectRoot (using Windows backslashes \), and the file name is joined using /:

const virtualDir = `${projectRoot}/.leadtype-snippet-${index}`;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions