From e93e178d3b150ba7f2c2818951080837f26f3a8c Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Tue, 2 Nov 2021 16:24:29 +0000 Subject: [PATCH 1/5] fix(deps): update dependency babel-plugin-typescript-to-proptypes to v2 --- package.json | 2 +- yarn.lock | 13 ++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index ee9137be66..bc74231ac0 100644 --- a/package.json +++ b/package.json @@ -99,7 +99,7 @@ "@typescript-eslint/parser": "4.33.0", "babel-jest": "27.3.1", "babel-loader": "8.2.3", - "babel-plugin-typescript-to-proptypes": "1.4.2", + "babel-plugin-typescript-to-proptypes": "2.0.0", "browserslist": "4.17.5", "bundlesize": "0.18.1", "colors": "1.4.0", diff --git a/yarn.lock b/yarn.lock index f6d1a51d60..2adb1ccbb5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7626,18 +7626,17 @@ __metadata: languageName: node linkType: hard -"babel-plugin-typescript-to-proptypes@npm:1.4.2": - version: 1.4.2 - resolution: "babel-plugin-typescript-to-proptypes@npm:1.4.2" +"babel-plugin-typescript-to-proptypes@npm:2.0.0": + version: 2.0.0 + resolution: "babel-plugin-typescript-to-proptypes@npm:2.0.0" dependencies: "@babel/helper-module-imports": ^7.12.5 - "@babel/helper-plugin-utils": ^7.10.4 "@babel/plugin-syntax-typescript": ^7.12.1 "@babel/types": ^7.12.6 peerDependencies: "@babel/core": ^7.0.0 - typescript: ^3.0.0 || ^4.0.0 - checksum: 00a9e3f44c98a9f22b8201d7a24d82928ae6e39aec208f8101d8f3d9d5ea8b5ec420b7ae45558d8c1b6f554031305731973b1731d6a61e2a769a2d39827ae23a + typescript: ^4.0.0 + checksum: 7eef77c5ffd8face65a199d6f23a0fbab2e464c8bd8fcf1e3458b3682bebb08fa4a6fd53cd61564ab5d845ba2ccbabf22a6bb30609fa9b843e1e709ab98715f2 languageName: node linkType: hard @@ -19515,7 +19514,7 @@ __metadata: "@typescript-eslint/parser": 4.33.0 babel-jest: 27.3.1 babel-loader: 8.2.3 - babel-plugin-typescript-to-proptypes: 1.4.2 + babel-plugin-typescript-to-proptypes: 2.0.0 browserslist: 4.17.5 bundlesize: 0.18.1 colors: 1.4.0 From fb9a9c541b75372521d42d37d4ad372eac244070 Mon Sep 17 00:00:00 2001 From: Yemitan Isaiah Olurotimi Date: Thu, 4 Nov 2021 11:43:02 +0100 Subject: [PATCH 2/5] fix(babel-plugin-typescript-to-proptypes): remove patch file --- ...plugin-typescript-to-proptypes+1.4.2.patch | 29 ------------------- 1 file changed, 29 deletions(-) delete mode 100644 patches/babel-plugin-typescript-to-proptypes+1.4.2.patch diff --git a/patches/babel-plugin-typescript-to-proptypes+1.4.2.patch b/patches/babel-plugin-typescript-to-proptypes+1.4.2.patch deleted file mode 100644 index 072dca76e7..0000000000 --- a/patches/babel-plugin-typescript-to-proptypes+1.4.2.patch +++ /dev/null @@ -1,29 +0,0 @@ -diff --git a/node_modules/babel-plugin-typescript-to-proptypes/lib/convertBabelToPropTypes.js b/node_modules/babel-plugin-typescript-to-proptypes/lib/convertBabelToPropTypes.js -index 4d3252f..c939b42 100644 ---- a/node_modules/babel-plugin-typescript-to-proptypes/lib/convertBabelToPropTypes.js -+++ b/node_modules/babel-plugin-typescript-to-proptypes/lib/convertBabelToPropTypes.js -@@ -141,6 +141,13 @@ function convert(type, state, depth) { - } - else if (NATIVE_BUILT_INS.includes(name)) { - return propTypes_1.createCall(core_1.types.identifier('instanceOf'), [core_1.types.identifier(name)], propTypesImportedName); -+ // PATCH: Record -> PropTypes.objectOf(PropTypes.string) -+ } -+ else if (name === 'Record') { -+ const result = convert(type.typeParameters.params[1], state, depth); -+ if (result) { -+ return propTypes_1.createCall(core_1.types.identifier('objectOf'), [result], propTypesImportedName); -+ } - // inline references - } - else if (state.referenceTypes[name]) { -@@ -154,8 +161,8 @@ function convert(type, state, depth) { - else if (state.typeChecker) { - return convertTSToPropTypes_1.convertSymbolFromSource(state.filePath, name, state); - } -- // Nothing found, so just omit -- return null; -+ // PATCH: return `any` in case a type cannot be mapped. For example, when the prop refers to a generic type. -+ return propTypes_1.createMember(core_1.types.identifier('any'), propTypesImportedName); - // [] -> PropTypes.arrayOf(), PropTypes.array - } - else if (core_1.types.isTSArrayType(type)) { From 96df9101c269f6a3761dd634436b36562985fbbe Mon Sep 17 00:00:00 2001 From: Yemitan Isaiah Olurotimi Date: Thu, 4 Nov 2021 11:47:19 +0100 Subject: [PATCH 3/5] docs: changeset --- .changeset/stale-crews-pull.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changeset/stale-crews-pull.md diff --git a/.changeset/stale-crews-pull.md b/.changeset/stale-crews-pull.md new file mode 100644 index 0000000000..f09fd23f3c --- /dev/null +++ b/.changeset/stale-crews-pull.md @@ -0,0 +1,6 @@ +--- + +--- + +fix(deps): update dependency babel-plugin-typescript-to-proptypes to v2 +fix(babel-plugin-typescript-to-proptypes): remove patch file From a9e201df902b738d04bc6879e40d54d3baab2ed9 Mon Sep 17 00:00:00 2001 From: Yemitan Isaiah Olurotimi Date: Tue, 9 Nov 2021 15:29:20 +0100 Subject: [PATCH 4/5] chore(babel-config): enable mapUnknownReferenceTypesToAny --- babel.config.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/babel.config.js b/babel.config.js index b8d5277566..1755e70f05 100644 --- a/babel.config.js +++ b/babel.config.js @@ -12,7 +12,10 @@ module.exports = { ], ], plugins: [ - 'babel-plugin-typescript-to-proptypes', + [ + 'babel-plugin-typescript-to-proptypes', + { mapUnknownReferenceTypesToAny: true }, + ], require('./babel-plugin-package-version'), ], }; From 25d3f5c3313c6089dc392eca8888239fa147f207 Mon Sep 17 00:00:00 2001 From: Yemitan Isaiah Olurotimi Date: Tue, 9 Nov 2021 15:30:41 +0100 Subject: [PATCH 5/5] chore(babel-config): remove changeset --- .changeset/stale-crews-pull.md | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 .changeset/stale-crews-pull.md diff --git a/.changeset/stale-crews-pull.md b/.changeset/stale-crews-pull.md deleted file mode 100644 index f09fd23f3c..0000000000 --- a/.changeset/stale-crews-pull.md +++ /dev/null @@ -1,6 +0,0 @@ ---- - ---- - -fix(deps): update dependency babel-plugin-typescript-to-proptypes to v2 -fix(babel-plugin-typescript-to-proptypes): remove patch file