Skip to content

feat: add .cts extension support to ctx.ast() TypeScript language #455

Description

@rhuanbarreto

Context

From PR #452 review: .cts is not in AST_LANGUAGE_EXTENSIONS.typescript, so ctx.ast("file.cts", "typescript") is rejected by the plausibility guardrail. This is conservative but may be needed as .cts files appear in the wild.

Proposal

  1. Add ".cts" to AST_LANGUAGE_EXTENSIONS.typescript in src/engine/ast-support.ts
  2. In the TypeScript branch of runner.ts, detect .cts and pass sourceType: "script" to parseJsModule (mirroring the .cjs handling)
  3. Add a test in tests/engine/runner-ast.test.ts analogous to the existing .cjs/.mjs test

References

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