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

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

Merged
merged 5 commits into from
Jun 17, 2019

Conversation

dmtrKovalenko
Copy link
Contributor

Closes #4461

Changing typescript definition signature for .writeFile method according to the docs.

@@ -2318,6 +2318,12 @@ declare namespace Cypress {
cancelable: boolean
}

/** Options to change the default behavior of .writeFile */
interface WriteFileOptions extends Loggable {
flag: string
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

flag is only string even in native node's fs declarations

@jennifer-shehane jennifer-shehane requested a review from a team June 14, 2019 08:39
@@ -1776,13 +1776,13 @@ declare namespace Cypress {
})
```
*/
writeFile<C extends FileContents>(filePath: string, contents: C, options?: Partial<Loggable>): Chainable<C>
writeFile<C extends FileContents>(filePath: string, contents: C, encoding: Encodings): Chainable<C>
/**
* Write to a file with the specified encoding and contents.
*
* @see https://on.cypress.io/writefile
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add an example here?

Copy link
Contributor

@bahmutov bahmutov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we also need a tiny example / test in the types test in the CLI folder cli/types/tests

bahmutov
bahmutov previously approved these changes Jun 14, 2019
@bahmutov
Copy link
Contributor

@dmtrKovalenko how is your text editor set up - leaves trailing whitespace

Error: /root/cypress/cli/types/index.d.ts:1785:55
ERROR: 1785:55  no-trailing-whitespace  trailing whitespace

@dmtrKovalenko
Copy link
Contributor Author

@bahmutov I am using prettier + eslint. Tslint is deprecated https://medium.com/palantir/tslint-in-2019-1a144c2317a9

@kuceb
Copy link
Contributor

kuceb commented Jun 14, 2019

@dmtrKovalenko we use dtslint for type definition tests, which relies on tslint, so we still have to use it for cli/types

@dmtrKovalenko
Copy link
Contributor Author

Yeah, I know but it is deprecated way

Copy link
Contributor

@bahmutov bahmutov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cy.writeFile() is working with JS specs, but not with TypeScript specs
4 participants