mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Transform $ReadOnlyArray to ReadonlyArray 18/n (#55152)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/55152 We are transforming the following utility types to be more consistent with typescript and better AI integration: * `$NonMaybeType` -> `NonNullable` * `$ReadOnly` -> `Readonly` * `$ReadOnlyArray` -> `ReadonlyArray` * `$ReadOnlyMap` -> `ReadonlyMap` * `$ReadOnlySet` -> `ReadonlySet` * `$Keys` -> `keyof` * `$Values` -> `Values` * `mixed` -> `unknown` See details in https://fb.workplace.com/groups/flowlang/permalink/1837907750148213/. drop-conflicts Command: `js1 flow-runner codemod flow/transformUtilityType --legacy-type='$ReadOnlyArray'` Reviewed By: SamChou19815 Differential Revision: D90424826 fbshipit-source-id: 207e1abebb50671e8eb2a7f79ecfeaf4569b5b3e
This commit is contained in:
1 parent
7051a07c63
commit
92c32780f1
167 files changed
+416
-417
No files matched your search
@@ -30,14 +30,14 @@ const osTempDir = require('temp-dir');
|
||||
const {globSync} = require('tinyglobby');
|
||||
const {styleText} = require('util');
|
||||
|
||||
const inputFilesPostTransforms: $ReadOnlyArray<PluginObj<unknown>> = [
|
||||
const inputFilesPostTransforms: ReadonlyArray<PluginObj<unknown>> = [
|
||||
require('./transforms/typescript/renameDefaultExportedIdentifiers'),
|
||||
require('./transforms/typescript/stripUnstableApis'),
|
||||
];
|
||||
|
||||
const postTransforms = (
|
||||
options: BuildApiSnapshotOptions,
|
||||
): $ReadOnlyArray<PluginObj<unknown>> => [
|
||||
): ReadonlyArray<PluginObj<unknown>> => [
|
||||
require('./transforms/typescript/simplifyTypes'),
|
||||
require('./transforms/typescript/sortProperties'),
|
||||
require('./transforms/typescript/sortUnions'),
|
||||
@@ -188,7 +188,7 @@ async function findPackagesWithTypedef() {
|
||||
|
||||
async function preparePackagesInTempDir(
|
||||
tempDirectory: string,
|
||||
packages: $ReadOnlyArray<{directory: string, name: string}>,
|
||||
packages: ReadonlyArray<{directory: string, name: string}>,
|
||||
) {
|
||||
await generateConfigFiles(tempDirectory);
|
||||
|
||||
@@ -224,7 +224,7 @@ async function preparePackagesInTempDir(
|
||||
*/
|
||||
async function rewriteLocalImports(
|
||||
tempDirectory: string,
|
||||
packages: $ReadOnlyArray<{directory: string, name: string}>,
|
||||
packages: ReadonlyArray<{directory: string, name: string}>,
|
||||
) {
|
||||
const definitions = globSync('**/*.d.ts', {
|
||||
cwd: tempDirectory,
|
||||
|
||||
@@ -13,7 +13,7 @@ const debug = require('debug')('build-types:resolution');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const TYPEDEF_MAPPING: Record<string, $ReadOnlyArray<string>> = {
|
||||
const TYPEDEF_MAPPING: Record<string, ReadonlyArray<string>> = {
|
||||
'.android.js': ['.js.flow', '.js'],
|
||||
'.ios.js': ['.js.flow', '.js'],
|
||||
'.js': ['.js.flow'],
|
||||
|
||||
@@ -17,7 +17,7 @@ function translatedModuleTemplate({
|
||||
}: {
|
||||
source: string,
|
||||
originalFileName: string,
|
||||
tripleSlashDirectives: $ReadOnlyArray<string>,
|
||||
tripleSlashDirectives: ReadonlyArray<string>,
|
||||
}): string {
|
||||
return signedsource.signFile(
|
||||
`/**
|
||||
|
||||
@@ -17,7 +17,7 @@ import * as babel from '@babel/core';
|
||||
*/
|
||||
async function applyBabelTransformsSeq(
|
||||
source: string,
|
||||
transforms: $ReadOnlyArray<PluginObj<unknown>>,
|
||||
transforms: ReadonlyArray<PluginObj<unknown>>,
|
||||
): Promise<string> {
|
||||
const parsed = await babel.parseAsync(source, {
|
||||
plugins: ['@babel/plugin-syntax-typescript'],
|
||||
|
||||
@@ -13,7 +13,7 @@ import type {PluginObj} from '@babel/core';
|
||||
import * as babel from '@babel/core';
|
||||
import path from 'path';
|
||||
|
||||
type PackageConfig = $ReadOnlyArray<{
|
||||
type PackageConfig = ReadonlyArray<{
|
||||
directory: string,
|
||||
name: string,
|
||||
}>;
|
||||
|
||||
Reference in new issue
Block a user