Description
Discussed in #9340
Originally posted by tmcw October 23, 2023
I just updated to Remix v2 and the newest version of@sentry/remix
. My MetaFunction looks likeexport const meta: MetaFunction = ({ data }) => { return [ { "sentry-trace": data.sentryTrace || "dev", }, { baggage: data.sentryBaggage || "dev", } ]; };
Previously, this was fine because
MetaFunction
made data typedany
but now that it's typedunknown
, TypeScript won't abide by this. The Sentry machinery that insertssentryTrace
seems to be behind the scenes and there's no type helper that I can find that would make this type-check properly.Also, I see that there are integration tests for this but it doesn't seem like the documentation mentions using MetaFunction anymore?
I don't want to type
data
asany
because it would make any other data access in my meta function unsafe. Is there a good way to solve this problem?
We should export a type to be used in place of MetaFunction for Remix v2.