Skip to content
This repository has been archived by the owner on Jan 29, 2024. It is now read-only.

Commit

Permalink
chore: fix flow errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
JSMonk committed Apr 25, 2020
1 parent b3bc235 commit ac96e60
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion packages/core/src/type-graph/call.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,10 @@ export function addCallToTypeGraph(
parent => parent.creator === "block" || parent.creator === "catch"
);
const nearestThrowableScope = findThrowableBlock(currentScope);
addToThrowable(args[0], nearestThrowableScope);
const throwableDeclaration = nearestThrowableScope && nearestThrowableScope.declaration;
if (nearestThrowableScope != null) {
addToThrowable(args[0], nearestThrowableScope);
}
if (
nearestThrowableScope == null ||
nearestThrowableScope.type !== VariableScope.FUNCTION_TYPE ||
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/utils/scope-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ export function findNearestTypeScope(
currentScope
);
do {
// $FlowIssue
if (scope.declaration instanceof VariableInfo) {
if ("localTypeScope" in scope.declaration.type) {
// $FlowIssue
return scope.declaration.type.localTypeScope;
}
if (
scope.declaration.type.instanceType &&
scope.declaration.type.instanceType.subordinateMagicType &&
scope.declaration.type.instanceType != undefined &&
scope.declaration.type.instanceType.subordinateMagicType != undefined &&
// $FlowIssue
"localTypeScope" in scope.declaration.type.instanceType.subordinateMagicType
) {
// $FlowIssue
Expand Down

0 comments on commit ac96e60

Please sign in to comment.