Skip to content

Commit

Permalink
Explicitly type our enriched signals
Browse files Browse the repository at this point in the history
These are being typed implicitly and verified against SignalSourceHit[]
on the assignment below, but this makes the types explicit and surfaces
a type error here instead of the subsequent assignment.
  • Loading branch information
rylnd committed Feb 10, 2021
1 parent eca579b commit 9b8e343
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export const enrichSignalThreatMatches = async (
buildMatchedIndicator({ queries, threats: matchedThreats })
);

const enrichedSignals = uniqueHits.map((signalHit, i) => {
const enrichedSignals: SignalSourceHit[] = uniqueHits.map((signalHit, i) => {
const threat = get(signalHit._source, 'threat') ?? {};
if (!isObject(threat)) {
throw new Error(`Expected threat field to be an object, but found: ${threat}`);
Expand Down

0 comments on commit 9b8e343

Please sign in to comment.