cypress-cucumber-preprocessor
cypress-cucumber-preprocessor copied to clipboard
[Regression] types within augmentations.d.ts are not part of dist build
Current behavior
Updated to 20.0.1 and got a type error on window.testState being unknown.
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
- [x] I've read the FAQ.
- [x] I've read instructions for logging issues.
- [x] I'm not using
[email protected]
(package name has changed and it is no longer the most recent version, see #689).
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.
@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.
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.