cypress-cucumber-preprocessor icon indicating copy to clipboard operation
cypress-cucumber-preprocessor copied to clipboard

[Regression] types within augmentations.d.ts are not part of dist build

Open jbjhjm opened this issue 1 year ago • 1 comments

Current behavior

Updated to 20.0.1 and got a type error on window.testState being unknown.

image

Desired behavior

window.testState should be known, it is typed within augmentations.d.ts.

Investigation

All types besides those from augmentations.d.ts will be found.

I checked the distributed package and it turns out that it does not contain augmentations.d.ts anymore.

It seems that the file is ignored/discarded when building the library.

Versions

  • Cypress version: 13.0.0
  • Preprocessor version: 20.0.1
  • Node version: 18.17.0

Checklist

jbjhjm avatar Feb 22 '24 09:02 jbjhjm

It seems that the file is ignored/discarded when building the library.

This was intentionally removed during some refactoring or other shenanigans. This SO thread outlines the challenge of exposing global variables: https://stackoverflow.com/questions/55659710/how-to-make-an-npm-module-with-globally-accessible-types

I just didn't feel inclined to comb through that stuff at the time, so I removed the types altogether.

If someone feels otherwise and want to do the work, then feel free to do so.

badeball avatar Feb 23 '24 10:02 badeball

@jbjhjm , This is how I went about this to not show an error. (window as any).testState.pickle.tags . Not the cleanest, but for me, it not showing up with a red underline is good enough.

ludo550 avatar May 15 '24 18:05 ludo550

thanks @ludo550 , workarounds are possible of course, I was just irritated no typings for these are exported. However we've moved on and are not using cucumber anymore, so this issue is not really relevant for me anymore. I think I'll close this for now, and if someone comes along with the same problem it should be easy to find and write a PR for this.

jbjhjm avatar May 16 '24 09:05 jbjhjm