badeball / cypress-cucumber-preprocessor

Run cucumber/gherkin-syntaxed specs with Cypress
MIT License
1.32k stars 147 forks source link

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

Closed jbjhjm closed 4 months ago

jbjhjm commented 7 months ago

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

Checklist

badeball commented 7 months ago

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.

ludo550 commented 4 months ago

@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.

jbjhjm commented 4 months ago

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.