Skip to content

Commit

Permalink
chore: Update TypeScript to 4.4.4 (#18930)
Browse files Browse the repository at this point in the history
  • Loading branch information
sainthkh authored Nov 19, 2021
1 parent e9accb4 commit 2a6ded2
Show file tree
Hide file tree
Showing 13 changed files with 62 additions and 28 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
"terminal-banner": "1.1.0",
"through": "2.3.8",
"ts-node": "8.3.0",
"typescript": "^4.2.3",
"typescript": "^4.4.4",
"yarn-deduplicate": "3.1.0"
},
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion packages/driver/cypress/integration/cy/snapshot_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ describe('driver/src/cy/snapshots', () => {

cy.createSnapshot(null, this.$el)

expect(attr).to.be.calledWith('data-cypress-el', true)
expect(attr).to.be.calledWith('data-cypress-el', 'true')
})

it('removes data-cypress-el attr', function () {
Expand Down
4 changes: 1 addition & 3 deletions packages/driver/src/cy/snapshots.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,7 @@ export const create = ($$, state) => {
const isJqueryElement = $dom.isElement($elToHighlight) && $dom.isJquery($elToHighlight)

if (isJqueryElement) {
// JQuery.attr doesn't support `true` as a value.
// @ts-ignore
($elToHighlight as JQuery<HTMLElement>).attr(HIGHLIGHT_ATTR, true)
($elToHighlight as JQuery<HTMLElement>).attr(HIGHLIGHT_ATTR, 'true')
}

// TODO: throw error here if cy is undefined!
Expand Down
2 changes: 1 addition & 1 deletion packages/driver/src/cy/testConfigOverrides.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function setConfig (testConfigList: Array<TestConfig>, config, localConfigOverri

try {
config(testConfigOverride)
} catch (e) {
} catch (e: any) {
let err = $errUtils.errByPath('config.invalid_test_override', {
errMsg: e.message,
})
Expand Down
14 changes: 7 additions & 7 deletions packages/network/lib/client-certificates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ export function loadClientCertificateConfig (config) {

try {
pki.certificateFromPem(caRaw)
} catch (error) {
} catch (error: any) {
throw new Error(`Cannot parse CA cert: ${error.message}`)
}

Expand Down Expand Up @@ -251,7 +251,7 @@ export function loadClientCertificateConfig (config) {

try {
pemParsed = pki.certificateFromPem(pemRaw)
} catch (error) {
} catch (error: any) {
throw new Error(`Cannot parse PEM cert: ${error.message}`)
}

Expand Down Expand Up @@ -279,7 +279,7 @@ export function loadClientCertificateConfig (config) {
throw new Error('Cannot load PEM key')
}
}
} catch (error) {
} catch (error: any) {
throw new Error(`Cannot parse PEM key: ${error.message}`)
}

Expand Down Expand Up @@ -332,7 +332,7 @@ export function loadClientCertificateConfig (config) {
`loaded client certificates for ${clientCertificateStore.getCertCount()} URL(s)`,
)
}
} catch (e) {
} catch (e: any) {
debug(
`Failed to load client certificate for clientCertificates[${index}]: ${e.message} ${e.stack}`,
)
Expand Down Expand Up @@ -363,7 +363,7 @@ function extractSubjectFromPem (pem): string {
return pem.subject.attributes
.map((attr) => [attr.shortName, attr.value].join('='))
.join(', ')
} catch (e) {
} catch (e: any) {
throw new Error(`Unable to extract subject from PEM file: ${e.message}`)
}
}
Expand All @@ -377,7 +377,7 @@ function loadPfx (pfx: Buffer, passphrase: string | undefined) {
const certAsn1 = asn1.fromDer(certDer)

return pkcs12.pkcs12FromAsn1(certAsn1, passphrase)
} catch (e) {
} catch (e: any) {
debug(`loadPfx fail: ${e.message} ${e.stackTrace}`)
throw new Error(`Unable to load PFX file: ${e.message}`)
}
Expand All @@ -391,7 +391,7 @@ function extractSubjectFromPfx (pfx) {
const certs = pfx.getBags({ bagType: pki.oids.certBag })[pki.oids.certBag].map((item) => item.cert)

return certs[0].subject.attributes.map((attr) => [attr.shortName, attr.value].join('=')).join(', ')
} catch (e) {
} catch (e: any) {
throw new Error(`Unable to extract subject from PFX file: ${e.message}`)
}
}
2 changes: 1 addition & 1 deletion packages/proxy/lib/http/response-middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ const PatchExpressSetHeader: ResponseMiddleware = function () {
// set the header manually. this way we can retain Node's original error behavior
try {
return originalSetHeader.call(this, name, value)
} catch (err) {
} catch (err: any) {
if (err.code !== 'ERR_INVALID_CHAR') {
throw err
}
Expand Down
2 changes: 1 addition & 1 deletion packages/rewriter/lib/js.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export function _rewriteJsUnsafe (url: string, js: string, deferSourceMapRewrite

try {
astTypes.visit(ast, jsRules)
} catch (err) {
} catch (err: any) {
// if visiting fails, it points to a bug in our rewriting logic, so raise the error to the driver
return _generateDriverError(url, err)
}
Expand Down
2 changes: 1 addition & 1 deletion packages/rewriter/lib/threads/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ parentPort!.on('message', async (req: RewriteRequest) => {
const output = await _getOutput()

_reply({ output, threadMs: _getThreadMs() })
} catch (error) {
} catch (error: any) {
_reply({ error, threadMs: _getThreadMs() })
}

Expand Down
4 changes: 4 additions & 0 deletions packages/runner-shared/src/header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,10 @@ export class Header extends Component<HeaderProps> {

if (!this._studioNeedsUrl) return

// Note: changes in TypeScript 4.4.4 made the code below fail the type check.
// ts interprets visitUrl below as (url: null | undefined) => never
// TODO: studio/studio-recorder.js should be converted to ts. And add proper type.
// @ts-ignore
studioRecorder.visitUrl(this.urlInput)

this.urlInput = ''
Expand Down
2 changes: 1 addition & 1 deletion packages/server/lib/util/file-opener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const openFile = (fileDetails) => {
if (openerId === 'computer') {
try {
require('electron').shell.showItemInFolder(fileDetails.file)
} catch (err) {
} catch (err: any) {
debug('error opening file: %s', err.stack)
}

Expand Down
2 changes: 1 addition & 1 deletion packages/web-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"@babel/preset-react": "7.9.4",
"@babel/preset-typescript": "7.9.0",
"@babel/register": "7.9.0",
"@types/jsdom": "12.2.4",
"@types/jsdom": "16.2.13",
"@types/mock-require": "2.0.0",
"@types/webpack": "4.41.0",
"@types/webpack-dev-server": "^4.0.0",
Expand Down
27 changes: 27 additions & 0 deletions patches/react-vtree+3.0.0-beta.1.patch
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,30 @@ index bb27d60..a4f244f 100644
+// getRecordData: (index: number) => TNodePublicState;
+// treeData: any;
+// }>) => string;
diff --git a/node_modules/react-vtree/dist/lib/utils.d.ts b/node_modules/react-vtree/dist/lib/utils.d.ts
index bb27d60..d5ac63c 100644
--- a/node_modules/react-vtree/dist/lib/utils.d.ts
+++ b/node_modules/react-vtree/dist/lib/utils.d.ts
@@ -12,14 +12,14 @@ export declare type RequestIdleCallbackDeadline = Readonly<{
didTimeout: boolean;
timeRemaining: () => number;
}>;
-declare global {
- const requestIdleCallback: (callback: (deadline: RequestIdleCallbackDeadline) => void, opts?: RequestIdleCallbackOptions) => RequestIdleCallbackHandle;
- const cancelIdleCallback: (handle: RequestIdleCallbackHandle) => void;
- interface Window {
- requestIdleCallback: typeof requestIdleCallback;
- cancelIdleCallback: typeof cancelIdleCallback;
- }
-}
+// declare global {
+// const requestIdleCallback: (callback: (deadline: RequestIdleCallbackDeadline) => void, opts?: RequestIdleCallbackOptions) => RequestIdleCallbackHandle;
+// const cancelIdleCallback: (handle: RequestIdleCallbackHandle) => void;
+// interface Window {
+// requestIdleCallback: typeof requestIdleCallback;
+// cancelIdleCallback: typeof cancelIdleCallback;
+// }
+// }
export declare type DefaultTreeProps = TreeProps<NodeData, NodePublicState<NodeData>, FixedSizeList>;
export declare type DefaultTreeState = TreeState<NodeData, NodePublicState<NodeData>, FixedSizeList>;
export declare type DefaultTreeCreatorOptions = TreeCreatorOptions<NodeData, NodePublicState<NodeData>, DefaultTreeState>;
25 changes: 15 additions & 10 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7827,9 +7827,9 @@
"@types/serve-static" "*"

"@types/filesystem@*":
version "0.0.29"
resolved "https://registry.yarnpkg.com/@types/filesystem/-/filesystem-0.0.29.tgz#ee3748eb5be140dcf980c3bd35f11aec5f7a3748"
integrity sha512-85/1KfRedmfPGsbK8YzeaQUyV1FQAvMPMTuWFQ5EkLd2w7szhNO96bk3Rh/SKmOfd9co2rCLf0Voy4o7ECBOvw==
version "0.0.32"
resolved "https://registry.yarnpkg.com/@types/filesystem/-/filesystem-0.0.32.tgz#307df7cc084a2293c3c1a31151b178063e0a8edf"
integrity sha512-Yuf4jR5YYMR2DVgwuCiP11s0xuVRyPKmz8vo6HBY3CGdeMj8af93CFZX+T82+VD1+UqHOxTq31lO7MI7lepBtQ==
dependencies:
"@types/filewriter" "*"

Expand Down Expand Up @@ -7958,14 +7958,14 @@
dependencies:
"@types/sizzle" "*"

"@types/jsdom@12.2.4":
version "12.2.4"
resolved "https://registry.yarnpkg.com/@types/jsdom/-/jsdom-12.2.4.tgz#845cd4d43f95b8406d9b724ec30c03edadcd9528"
integrity sha512-q+De3S/Ri6U9uPx89YA1XuC+QIBgndIfvBaaJG0pRT8Oqa75k4Mr7G9CRZjIvlbLGIukO/31DFGFJYlQBmXf/A==
"@types/jsdom@16.2.13":
version "16.2.13"
resolved "https://registry.yarnpkg.com/@types/jsdom/-/jsdom-16.2.13.tgz#126c8b7441b159d6234610a48de77b6066f1823f"
integrity sha512-8JQCjdeAidptSsOcRWk2iTm9wCcwn9l+kRG6k5bzUacrnm1ezV4forq0kWjUih/tumAeoG+OspOvQEbbRucBTw==
dependencies:
"@types/node" "*"
"@types/parse5" "*"
"@types/tough-cookie" "*"
parse5 "^4.0.0"

"@types/json-schema@*", "@types/json-schema@^7.0.3", "@types/json-schema@^7.0.4", "@types/json-schema@^7.0.5", "@types/json-schema@^7.0.8":
version "7.0.9"
Expand Down Expand Up @@ -29821,7 +29821,7 @@ parse5-sax-parser@^6.0.1:
dependencies:
parse5 "^6.0.1"

parse5@4.0.0, parse5@^4.0.0:
parse5@4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/parse5/-/parse5-4.0.0.tgz#6d78656e3da8d78b4ec0b906f7c08ef1dfe3f608"
integrity sha512-VrZ7eOd3T1Fk4XWNXMgiGBK/z0MG48BWG2uQNU4I72fkQuKUTZpl+u9k+CxEG0twMVzSmXEEz12z5Fnw1jIQFA==
Expand Down Expand Up @@ -38330,7 +38330,7 @@ typescript@4.1.5:
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.1.5.tgz#123a3b214aaff3be32926f0d8f1f6e704eb89a72"
integrity sha512-6OSu9PTIzmn9TCDiovULTnET6BgXtDYL4Gg4szY+cGsc3JP1dQL8qvE8kShTRx1NIw4Q9IBHlwODjkjWEtMUyA==

typescript@4.2.4, typescript@^4.2.3, typescript@~4.2.4:
typescript@4.2.4, typescript@~4.2.4:
version "4.2.4"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.2.4.tgz#8610b59747de028fda898a8aef0e103f156d0961"
integrity sha512-V+evlYHZnQkaz8TRBuxTA92yZBPotr5H+WhQ7bD3hZUndx5tGOa1fuCgeSjxAzM1RiN5IzvadIXTVefuuwZCRg==
Expand All @@ -38340,6 +38340,11 @@ typescript@^3.9.7:
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.9.9.tgz#e69905c54bc0681d0518bd4d587cc6f2d0b1a674"
integrity sha512-kdMjTiekY+z/ubJCATUPlRDl39vXYiMV9iyeMuEuXZh2we6zz80uovNN2WlAxmmdE/Z/YQe+EbOEXB5RHEED3w==

typescript@^4.2.3, typescript@^4.4.4:
version "4.4.4"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.4.4.tgz#2cd01a1a1f160704d3101fd5a58ff0f9fcb8030c"
integrity sha512-DqGhF5IKoBl8WNf8C1gu8q0xZSInh9j1kJJMqT3a94w1JzVaBU4EXOSMrz9yDqMT0xt3selp83fuFMQ0uzv6qA==

ua-parser-js@0.7.24, ua-parser-js@^0.7.18:
version "0.7.24"
resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.24.tgz#8d3ecea46ed4f1f1d63ec25f17d8568105dc027c"
Expand Down

2 comments on commit 2a6ded2

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 2a6ded2 Nov 19, 2021

Choose a reason for hiding this comment

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

Circle has built the linux x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/9.0.1/circle-develop-2a6ded23522986544b9521eefeefa0d56b0ba221/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 2a6ded2 Nov 19, 2021

Choose a reason for hiding this comment

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

AppVeyor has built the win32 x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/9.0.1/appveyor-develop-2a6ded23522986544b9521eefeefa0d56b0ba221/cypress.tgz

Please sign in to comment.