From f15a55e2b40954806ac38dd0826261b60668a682 Mon Sep 17 00:00:00 2001
From: Parth Parth <34807532+thecodingaviator@users.noreply.github.com>
Date: Fri, 25 Jun 2021 20:49:21 +0530
Subject: [PATCH] feat(client): Migrate to ts (#42467)
* rename
* migrate
* fix: remove duplicate
* fix: linting
Co-authored-by: Parth Parth
Co-authored-by: Oliver Eyton-Williams
---
client/src/components/helpers/link.test.tsx | 16 +++++++++-------
client/src/components/helpers/link.tsx | 2 ++
2 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/client/src/components/helpers/link.test.tsx b/client/src/components/helpers/link.test.tsx
index 92dc93bde3..c6612a214e 100644
--- a/client/src/components/helpers/link.test.tsx
+++ b/client/src/components/helpers/link.test.tsx
@@ -1,25 +1,27 @@
+/* eslint-disable @typescript-eslint/ban-ts-comment */
import React from 'react';
-import renderer, { ReactTestRendererJSON } from 'react-test-renderer';
+import { create } from 'react-test-renderer';
import Link from './link';
describe('', () => {
- const externalLink = renderer
- .create()
- .toJSON() as ReactTestRendererJSON;
- const gatsbyLink = renderer
- .create()
- .toJSON() as ReactTestRendererJSON;
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
+ const externalLink = create().toJSON();
+ const gatsbyLink = create().toJSON();
it('renders to the DOM', () => {
expect(gatsbyLink).toBeTruthy();
});
it('sets target for external links', () => {
+ // @ts-ignore
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
expect(externalLink.props.target).toEqual('_blank');
});
it('does not specify target in gatsbyLink', () => {
+ // @ts-ignore
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
expect(gatsbyLink.props.target).toBeFalsy();
});
});
diff --git a/client/src/components/helpers/link.tsx b/client/src/components/helpers/link.tsx
index 91739a7acb..0f30fe9d12 100644
--- a/client/src/components/helpers/link.tsx
+++ b/client/src/components/helpers/link.tsx
@@ -6,6 +6,8 @@ interface LinkProps {
external?: boolean;
sameTab?: boolean;
to: string;
+ // TODO: figure out what these actually should be
+ other?: any[];
}
const Link = ({