-
Notifications
You must be signed in to change notification settings - Fork 758
Apply SourceMaps type to redux actions #8077
Conversation
Signed-off-by: Ryan Duffy <[email protected]>
Thank you for kick-starting this! Do you plan on continuing this PR? |
I do! Thanks for the reminder, @darkwing! |
Signed-off-by: Ryan Duffy <[email protected]>
Signed-off-by: Ryan Duffy <[email protected]>
Signed-off-by: Ryan Duffy <[email protected]>
@@ -130,6 +132,10 @@ async function expandFrames( | |||
}; | |||
|
|||
originalFrames.forEach((originalFrame, j) => { | |||
if (!originalFrame.location || !originalFrame.thread) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this is the right approach. From what I read in XScope.search()
, displayName
will always be present and location
may be present but thread
shouldn't be. However, it was accessed below so perhaps I've misread.
@@ -94,7 +94,7 @@ export async function mapLocation( | |||
return getGeneratedLocation(state, source, location, sourceMaps); | |||
} | |||
|
|||
return sourceMaps.getOriginalLocation(location, source); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure why source
was passed here but seems invalid given the signature of getOriginalLocation
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like a good catch
@jasonLaster + @darkwing - I think this is ready for review. Lemme know what you think. |
quick scan. this looks really good. |
Signed-off-by: Ryan Duffy <[email protected]>
Fixes #7925
Summary of Changes
typeof SourceMaps
instead ofany
/Object
Considerations
I couldn't find a way to import the
typeof
the default export of a module alongside named imports from the same module.Originally, I included two imports and suppressed the eslint error but changed when I realized the frequency this would be required. The current approach is to import the default export and use
typeof
in the instance typing later.I also ran into a couple issues that seem to trace back to flow. I've documented them inline but noting them here for traceability in GitHub.
Explicitly typing an array wrapped by a Promise
facebook/flow#5294
Unable to correctly type the result of a spread on a union type.
facebook/flow#7298