What is the proper way to bring in Typescript types from the ebay-api third-party library?

My TypeScript code looks like this:

import type { CoreItem } from 'ebay-api';

declare interface Props {
  item: CoreItem;
}

export default function Item({ item }: Props) {
  // <snip>
}

However, I encounter an issue when trying to build my next.js app. The error message reads as follows:

./src/app/item.tsx:3:15
Type error: Module '"ebay-api"' has no exported member 'CoreItem'. Did you mean to use 'import CoreItem from "ebay-api"' instead?

I am unsure how to properly import the CoreItem type. Can anyone provide guidance on this?

Answer №1

Response from the developer can be found here

The CoreItem is a specific type generated from OpenAPI.

import {components} from 'ebay-api/lib/types/restful/specs/buy_browse_v1_oas3.js';
type CoreItem = components['schemas']['CoreItem'];`

Success!

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Exploring Node Stream.Writable Extension in Typescript 4.8

I'm attempting to craft a basic class that implements Node stream.Writable, but it seems like I can't quite grasp the correct syntax - the compiler keeps throwing errors: https://i.stack.imgur.com/UT5Mt.png https://i.stack.imgur.com/Z81eX.png ...

Angular2 form builder generating dynamic forms based on results of asynchronous calls

When creating my form, I encountered a challenge with passing the results of an asynchronous call to the form builder. This is what I have attempted: export class PerformInspectionPage implements OnInit { checklists: any; inspectionform: FormGroup; n ...

Enhance your Angular app by dynamically adding classes to existing classes on a host component

How can I dynamically add a class to the host component of this angular component? @Component({ selector: 'test', templateUrl: './test.component.html', styleUrls: ['./test.component.scss'], encapsulation: ViewEncapsulation ...

I am experiencing difficulty rendering Next.js

Currently, I am experiencing a challenge rendering elements using JSX in my Next.js project. Here is the code snippet that I am working with: { this.state.projects.forEach((projects)=>{ <Project name={projects.name} id={projects.id ...

Guide to setting up secure routes using NextJS 13

I have been developing a website that includes a login portal for students and faculty. I recently implemented JWT authentication and stored it as a cookie in the browser. Upon successful student login, it redirects to /student However, if someone manuall ...

The data provided must be in the form of an EventTarget

Currently, I am using the latest version of nextjs along with the App Router. My goal is to fetch data from my next API located at the /api endpoint. However, I keep encountering a frustrating error 500. Error [ERR_INTERNAL_ASSERTION]: TypeError [ERR_INV ...

What is the process for obtaining a Component's ElementRef in order to access the BoundingClientRect of that specific Component?

I have successfully created a tooltip using Angular 5.2.0 and ngrx. The tooltip, among other things, receives an ElementRef to the target Element when the state updates, allowing me to position it absolutely: let rect = state.tooltip.target.nativeElement. ...

Using Angular2's NgFor Directive in Components

I am faced with the challenge of converting a tree-like structure into a list by utilizing components and subcomponents in Angular 2. var data = [ {id:"1", children: [ {id:"2", children: [ {id: "3"}, {id: "3"}, {i ...

The socket context provider seems to be malfunctioning within the component

One day, I decided to create a new context file called socket.tsx: import React, { createContext } from "react"; import { io, Socket } from "socket.io-client"; const socket = io("http://localhost:3000", { reconnectionDela ...

Angular 8 delivers an observable as a result following a series of asynchronous requests

I am working on a simple function that executes 3 asynchronous functions in sequence: fetchData() { this.fetchUsers('2') .pipe( flatMap((data: any) => { return this.fetchPosts(data.id); }), fl ...

Receiving a 404 error from an API endpoint in Next.js indicating an error

The issue arises when the ID is not present in the database, resulting in a 404 error. I attempted to implement a check with "if (res.status == 404)" but it seems to trigger the error prior to validation. export const getServerSideProps = async (contex ...

Implementing the Chakra UI NavBar in a Next.js Project (Troubleshooting Navbar Visibility on the Homepage)

I have a basic understanding of coding, so please consider that. I am working on incorporating a NavBar component into my Next.js app. Initially, I followed a tutorial on building a blog site with Next.js. Despite encountering several errors while adding t ...

What is the best way to iterate through all class properties that are specified using class-validator?

I have a class defined using the class-validator package. class Shape { @IsString() value?: string @IsString() id?: string } I am trying to find a way to retrieve the properties and types specified in this class. Is there a method to do s ...

Next.js encounters an error: TypeError - dispatch function is missing

I've encountered a problem while implementing global authentication in my Next.js app, similar to how I would do it in React.js. The issue arises with a TypeError: dispatch is not a function error when attempting to call dispatch! I've tried var ...

When the next() function of bcrypt.hash() is called, it does not activate the save method in mongoose

Attempting to hash a password using the .pre() hook: import * as bcrypt from 'bcrypt'; // "bcrypt": "^1.0.2" (<any>mongoose).Promise = require('bluebird'); const user_schema = new Schema({ email: { type: String, required: tru ...

Create the correct structure for an AWS S3 bucket

My list consists of paths or locations that mirror the contents found in an AWS S3 bucket: const keysS3 = [ 'platform-tests/', 'platform-tests/datasets/', 'platform-tests/datasets/ra ...

The type Observable<any> cannot be assigned to Observable<any> type

I am currently working with angular 5 and ionic 3. I have defined an interface: export interface IAny { getDataSource: Observable<any>; } Components that implement this interface must have the following method: getDataSource () { return ...

Tips for retrieving data from a nested Axios request?

Currently, I am working on a series of steps: Phase 1: Initiate an Axios call to verify if the record exists in the database. Phase 2: In case the record does not exist, trigger a POST API call to establish the data and retrieve the POST response. Pha ...

When deploying a Next.js application in a kubernetes environment, the resources may not be accessible

I have a Next.js application deployed in k8s. While the page is visible, it is unable to find js/css files. The error I receive in the browser console is posted below: https://i.stack.imgur.com/OjVoM.png Here is the docker file being used: FROM node:18-a ...

typescript - specifying the default value for a new class instance

Is there a way to set default values for properties in TypeScript? For example, let's say we have the following class: class Person { name: string age: number constructor(name, age){ this.name = name this.age = age } } We want to ens ...