From 5d2b4ee5c4a6b456bed4ee2b4a8cde4947e2a811 Mon Sep 17 00:00:00 2001 From: Tommy Nguyen <4123478+tido64@users.noreply.github.com> Date: Thu, 18 Aug 2022 07:05:05 -0700 Subject: [PATCH] Fix codegen trying to parse `.d.ts` files (#34439) Summary: With react-native 0.70-rc.3 and new arch, codegen may fail if it encounters `.d.ts` files because specs may appear to be unused. ## Changelog [General] [Fixed] - Codegen should ignore `.d.ts` files Pull Request resolved: https://github.com/facebook/react-native/pull/34439 Test Plan: See repro in https://github.com/microsoft/react-native-test-app/pull/1052. The build will fail without manually patching this in. If you prefer to use your own test app, try adding [react-native-safe-area-context](https://github.com/th3rdwave/react-native-safe-area-context) as a dependency. Reviewed By: cipolleschi Differential Revision: D38826388 Pulled By: cortinico fbshipit-source-id: eb7c9be2d49286bae86b2428862fbf20f6f32ca5 --- .../src/cli/combine/combine-js-to-schema-cli.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/react-native-codegen/src/cli/combine/combine-js-to-schema-cli.js b/packages/react-native-codegen/src/cli/combine/combine-js-to-schema-cli.js index 1c8fc7bc2f437e..a1f09deff48e21 100644 --- a/packages/react-native-codegen/src/cli/combine/combine-js-to-schema-cli.js +++ b/packages/react-native-codegen/src/cli/combine/combine-js-to-schema-cli.js @@ -27,7 +27,9 @@ function filterJSFile(file: string) { // NativeSampleTurboModule is for demo purpose. It should be added manually to the // app for now. !file.endsWith('NativeSampleTurboModule.js') && - !file.includes('__tests') + !file.includes('__tests') && + // Ignore TypeScript type declaration files. + !file.endsWith('.d.ts') ); }