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
This commit is contained in:
Tommy Nguyen
2022-08-18 07:05:05 -07:00
committed by Thibault Malbranche
parent 4f7eb6197f
commit 4575ef516f
@@ -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')
);
}