From 04724b2d0c37bac93be2a6f741d4b38b00c912c0 Mon Sep 17 00:00:00 2001 From: Oliver Joseph Ash Date: Tue, 3 Mar 2020 12:08:06 +0000 Subject: [PATCH 1/7] Correct window type Previously this would type error: ```ts cy.window().then(window => window.eval('1')); ``` --- cli/types/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/types/index.d.ts b/cli/types/index.d.ts index 4980930b9a42..1346892cd06c 100644 --- a/cli/types/index.d.ts +++ b/cli/types/index.d.ts @@ -1964,7 +1964,7 @@ declare namespace Cypress { }) ``` */ - window(options?: Partial): Chainable + window(options?: Partial): Chainable /** * Scopes all subsequent cy commands to within this element. From a8644df74dc906077a945991a69ae83125f48cc1 Mon Sep 17 00:00:00 2001 From: Oliver Joseph Ash Date: Tue, 3 Mar 2020 16:50:00 +0000 Subject: [PATCH 2/7] Upgrade minimum TS version from 2.9 to 3.4 `globalThis` was added in 3.4. --- cli/types/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/types/index.d.ts b/cli/types/index.d.ts index 1346892cd06c..8b26aec8c6c9 100644 --- a/cli/types/index.d.ts +++ b/cli/types/index.d.ts @@ -4,7 +4,7 @@ // Mike Woudenberg // Robbert van Markus // Nicholas Boll -// TypeScript Version: 2.9 +// TypeScript Version: 3.4 // Updated by the Cypress team: https://www.cypress.io/about/ /// From 52254ac729a7708e1280d8790924cf753a1af425 Mon Sep 17 00:00:00 2001 From: Oliver Joseph Ash Date: Tue, 3 Mar 2020 16:56:02 +0000 Subject: [PATCH 3/7] Add test --- cli/types/tests/kitchen-sink.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cli/types/tests/kitchen-sink.ts b/cli/types/tests/kitchen-sink.ts index 63b83adbe3c5..f4e745f5bc3a 100644 --- a/cli/types/tests/kitchen-sink.ts +++ b/cli/types/tests/kitchen-sink.ts @@ -116,3 +116,5 @@ const obj = { foo: () => { } } cy.spy(obj, 'foo').as('my-spy') + +cy.window().then(window => window.eval('1')) \ No newline at end of file From c50ce4bdd7ed0df8dd2d30387b5c17bf0c8bc8d9 Mon Sep 17 00:00:00 2001 From: Oliver Joseph Ash Date: Tue, 3 Mar 2020 19:05:46 +0000 Subject: [PATCH 4/7] Format --- cli/types/tests/kitchen-sink.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/types/tests/kitchen-sink.ts b/cli/types/tests/kitchen-sink.ts index f4e745f5bc3a..7bd36217a7cc 100644 --- a/cli/types/tests/kitchen-sink.ts +++ b/cli/types/tests/kitchen-sink.ts @@ -117,4 +117,4 @@ const obj = { } cy.spy(obj, 'foo').as('my-spy') -cy.window().then(window => window.eval('1')) \ No newline at end of file +cy.window().then(window => window.eval('1')) From 36b7d476c73425c4f1056182702fde1114b99642 Mon Sep 17 00:00:00 2001 From: Oliver Joseph Ash Date: Tue, 10 Mar 2020 17:31:54 +0000 Subject: [PATCH 5/7] Test type --- cli/types/tests/kitchen-sink.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cli/types/tests/kitchen-sink.ts b/cli/types/tests/kitchen-sink.ts index 7bd36217a7cc..7fef9fa3579c 100644 --- a/cli/types/tests/kitchen-sink.ts +++ b/cli/types/tests/kitchen-sink.ts @@ -117,4 +117,8 @@ const obj = { } cy.spy(obj, 'foo').as('my-spy') -cy.window().then(window => window.eval('1')) +cy.window().then(window => { + const windowTest: Window & typeof globalThis = window + + window.eval('1')' +}) From c31418583c4b822fcf72748101b43b5d9abebf7c Mon Sep 17 00:00:00 2001 From: Oliver Joseph Ash Date: Wed, 18 Mar 2020 13:43:25 +0000 Subject: [PATCH 6/7] Expect type --- cli/types/tests/kitchen-sink.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/types/tests/kitchen-sink.ts b/cli/types/tests/kitchen-sink.ts index 015d362f30cf..2bbdc5344306 100644 --- a/cli/types/tests/kitchen-sink.ts +++ b/cli/types/tests/kitchen-sink.ts @@ -118,7 +118,7 @@ const obj = { cy.spy(obj, 'foo').as('my-spy') cy.window().then(window => { - const windowTest: Window & typeof globalThis = window + window // $ExpectType Window & typeof globalThis window.eval('1')' }) From 50ea3bcbc2be331fa369ac4036f06a3ae8d79252 Mon Sep 17 00:00:00 2001 From: Oliver Joseph Ash Date: Wed, 18 Mar 2020 13:44:22 +0000 Subject: [PATCH 7/7] Fix syntax error --- cli/types/tests/kitchen-sink.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/types/tests/kitchen-sink.ts b/cli/types/tests/kitchen-sink.ts index 2bbdc5344306..02585f2c76e9 100644 --- a/cli/types/tests/kitchen-sink.ts +++ b/cli/types/tests/kitchen-sink.ts @@ -120,7 +120,7 @@ cy.spy(obj, 'foo').as('my-spy') cy.window().then(window => { window // $ExpectType Window & typeof globalThis - window.eval('1')' + window.eval('1') }) // clearLocalStorage signatures