From 457e3f9b7aaa6311f966d2492518a768d5b280f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20B=C3=A4r?= Date: Thu, 17 Jan 2019 17:29:03 +0100 Subject: [PATCH 1/5] Export the new dexpect const instead of expect to avoid exporting the global expect of another module. --- types/detox/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/detox/index.d.ts b/types/detox/index.d.ts index de74163bf1..8ed9d4a9e8 100644 --- a/types/detox/index.d.ts +++ b/types/detox/index.d.ts @@ -8,6 +8,7 @@ declare global { const device: Detox.Device; const element: Detox.Element; const waitFor: Detox.WaitFor; + const dexpect: Detox.Expect>; const expect: Detox.Expect>; const by: Detox.Matchers; @@ -434,4 +435,4 @@ declare global { } } -export { by, detox, device, element, expect, waitFor }; +export { by, detox, device, element, dexpect as expect, waitFor }; From 243426f9854ea97c8a5cc6740252d40841efd23f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20B=C3=A4r?= Date: Mon, 21 Jan 2019 16:06:11 +0100 Subject: [PATCH 2/5] Add comment for new dexpect constant. --- types/detox/index.d.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/types/detox/index.d.ts b/types/detox/index.d.ts index 8ed9d4a9e8..bcf914fac4 100644 --- a/types/detox/index.d.ts +++ b/types/detox/index.d.ts @@ -8,6 +8,12 @@ declare global { const device: Detox.Device; const element: Detox.Element; const waitFor: Detox.WaitFor; + /** + * `dexpect` ("Detox-expect") intentionally has the same type as `expect`. + * `expect` conflicts with the global `expect` of jest and therefore + * exporting it doesn't work which is why `dexpect` was introduced. `expect` + * is kept for backwards compatibility. + */ const dexpect: Detox.Expect>; const expect: Detox.Expect>; const by: Detox.Matchers; From 8109dbd2d8e3d9e2bbafb0910c4b134ba1eac892 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20B=C3=A4r?= Date: Fri, 1 Feb 2019 16:46:48 +0100 Subject: [PATCH 3/5] Change dexpect to not be global any more. --- types/detox/index.d.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/types/detox/index.d.ts b/types/detox/index.d.ts index bcf914fac4..8893aed159 100644 --- a/types/detox/index.d.ts +++ b/types/detox/index.d.ts @@ -8,14 +8,8 @@ declare global { const device: Detox.Device; const element: Detox.Element; const waitFor: Detox.WaitFor; - /** - * `dexpect` ("Detox-expect") intentionally has the same type as `expect`. - * `expect` conflicts with the global `expect` of jest and therefore - * exporting it doesn't work which is why `dexpect` was introduced. `expect` - * is kept for backwards compatibility. - */ - const dexpect: Detox.Expect>; const expect: Detox.Expect>; + const ffffexpect: Detox.Expect>; const by: Detox.Matchers; namespace Detox { @@ -441,4 +435,10 @@ declare global { } } +// `dexpect` ("Detox-expect") intentionally has the same type as `expect`. +// `expect` conflicts with the global `expect` of jest and therefore +// exporting it doesn't work which is why `dexpect` was introduced. `expect` +// is kept for backwards compatibility. +declare const dexpect: Detox.Expect>; + export { by, detox, device, element, dexpect as expect, waitFor }; From 64bbd5d77396e715984fb13263bc9a71f38aff65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20B=C3=A4r?= Date: Fri, 1 Feb 2019 17:21:28 +0100 Subject: [PATCH 4/5] Removed dexpect because of linting error --- types/detox/index.d.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/types/detox/index.d.ts b/types/detox/index.d.ts index 8893aed159..b934cd4723 100644 --- a/types/detox/index.d.ts +++ b/types/detox/index.d.ts @@ -435,10 +435,10 @@ declare global { } } -// `dexpect` ("Detox-expect") intentionally has the same type as `expect`. -// `expect` conflicts with the global `expect` of jest and therefore -// exporting it doesn't work which is why `dexpect` was introduced. `expect` -// is kept for backwards compatibility. -declare const dexpect: Detox.Expect>; +export { by, detox, device, element, waitFor }; -export { by, detox, device, element, dexpect as expect, waitFor }; +// Not exporting the global `expect` from the top of the file here +// because `expect` conflicts with the global `expect` of jest and +// therefore exporting it doesn't work. The global `expect` is kept +// for backwards compatibility though. +export const expect: Detox.Expect>; From 546858e47943aaa713efcd07c0cac6067933ba2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20B=C3=A4r?= Date: Fri, 1 Feb 2019 17:28:31 +0100 Subject: [PATCH 5/5] Delete global that I just introduced for testing something --- types/detox/index.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/types/detox/index.d.ts b/types/detox/index.d.ts index b934cd4723..977f32e249 100644 --- a/types/detox/index.d.ts +++ b/types/detox/index.d.ts @@ -9,7 +9,6 @@ declare global { const element: Detox.Element; const waitFor: Detox.WaitFor; const expect: Detox.Expect>; - const ffffexpect: Detox.Expect>; const by: Detox.Matchers; namespace Detox {