Skip to content
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

cy.writeFile() is working with JS specs, but not with TypeScript specs #4461

Closed
Kondasamy opened this issue Jun 14, 2019 · 3 comments

Comments

2 participants
@Kondasamy
Copy link

commented Jun 14, 2019

This is in reference to the issue - #4456

Current behavior:

cy.writeFile("../output/oozie_workflows.csv", oozieId + ",False", {
  encoding: 'utf-8'
  flag: "a"
});

The above code works fine with JavaScript specs, but with TypeScript specs - it throws below error message.

Argument of type '{ encoding: string; flag: string; }' is not assignable to parameter of type 'Encodings'.
  Type '{ encoding: string; flag: string; }' is not assignable to type '"utf-16le"'.ts(2345)

I'm sure this something to do with the file: index.d.ts. Please check.

Versions

Cypress - 3.3.1

@jennifer-shehane

This comment has been minimized.

Copy link
Member

commented Jun 14, 2019

Oh, yes, this definitely looks like a Typing issue. Thanks for following up.

cy.writeFile() should allow the following signatures as per https://on.cypress.io/writefile#Syntax

Screen Shot 2019-06-14 at 12 40 05 PM

Definition can be found here: https://github.com/cypress-io/cypress/blob/develop/cli/types/index.d.ts#L1779

dmtrKovalenko added a commit that referenced this issue Jun 14, 2019

Bkucera pushed a commit that referenced this issue Jun 17, 2019

[#4461] Change typescript declaration for .writeFile() (#4463)
* [#4461] Change typescript declaration for .writeFile()

* Fix dtslint error

* Add example to tsdoc definition

* Add testing example of new ts definition

* Fix trailling whitespace
@jennifer-shehane

This comment has been minimized.

Copy link
Member

commented Jun 18, 2019

The code for this is done in #4463, but this has yet to be released. We'll update this issue and reference the changelog when it's released.

@cypress-bot

This comment has been minimized.

Copy link

commented Jun 27, 2019

Released in 3.3.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.