From 95168bf1361242788f5fa80350910631e3f1ac32 Mon Sep 17 00:00:00 2001 From: Jiachi Liu Date: Tue, 12 Dec 2023 01:07:17 +0100 Subject: [PATCH] Fix third party typings (#59503) --- packages/third-parties/google.d.ts | 2 +- packages/third-parties/package.json | 3 ++- packages/third-parties/src/ThirdPartyScriptEmbed.tsx | 4 ++-- .../third-parties/src/google/google-maps-embed.tsx | 1 - packages/third-parties/src/types/google.ts | 11 ++++++----- .../third-parties/app/ga/{page.js => page.tsx} | 2 +- .../app/google-maps-embed/{page.js => page.tsx} | 0 .../third-parties/app/gtm/{page.js => page.tsx} | 0 .../app/youtube-embed/{page.js => page.tsx} | 0 9 files changed, 12 insertions(+), 11 deletions(-) rename test/e2e/app-dir/third-parties/app/ga/{page.js => page.tsx} (93%) rename test/e2e/app-dir/third-parties/app/google-maps-embed/{page.js => page.tsx} (100%) rename test/e2e/app-dir/third-parties/app/gtm/{page.js => page.tsx} (100%) rename test/e2e/app-dir/third-parties/app/youtube-embed/{page.js => page.tsx} (100%) diff --git a/packages/third-parties/google.d.ts b/packages/third-parties/google.d.ts index f2380e47da..5034b52a44 100644 --- a/packages/third-parties/google.d.ts +++ b/packages/third-parties/google.d.ts @@ -1 +1 @@ -export * from './dist/types/index' +export * from './dist/google/index' diff --git a/packages/third-parties/package.json b/packages/third-parties/package.json index 3fd3bd7b64..9c7d13cf37 100644 --- a/packages/third-parties/package.json +++ b/packages/third-parties/package.json @@ -12,7 +12,8 @@ } }, "files": [ - "dist" + "dist", + "google.d.ts" ], "license": "MIT", "scripts": { diff --git a/packages/third-parties/src/ThirdPartyScriptEmbed.tsx b/packages/third-parties/src/ThirdPartyScriptEmbed.tsx index 776664600b..e0923f3ef3 100644 --- a/packages/third-parties/src/ThirdPartyScriptEmbed.tsx +++ b/packages/third-parties/src/ThirdPartyScriptEmbed.tsx @@ -4,8 +4,8 @@ import React, { useEffect } from 'react' export type ScriptEmbed = { html?: string | null - height?: number | null - width?: number | null + height?: string | number | null + width?: string | number | null children?: React.ReactElement | React.ReactElement[] dataNtpc?: string } diff --git a/packages/third-parties/src/google/google-maps-embed.tsx b/packages/third-parties/src/google/google-maps-embed.tsx index 2ca5207610..07633a33ca 100644 --- a/packages/third-parties/src/google/google-maps-embed.tsx +++ b/packages/third-parties/src/google/google-maps-embed.tsx @@ -1,4 +1,3 @@ -import React from 'react' import { GoogleMapsEmbed as TPCGoogleMapEmbed } from 'third-party-capital' import ThirdPartyScriptEmbed from '../ThirdPartyScriptEmbed' diff --git a/packages/third-parties/src/types/google.ts b/packages/third-parties/src/types/google.ts index acfb05eb7c..30a4e9f28a 100644 --- a/packages/third-parties/src/types/google.ts +++ b/packages/third-parties/src/types/google.ts @@ -19,14 +19,15 @@ export type GAParams = { } export type GoogleMapsEmbed = { - height?: number - width?: number + height?: number | string + width?: number | string mode: 'place' | 'view' | 'directions' | 'streetview' | 'search' apiKey: string - style: string - allowfullscreen: boolean - loading: 'eager' | 'lazy' + style?: string + allowfullscreen?: boolean + loading?: 'eager' | 'lazy' q?: string + id?: string center?: string zoom?: string maptype?: string diff --git a/test/e2e/app-dir/third-parties/app/ga/page.js b/test/e2e/app-dir/third-parties/app/ga/page.tsx similarity index 93% rename from test/e2e/app-dir/third-parties/app/ga/page.js rename to test/e2e/app-dir/third-parties/app/ga/page.tsx index afbb641949..96a60d6fdb 100644 --- a/test/e2e/app-dir/third-parties/app/ga/page.js +++ b/test/e2e/app-dir/third-parties/app/ga/page.tsx @@ -9,7 +9,7 @@ const Page = () => { } return ( -
+

GA