packager: get rid of type any in ResolutionRequest

Summary:
One of my changeset broke the "ModuleGraph" code without warning earlier because we are using `any`, that equivalent to having no typing at all. This changeset fixes the types so that `ResolutionRequest` is exactly what it actually is: a class usable for any `Module`-looking class, including the normal one, and the "ModuleGraph" one used for Buck builds. That way, the ModuleGraph's `Module` is typechecked against `Moduleish`.

Concretely this change mostly migrates the `Module` to its generic parameter counterpart `TModule` inside `ResolutionRequest`.

Reviewed By: kentaromiura

Differential Revision: D4826256

fbshipit-source-id: fcd7ca08ac6c35e4e9ca983e2aab260e352bcb4e
This commit is contained in:
Jean Lauliac
2017-04-04 07:06:25 -07:00
committed by Facebook Github Bot
parent 03892d1036
commit 8755338728
11 changed files with 67 additions and 43 deletions

View File

@@ -226,7 +226,8 @@ class Module {
if (hasteImpl !== undefined) {
const {enforceHasteNameMatches} = hasteImpl;
if (enforceHasteNameMatches) {
/* $FlowFixMe: this rely on the above if being executed, that is fragile. Rework the algo. */
/* $FlowFixMe: this rely on the above if being executed, that is fragile.
* Rework the algo. */
enforceHasteNameMatches(this.path, this._hasteNameCache.hasteName);
}
this._hasteNameCache = {hasteName: hasteImpl.getHasteName(this.path)};