New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cypress.Buffer has the wrong TypeScript type #20542
Labels
type: typings
Issue related to Cypress types (for TypeScript)
Comments
We'd welcome a PR to fix this. |
jennifer-shehane
added
the
type: typings
Issue related to Cypress types (for TypeScript)
label
Mar 9, 2022
dantman
added a commit
to dantman/cypress
that referenced
this issue
Mar 10, 2022
BufferType refers to an instance of Buffer instead of the Buffer type itself. As a result `Cypress.Buffer.from('asdf')` is considered invalid code. To get the Buffer class itself rather than the type for an instance of the class, you need to use the typeof keyword. Fixes cypress-io#20542
5 tasks
cypress-bot
bot
added
the
stage: needs review
The PR code is done & tested, needs review
label
Mar 10, 2022
dantman
added a commit
to dantman/cypress
that referenced
this issue
Mar 10, 2022
BufferType refers to an instance of Buffer instead of the Buffer type itself. As a result `Cypress.Buffer.from('asdf')` is considered invalid code. To get the Buffer class itself rather than the type for an instance of the class, you need to use the typeof keyword. Fixes cypress-io#20542
cypress-bot
bot
added
stage: waiting
and removed
stage: needs review
The PR code is done & tested, needs review
labels
Mar 14, 2022
The code for this is done in cypress-io/cypress#20553, but has yet to be released. |
Released in This comment thread has been locked. If you are still experiencing this issue after upgrading to |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Current behavior
The TypeScript type for
Cypress.Buffer
is currently mapped to the type of a Buffer instance, not the static/constructor.As a result trying to use
Cypress.Buffer.from
gives the TypeScript error:Property 'from' does not exist on type 'Buffer'. Did you mean to access the static member 'Buffer.from' instead?
Desired behavior
Using
Cypress.Buffer.from
should not result in a TypeScript error.Test code to reproduce
Cypress Version
9.5.1
Other
No response
The text was updated successfully, but these errors were encountered: