Skip to content

Commit ffaa680

Browse files
SamChou19815facebook-github-bot
authored andcommitted
Add annotations to fix future errors after fix for unsound array types
Summary: X-link: react/react-native#52691 Unannotated array literals are unsound in Flow right now. This diff adds in annotations and makes a few things readonly, to reduce future errors. Changelog: [Internal] Reviewed By: marcoww6 Differential Revision: D78519638 fbshipit-source-id: d98a7668ecf97bcc87dcb3fad25ade736d885d9a
1 parent 91317e2 commit ffaa680

2 files changed

Lines changed: 10 additions & 9 deletions

File tree

packages/metro-source-map/src/__tests__/composeSourceMaps-test.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ describe('composeSourceMaps', () => {
137137
});
138138

139139
test('preserves x_facebook_sources', () => {
140-
const map1 = {
140+
const map1: MixedSourceMap = {
141141
version: 3,
142142
sections: [
143143
{
@@ -153,7 +153,7 @@ describe('composeSourceMaps', () => {
153153
],
154154
};
155155

156-
const map2 = {
156+
const map2: MixedSourceMap = {
157157
version: 3,
158158
sources: ['src-transformed.js'],
159159
names: ['gLoBAl'],
@@ -168,7 +168,7 @@ describe('composeSourceMaps', () => {
168168
});
169169

170170
test('preserves and reindexes x_google_ignoreList', () => {
171-
const map1 = {
171+
const map1: MixedSourceMap = {
172172
version: 3,
173173
sections: [
174174
{
@@ -184,7 +184,7 @@ describe('composeSourceMaps', () => {
184184
],
185185
};
186186

187-
const map2 = {
187+
const map2: MixedSourceMap = {
188188
version: 3,
189189
sources: ['src-transformed.js'],
190190
names: ['gLoBAl'],
@@ -202,7 +202,7 @@ describe('composeSourceMaps', () => {
202202
});
203203

204204
test('x_google_ignoreList: a source with inconsistent ignore status is considered to be ignored', () => {
205-
const map1 = {
205+
const map1: MixedSourceMap = {
206206
version: 3,
207207
sections: [
208208
{
@@ -234,7 +234,7 @@ describe('composeSourceMaps', () => {
234234
],
235235
};
236236

237-
const map2 = {
237+
const map2: MixedSourceMap = {
238238
version: 3,
239239
sources: ['src-transformed.js'],
240240
names: ['gLoBAl'],
@@ -255,7 +255,7 @@ describe('composeSourceMaps', () => {
255255
});
256256

257257
test('preserves sourcesContent', () => {
258-
const map1 = {
258+
const map1: MixedSourceMap = {
259259
version: 3,
260260
sections: [
261261
{
@@ -272,7 +272,7 @@ describe('composeSourceMaps', () => {
272272
],
273273
};
274274

275-
const map2 = {
275+
const map2: MixedSourceMap = {
276276
version: 3,
277277
sources: ['transformed.js'],
278278
names: ([]: Array<string>),

packages/metro-source-map/src/__tests__/generateFunctionMap-test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
'use strict';
1313

1414
import type {Context} from '../generateFunctionMap';
15+
import type {MixedSourceMap} from '../source-map';
1516
import type {NodePath} from '@babel/traverse';
1617
import type {MetroBabelFileMetadata} from 'metro-babel-transformer';
1718

@@ -1435,7 +1436,7 @@ function parent2() {
14351436
const mappings = generateFunctionMappingsArray(ast);
14361437
const encoded = generateFunctionMap(ast);
14371438

1438-
const sourceMap = {
1439+
const sourceMap: MixedSourceMap = {
14391440
version: 3,
14401441
sources: ['input.js'],
14411442
names: ([]: Array<string>),

0 commit comments

Comments
 (0)