From e7c0b5723b0a148ebec63914e71e0a6f13b5b05c Mon Sep 17 00:00:00 2001
From: Jon Surrell <jon.surrell@automattic.com>
Date: Wed, 15 Apr 2020 17:02:35 +0200
Subject: [PATCH] Types: Hide element, primitives, icons declarations (#21613)

Unpublish @wordpress/element, @wordpress/primitives, and @wordpress/icons types

Remove types from pacakge.json to hide the included types. This was
reported to cause conflicts with the current 3rd party typings published
on DefinitelyTyped (DT).

The cause has been identified as:
- DT exports all React typings, which other DT typings depend on.
- Included typings use type aliases (Element -> WPElement) which may
  cause additional conflicts.

See https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/wordpress__element/index.d.ts
See https://unpkg.com/browse/@wordpress/element@2.13.0/build-types/react.d.ts

Reported via core-js slack:

https://wordpress.slack.com/archives/C5UNMSU4R/p1586955177257000

* Add CHANGELOG

* Remove primitives, icons types
---
 packages/element/CHANGELOG.md    | 9 +++++++++
 packages/element/package.json    | 1 -
 packages/icons/CHANGELOG.md      | 9 ++++++++-
 packages/icons/package.json      | 1 -
 packages/primitives/CHANGELOG.md | 9 ++++++++-
 packages/primitives/package.json | 1 -
 tsconfig.json                    | 9 ++++++---
 7 files changed, 31 insertions(+), 8 deletions(-)

diff --git a/packages/element/CHANGELOG.md b/packages/element/CHANGELOG.md
index 2db200bde4fb9..f9ccfd7008f3f 100644
--- a/packages/element/CHANGELOG.md
+++ b/packages/element/CHANGELOG.md
@@ -1,5 +1,14 @@
 ## Master
 
+### Bug Fix
+
+-   Hide TypeScript type declarations ([#21613](https://github.com/WordPress/gutenberg/pull/21613))
+    after they were found to conflict with DefinitelyTyped provided declarations.
+
+## 2.13.0 (2020-04-15)
+
+### New Features
+
 -   Include TypeScript type declarations ([#21248](https://github.com/WordPress/gutenberg/pull/21248))
 -   Graduated `__experimentalCreateInterpolateElement` function to stable api: `createInterpolateElement` (see [20699](https://github.com/WordPress/gutenberg/pull/20699))
 
diff --git a/packages/element/package.json b/packages/element/package.json
index 691c1f39d7b2d..230ed78a4aa92 100644
--- a/packages/element/package.json
+++ b/packages/element/package.json
@@ -21,7 +21,6 @@
 	"main": "build/index.js",
 	"module": "build-module/index.js",
 	"react-native": "src/index",
-	"types": "build-types",
 	"sideEffects": false,
 	"dependencies": {
 		"@babel/runtime": "^7.9.2",
diff --git a/packages/icons/CHANGELOG.md b/packages/icons/CHANGELOG.md
index e89ce48f53652..d84a00ebcfd8c 100644
--- a/packages/icons/CHANGELOG.md
+++ b/packages/icons/CHANGELOG.md
@@ -1,6 +1,13 @@
 ## Master
 
-Include TypeScript type declarations ([#21487](https://github.com/WordPress/gutenberg/pull/21487))
+### Bug Fix
+
+-   Hide TypeScript type declarations ([#21613](https://github.com/WordPress/gutenberg/pull/21613))
+    after they were found to conflict with DefinitelyTyped provided declarations.
+
+## 1.3.0 (2020-04-15)
+
+- Include TypeScript type declarations ([#21487](https://github.com/WordPress/gutenberg/pull/21487))
 
 ## 1.0.0 (2020-02-04)
 
diff --git a/packages/icons/package.json b/packages/icons/package.json
index 045da63bb0271..a5d353b18aade 100644
--- a/packages/icons/package.json
+++ b/packages/icons/package.json
@@ -22,7 +22,6 @@
 	"main": "build/index.js",
 	"module": "build-module/index.js",
 	"react-native": "src/index",
-	"types": "build-types",
 	"dependencies": {
 		"@babel/runtime": "^7.9.2",
 		"@wordpress/element": "../element",
diff --git a/packages/primitives/CHANGELOG.md b/packages/primitives/CHANGELOG.md
index 480dc11051dad..0cf243dfcebc3 100644
--- a/packages/primitives/CHANGELOG.md
+++ b/packages/primitives/CHANGELOG.md
@@ -1,6 +1,13 @@
 ## Master
 
-Include TypeScript type declarations ([#21482](https://github.com/WordPress/gutenberg/pull/21482))
+### Bug Fix
+
+-   Hide TypeScript type declarations ([#21613](https://github.com/WordPress/gutenberg/pull/21613))
+    after they were found to conflict with DefinitelyTyped provided declarations.
+
+## 1.3.0 (2020-04-15)
+
+- Include TypeScript type declarations ([#21482](https://github.com/WordPress/gutenberg/pull/21482))
 
 ## 1.0.0
 
diff --git a/packages/primitives/package.json b/packages/primitives/package.json
index 3e0cf36347ed6..71749034cb44e 100644
--- a/packages/primitives/package.json
+++ b/packages/primitives/package.json
@@ -22,7 +22,6 @@
 	"module": "build-module/index.js",
 	"react-native": "src/index",
 	"sideEffects": false,
-	"types": "build-types",
 	"dependencies": {
 		"@babel/runtime": "^7.9.2",
 		"@wordpress/element": "file:../element",
diff --git a/tsconfig.json b/tsconfig.json
index 28f48647436b5..7f31d9ad53e77 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -5,20 +5,23 @@
 		{ "path": "packages/autop" },
 		{ "path": "packages/blob" },
 		{ "path": "packages/block-editor" },
-		{ "path": "packages/element" },
 		{ "path": "packages/dom-ready" },
 		{ "path": "packages/escape-html" },
 		{ "path": "packages/html-entities" },
 		{ "path": "packages/i18n" },
-		{ "path": "packages/icons" },
 		{ "path": "packages/is-shallow-equal" },
 		{ "path": "packages/prettier-config" },
-		{ "path": "packages/primitives" },
 		{ "path": "packages/priority-queue" },
 		{ "path": "packages/project-management-automation" },
 		{ "path": "packages/token-list" },
 		{ "path": "packages/url" },
 		{ "path": "packages/warning" }
+
+		// Temporarily disabled due to conflicts with 3rd party DefinitelyTyped types
+		// See https://github.com/WordPress/gutenberg/pull/21613
+		// { "path": "packages/element" },
+		// { "path": "packages/icons" },
+		// { "path": "packages/primitives" }
 	],
 	"files": []
 }