-
Notifications
You must be signed in to change notification settings - Fork 3.3k
chore: revive type checker #18172
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
Merged
Merged
chore: revive type checker #18172
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
4962c42
Show type errors.
sainthkh 0a67400
Fix web-config type errors.
sainthkh 82ca2f4
Fix runner-shared.
sainthkh da76eb2
fix types.
sainthkh 4b60e0e
Fix runner reporter types.
sainthkh 6dde25c
Fix driver-related runner errors.
sainthkh 4e4c259
fix driver related runner errors.
sainthkh d4fbde5
fix driver-related reporter error
sainthkh e33c4da
fix extensions
sainthkh ea96207
Fix driver errors.
sainthkh fb9182e
fix server error.
sainthkh 4a21556
Fix desktop-gui errors.
sainthkh 69f1936
Exit with code 1 on failure.
sainthkh d27bc62
fix npm type errors.
sainthkh 95ba267
Fix scss typescript errors.
sainthkh dcc5f9c
Fix type errors.
sainthkh 081b6fe
Fix undefined error in type_check.js
sainthkh 2b31584
Fix failing test.
sainthkh 479fbb2
Fix type error.
sainthkh b705907
Type checker renderer test.
sainthkh d6ca643
Make type-checker work correctly on CI.
sainthkh b93d092
Merge branch 'develop' into issue-18069
flotwig 49342ed
Merge branch 'develop' into issue-18069
flotwig File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
// Shim definition to export a namespace. Cypress is actually a global module | ||
// so import/export isn't allowed there. We import here and define a global module | ||
// so that Cypress can get and use the Blob type | ||
import BluebirdStatic = require('./bluebird') | ||
import ImportedBluebird = require('./bluebird') | ||
|
||
export = Bluebird | ||
export as namespace Bluebird | ||
|
||
declare namespace Bluebird { | ||
type BluebirdStatic = typeof BluebirdStatic | ||
type BluebirdStatic = typeof ImportedBluebird | ||
interface Promise<T> extends ImportedBluebird<T> {} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
npm/create-cypress-tests/src/component-testing/babel/babelTransform.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// This file is automatically generated. | ||
// Please do not change this file! | ||
interface CssExports { | ||
|
||
} | ||
export const cssExports: CssExports; | ||
export default cssExports; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
// @ts-ignore | ||
const { $, dom } = Cypress | ||
|
||
describe('src/cypress/dom/visibility', () => { | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
/// <reference path="../../cli/types/index.d.ts" /> | ||
/// <reference path="../ts/index.d.ts" /> | ||
/// <reference path="../../cli/types/jquery/index.d.ts" /> | ||
|
||
export const $Cypress: Cypress.Cypress | ||
|
||
export const $: typeof JQuery | ||
export const $: JQuery | ||
export default $Cypress |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am confused why this is necessary. Can you explain why the commenting/uncommenting is needed?
And can we generate the
.patch
files instead of inlining them? Would prefer to avoid it if possible.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unlike other projects, Cypress type definition should copy definition files(d.ts) and bundle them ourselves because of the clash of mocha and jest test functions(i.e.
it
,describe
, etc.). For more info, #7194.But when we do them, there are 2 copies of mocha and jquery inside our project. Because of that, they cause errors because of the duplicate definitions of global names.
To avoid that, I had to find a way to comment out one of them. I decided to comment the files inside
node_modules/@types
folder. I did it with patch files added to the project.But the problem is that those patches are applied earlier than copying them to the
cli/types
. So, the copied version is the commented version. That's why I had to write code above.I also don't like this solution and thought about other solutions like below:
post-install.js
. It can comment out already-commented files (i.e. the code will be complicated.)CyMocha
,CyJQuery
definition. => It was impossible because definitions are tightly coupled. Removing some of them cause unexpected problems.The conclusion was the code above.
I also hate this. But it seems that this is the simplest solution unless we remove
mocha
,chai
from Cypress or make them optional.p.s. And this solution is not perfect because it can cause temporary build failures in some environments. For example, I have to build twice on my Ubuntu 20.04 to finish it because the build fails somehow for the type failures.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Blergh. Well, it's certainly an improvement over not having the type-checking at all.
This is the type of thing that will be fixed next time there's an issue anyways, so I'm in favor of merging as-is, even with the kludge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is actually causing problems now we are upgrading to TS 4.4, the whole project build completely explodes with invalid types. We should revisit this soonish.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe, the problem could be solved by fixing all the type errors when
yarn type-check
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lmiller1990 I've updated TypeScript to 4.4.4 at #18930. There were some breaking changes at TypeScript. So, it caused many errors.