Skip to content

net-stubbing.ts breaks some TS tooling, should be .d.ts #15644

@vpanta

Description

@vpanta

Current behavior

We use Bazel, and bazelbuild/rules_nodejs generates helper targets to allow arbitrary installed NPMs visibility within Bazel's build dependency tree. When we use this with cypress and need to import cypress/types/net-stubbing, we get the following strictDeps error from Bazel's wrapped tsc:

error TS2307: [strictDeps] transitive dependency on external/npm/node_modules/cypress/types/net-stubbing.ts not allowed. Please add the BUILD target to your rule's deps.

This is due to net-stubbing.ts being seen as a full TS file instead of a type-declaration file (.d.ts), even though (AFAICT) it only contains TS typings.

Desired behavior

It should be visible upstream, even when using Bazel

Test code to reproduce

Not provided, due to the bazel setup this isn't very straightforward

Versions

Cypress 6.3.0
Bazel 3.1.0
rules_nodejs 3.2.1

Suggested Fix

Generate net-stubbing.d.ts instead of net-stubbing.ts, should be generally compatible with other users (assuming they import as cypress/types/net-stubbing).
PR with this suggestion is forthcoming.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: typingsIssue related to Cypress types (for TypeScript)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions