Skip to content

Commit 1243041

Browse files
committed
chore(metro-file-map): exclude problematic types
1 parent 2d6edcb commit 1243041

15 files changed

Lines changed: 17 additions & 210 deletions

File tree

packages/metro-config/src/defaults/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ const getDefaultValues = (projectRoot: ?string): ConfigT => ({
175175
async function getDefaultConfig(rootPath: ?string): Promise<ConfigT> {
176176
// We can add more logic here to get a sensible default configuration, for
177177
// now we just return a stub.
178+
178179
return getDefaultValues(rootPath);
179180
}
180181

packages/metro-file-map/src/cache/DiskCacheManager.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ export class DiskCacheManager implements CacheManager {
150150
}
151151
}
152152

153-
async end() {
153+
async end(): Promise<void> {
154154
// Clear any timers
155155
if (this.#debounceTimeout) {
156156
clearTimeout(this.#debounceTimeout);

packages/metro-file-map/src/flow-types.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,10 @@ export type HasteMapData = Map<string, HasteMapItem>;
380380

381381
export type HasteMapItem = {
382382
[platform: string]: HasteMapItemMetadata,
383+
// Modeling __proto__: null is not representable by TypeScript type system.
384+
/*::
383385
__proto__: null,
386+
*/
384387
};
385388
export type HasteMapItemMetadata = [/* path */ string, /* type */ number];
386389

packages/metro-file-map/src/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,15 +238,19 @@ export default class FileMap extends EventEmitter {
238238
_buildPromise: ?Promise<BuildResult>;
239239
_canUseWatchmanPromise: Promise<boolean>;
240240
_changeID: number;
241+
/*::
241242
_changeInterval: ?IntervalID;
243+
*/
242244
_fileProcessor: FileProcessor;
243245
_console: Console;
244246
_options: InternalOptions;
245247
_pathUtils: RootPathUtils;
246248
_watcher: ?Watcher;
247249
_cacheManager: CacheManager;
248250
_crawlerAbortController: AbortController;
251+
/*::
249252
_healthCheckInterval: ?IntervalID;
253+
*/
250254
_startupPerfLogger: ?PerfLogger;
251255

252256
#hastePlugin: HastePlugin;

packages/metro-file-map/src/watchers/AbstractWatcher.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export class AbstractWatcher implements WatcherBackend {
6363
// Must be implemented by subclasses
6464
}
6565

66-
async stopWatching() {
66+
async stopWatching(): Promise<void> {
6767
this.#emitter.removeAllListeners();
6868
}
6969

packages/metro-file-map/src/watchers/FallbackWatcher.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export default class FallbackWatcher extends AbstractWatcher {
4949
} = Object.create(null);
5050
+watched: {[key: string]: FSWatcher, __proto__: null} = Object.create(null);
5151

52-
async startWatching() {
52+
async startWatching(): Promise<void> {
5353
this._watchdir(this.root);
5454

5555
await new Promise(resolve => {

packages/metro-file-map/types/cache/DiskCacheManager.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,5 @@ export declare class DiskCacheManager implements CacheManager {
3838
getSnapshot: () => CacheData,
3939
$$PARAM_1$$: CacheManagerWriteOptions,
4040
): Promise<void>;
41-
end(): void;
41+
end(): Promise<void>;
4242
}

packages/metro-file-map/types/crawlers/watchman/index.d.ts

Lines changed: 0 additions & 23 deletions
This file was deleted.

packages/metro-file-map/types/crawlers/watchman/planQuery.d.ts

Lines changed: 0 additions & 21 deletions
This file was deleted.

packages/metro-file-map/types/flow-types.d.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -298,10 +298,7 @@ export interface HasteMap {
298298
computeConflicts(): Array<HasteConflict>;
299299
}
300300
export type HasteMapData = Map<string, HasteMapItem>;
301-
export type HasteMapItem = {
302-
[platform: string]: HasteMapItemMetadata;
303-
__proto__: null;
304-
};
301+
export type HasteMapItem = {[platform: string]: HasteMapItemMetadata};
305302
export type HasteMapItemMetadata = [string, number];
306303
export interface MutableFileSystem extends FileSystem {
307304
remove(filePath: Path): null | undefined | FileMetadata;

0 commit comments

Comments
 (0)