Is it acceptable to include a @types library as a regular dependency in the package.json file of a Typescript library?

Should the library also be compatible with Typescript projects?

I am developing a Typescript library that utilizes node-fetch and @types/node-fetch, which will be shared through an internal NPM registry within the company.

If I only include @types/node-fetch as a dev-dependency, users of the library who are also using Typescript in their projects will have to manually install the missing types since dev-dependencies are not automatically included.

The solution I currently have is to declare @types/node-fetch as a regular dependency, but it seems unusual (as types are typically not needed for runtime operations).

Is this the correct approach, or is there a better way to handle this situation?

Answer №1

When your public API relies on declarations from @types/node-fetch, it is appropriate to classify it as a regular dependency. Check out this discussion for more information.

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

The assigned type 'string' for Apache ECharts does not match the expected type 'pictorialBar'

This demonstration is functional. Nevertheless, the options utilize any and my goal is to convert them to the EChartOption type. This is my current progress and the demonstration compiles successfully with this setup (With type: 'bar' commented ...

By utilizing the HTML element ID to retrieve the input value, it is possible that the object in Typescript may be null

When coding a login feature with next.js, I encountered an issue: import type { NextPage } from 'next' import Head from 'next/head' import styles from '../styles/Home.module.css' import Router from 'nex ...

TRPC error: The property 'useInfiniteQuery' is not found in the type '{ useQuery'

Issue with TRPC I am facing a problem with my tweetRouter that has a timeline query returning tweets and a NextCursor. However, I encounter an error when trying to access useInfiniteQuery in my components. ** Property 'useInfiniteQuery' does no ...

In the past, my code would run smoothly without any issues, but now I am encountering a runtime error even though the code comp

Recently, I started learning TypeScript and encountered an issue while working with Classes. My code was functioning properly before but now it's displaying a runtime error. ...

Issue with running npm start due to conflicting versions of Babelloader

I have Npm installed on my MacOS, and I keep encountering an ELIFECYCLE error after running either npm run start or npm start. When running the commands, I get the following hints pointing to a project dependency tree issue: [0] It seems to be related to a ...

Is there a way to update all scoped packages to a specific tagged version at once?

Is there a method to upgrade all scoped packages to a specific tag other than latest? For example, let's say I have multiple packages under the scope @scope, such as @scope/pkg1, @scope/pkg2, and so on. These packages have tags like stable. Is it pos ...

Exploring the possibilities of integrating jQuery into Angular 2 using Javascript

import {Component, ElementRef, OnInit} from 'angular2/core'; declare var jQuery:any; @Component({ selector: 'jquery-integration', templateUrl: './components/jquery-integration/jquery-integration.html' } ...

How can one break down enum values in typescript?

I've defined an enum in TypeScript as shown below: export enum XMPPElementName { state = "state", presence = "presence", iq = "iq", unreadCount = "uc", otherUserUnreadCount = "ouc", sequenc ...

Tips for Naming Your GitHub NPM Package for VueJS Package

I decided to customize a git repository of vuejs for my specific project needs. After successfully installing it using the command below: npm install bondythegreat/vue-input-tag --save The installation generates the following line in the package.json fil ...

Testing the Express API with MongoDB on a local machine is successful but encounters a timeout issue on CircleCI

I am facing an issue with testing a RESTful API (built with Express in TypeScript) using Jest. The test passes successfully on my local Windows machine but times out on CircleCI. .circleci/config.ylm version: 2.1 jobs: build: docker: - image: ...

Mocked observables are returned when testing an Angular service that includes parameters

I'm currently exploring various types of unit testing and find myself struggling with a test for a service once again. Here is the function in my service that I need to test: Just to clarify: this.setParams returns an object like {name: 'Test&ap ...

Deploying local NPM modules with npm link to Heroku servers

While using npm link to incorporate my local modules into my app, I encountered an issue. It works perfectly on my machine, but after running grunt and deploying it to Heroku, the system claims that my module cannot be found! Currently, all my files are c ...

There is a compile error stating that the VueLoaderPlugin is unable to support vue rules with oneOf due to the current version of vue-loader

I've been working on a project using Laravel with Vue.js that I downloaded from Gitlab. After installing the dependencies (npm install & composer install), I encountered an issue while trying to compile it. When running the command npm run watch, I re ...

Issue with Material UI: Unable to utilize import statement outside of a module due to Select dependency

Hello there! Here is my query: I am currently working on a project using NextJS + React with node. Everything seems to be running smoothly, except for one issue I encounter when reloading a page with a Select component from Material UI. The relevant code ...

Executing the npm run build command for a React project to generate a

Currently, I am involved in a create-react-app project. To update the deployment, all I do is run npm run build in my local github repository, generating a build folder within the project. Following that, I proceed to transfer the build folder into my co ...

Angular page not reflecting show/hide changes from checkbox

When the user clicks on the checkbox, I need to hide certain contents. Below is the code snippet: <input id="IsBlock" class="e-field e-input" type="checkbox" name="IsBlock" style="width: 100%" #check> To hide content based on the checkbo ...

How can I extract a specific data value from a JSON file in Ionic 2?

Here is the JSON data: [ { "id": 1, "label": "saw", "total": "100" }, { "id": 2, "label": "saw1", "total": "300" }, { "id": 3, "label": "saw2", "total": "400" } ] Below is my Typescript code snippet: this. ...

Could an OpaqueToken be assigned using an observable?

I am attempting to establish an opaque token in the providers using an observable. The purpose behind this is that I am retrieving the value through the Http provider (from an external JSON file). This is my current approach: { provide: SOME_ ...

Issue with playing audio file using HowlerJS

Having trouble playing a .mp3 file in my project directory with Howler. I'm not sure if there's an error in my src. When I tried playing an online hosted audio file, it worked fine. I've placed the audio file in the same directory as Slideon ...

What steps can be taken to address the InvalidPipeArgument error when working with dates?

When attempting to format a date in a specific way using the pipe date, I encountered an error: Uncaught Error: InvalidPipeArgument: 'Unable to convert "25/01/2019" into a date' for pipe 'e' at Xe (main.fc4242d58c261cf678ad.js:1) ...