Jonas
Jonas

Reputation: 1

How do I resolve a TS2339 error on another's code with unknown global variabledefinitions?

I'm trying to make a few edits to a library (react-native-draggable-flatlist) to fix a bug with scrolling. But the code (.tsx) has a bunch of errors such as:

      const config = global.LayoutAnimationRepository.configs[t];

The "LayoutAnimationRepository" bit gets underlined in red in Visual Studio, and when hovering my mouse above it I was first told "TS2339: (TS) Property 'LayoutAnimationRepository' does not exist on type 'typeof globalThis'." But then I changed some version numbers in package.json to fix some other errors and now the error message is "TS7017: (TS) element implicitly has an 'any' type because type 'typeof globalthis' has no index signature". I had a similar error previously, but I don't see how that fix would solve this becase I don't know what LayoutAnimationRepository should be defined as.

I'm entirely unfamiliar with typescript, but my colleague (who is also unfamiliar with typescript) thinks that whoever wrote this likely had something in his environment setup that made this all make sense, such as a definition for global.LayoutAnimationRepository. And yes, I've looked, there's no defining mention of LayoutAnimationRepository in the code available.

All of this is simply to ask: is there any way for me to figure out what "LayoutAnimationRepository" is supposed to be and set it up for myself, or is there some other way to fix the error so I can compile the code?

Upvotes: 0

Views: 26

Answers (0)

Related Questions