mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
5349b7c7b5
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/49950 Changelog: [GENERAL][CHANGED] - Changed `react-native-codegen` to support types under `CodegenTypes` namespace ## Summary Currently, codegen relies on deep importing types under `react-native/Libraries/Types/CodegenTypes` to be properly type-checked. Updating codegen to support types under a single namespace will enable us to provide a single import from the package with access to all relevant types. Reviewed By: huntie Differential Revision: D70967809 fbshipit-source-id: 41241dcc51965f4243acd34e8b63475cb56ca67a
31 lines
968 B
JavaScript
31 lines
968 B
JavaScript
/**
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @flow strict-local
|
|
* @format
|
|
* @oncall react_native
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
const generator = require('../../../../src/generators/components/GeneratePropsJavaInterface');
|
|
const {FlowParser} = require('../../../../src/parsers/flow/parser');
|
|
const fs = require('fs');
|
|
|
|
const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`;
|
|
const fixtures = fs.readdirSync(FIXTURE_DIR);
|
|
|
|
const parser = new FlowParser();
|
|
|
|
fixtures.forEach(fixture => {
|
|
it(`GeneratePropsJavaInterface can generate for '${fixture}'`, () => {
|
|
const libName = 'RNCodegenModuleFixtures';
|
|
const schema = parser.parseFile(`${FIXTURE_DIR}/${fixture}`);
|
|
const output = generator.generate(libName, schema, undefined, false);
|
|
expect(Object.fromEntries(output)).toMatchSnapshot();
|
|
});
|
|
});
|