Use ?. where it represents the intended semantics (#11512)

This commit is contained in:
Nicolò Ribaudo
2020-05-09 23:31:50 +02:00
committed by GitHub
parent aeb51f463c
commit 31b361b736
47 changed files with 99 additions and 118 deletions

View File

@@ -71,8 +71,9 @@ export function* findRelativeConfig(
loc,
envName,
caller,
packageData.pkg && packageData.pkg.dirname === loc
? packageToBabelConfig(packageData.pkg)
packageData.pkg?.dirname === loc
? // $FlowIgnore - packageData.pkg is not null
packageToBabelConfig((packageData.pkg: ConfigFile))
: null,
);
}

View File

@@ -17,7 +17,8 @@ export type { PartialConfig } from "./partial";
const loadOptionsRunner = gensync<[mixed], Object | null>(function*(opts) {
const config = yield* loadFullConfig(opts);
return config ? config.options : null;
// NOTE: We want to return "null" explicitly, while ?. alone returns undefined
return config?.options ?? null;
});
const maybeErrback = runner => (opts: mixed, callback: Function) => {