Skip to content

Tag: typescript

Avoiding circular dependencies

I have 2 classes like so. and I understand we should never do this, as this is circular dependency. The problem is, this is the reality. We’re using neo4j, and can get back Risk with Mitigations, or a Mitigation with Risks. How do I approach this case? Answer You can use interfaces instead of a class. Interfaces don’t have implementation

How do I get data from Firebase collection using NextJs API, Firebase Firestore, axios and TypeScript?

I’m using api routes in NextJS 13, to fetch data from Firebase like this(api/locations.tsx): Then I have a component Locations.tsx where I’m trying to store the locations in locations state object like this: But I’m getting an error Property ‘locationsData’ does not exist on type ‘GetLocationResponse’. even though I tried adding “locationsData” to my type definition type GetLocationResponse = {