From 0f30fd9c6c39222ecb2788baf37a14c49fbf5fd0 Mon Sep 17 00:00:00 2001 From: Aiham Hammami Date: Thu, 7 Nov 2019 15:29:12 +1100 Subject: [PATCH 1/2] Fix local/import type declaration conflict Fixes an error introduced by a backwards incompatible change in TypeScript 3.7 which fails if you declare a local type with the same name as an imported type: https://devblogs.microsoft.com/typescript/announcing-typescript-3-7/#local-and-imported-type-declarations-now-conflict --- typings/query-helpers.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/typings/query-helpers.d.ts b/typings/query-helpers.d.ts index b874fac..893ac84 100644 --- a/typings/query-helpers.d.ts +++ b/typings/query-helpers.d.ts @@ -1,4 +1,4 @@ -import { ReactTestInstance } from 'react-test-renderer'; +import { ReactTestInstance as ReactTestInstanceBase } from 'react-test-renderer'; import { Matcher, MatcherOptions } from './matches'; @@ -8,7 +8,7 @@ export type SelectorMatcherOptions = Omit & { selector?: string; }; -type ReactTestInstance = { +type ReactTestInstance = ReactTestInstanceBase & { getProp: (name: string) => NativeTestInstance; parentNode: NativeTestInstance; }; From f9b8626ccdae882c7ac9b23eeb307f61666f6b95 Mon Sep 17 00:00:00 2001 From: Aiham Hammami Date: Thu, 7 Nov 2019 15:58:21 +1100 Subject: [PATCH 2/2] Fix typings: only include getProp/parentNode in NativeTestInstance --- typings/query-helpers.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/typings/query-helpers.d.ts b/typings/query-helpers.d.ts index 893ac84..daabf44 100644 --- a/typings/query-helpers.d.ts +++ b/typings/query-helpers.d.ts @@ -1,4 +1,4 @@ -import { ReactTestInstance as ReactTestInstanceBase } from 'react-test-renderer'; +import { ReactTestInstance } from 'react-test-renderer'; import { Matcher, MatcherOptions } from './matches'; @@ -8,13 +8,13 @@ export type SelectorMatcherOptions = Omit & { selector?: string; }; -type ReactTestInstance = ReactTestInstanceBase & { +type ReactTestInstanceExtended = ReactTestInstance & { getProp: (name: string) => NativeTestInstance; parentNode: NativeTestInstance; }; export type NativeTestInstance = Omit< - ReactTestInstance, + ReactTestInstanceExtended, 'findAllByProps' | 'findAllByType' | 'findByProps' | 'findByType' | 'instance' >;