Category "typescript"

Error TS2322: Type 'Function' is not assignable to type 'string'

I'm trying to do a question answer catalogue that lets me pick questions with their respective answer options from a String Array, however when I try to assign

Is there a way to handle number inputs instead of string with React Native?

I have a react context state for my multi form input values: const [formValues, setFormValues] = useState({ sex: "male", unitSystem: "metric", hei

Why is the imported Angular/TypeScript model not properly mapping over to my service in Angular application?

I am designing a system that tracks mutual fund information entered manually by the user, and am having difficulties getting the application to properly read th

Custom cypress commands is not assignable to parameter of type 'keyof Chainable<any>

In a .ts file I create a test to try and access a custom created command from command.js, createInbox function is underlined with red with the following message

Clear trailing spaces after pasted number in Angular

How do we strip out spaces at the end of the 10digit number when user copies it from place (like email or word docs etc) and pastes it in the search bar? But th

How to throw "expressive" / console friendly exceptions in JavaScript?

JavaScript noob here... I'm exploring various options for throwing exceptions. Throwing a string / primitive value This seems to be bad practice for several rea

i18next/i18n Change Language not working with the whole website

I'm doing a react-typescript app where I need to be able to translate the site. I'm using the i18next library. In the main page the user can change the language

File upload in angular 11

I am starting on angular 11 and am trying to upload a file or multiple files as a post request to my back end API ( that I created in node.js ) Here is the code

React, typescript: Wrapping text inside table <td> doesn't work

I'd like to wrap the text inside a table cell. I tried "flex-wrap", "break-inside" and similar properties, nothing has worked so far. It has already worked a fe

How does Typescript know where dist/index.js is, if it doesn't exist?

There is something I don't understand about this. I am trying to learn Typescript and I got me this boilerplate code using Snowpack and it contains an index.htm

How to refer to a class with private constructor in a function with generic type parameters?

I have a base class and multiple classes that extend that base class which all have a private constructor. I now want to create a static function that creates n

Typescript based React: importScripts() gives: 'importScripts' is not defined no-undef

Following Google Workbox instructions, the first thing I am told I should include in serviceWorker.js is: importScripts('https://storage.googleapis.com/workbox

Import Typescript/JSX code directly from npm package

I am trying to build a very basic custom npm package which will be imported in a Typescript React app (created with CRA). React app ALPHA: import {MyText} from

React chartjs 2 - Type 'string' is not assignable to type '"timeseries"'

I've been trying to set x-axis as timescale in react-chartjs-2, but can't get past this following error. Chart options code snippet: const options = { plugin

Create an interface in typescript in which only one of two properties are allowed?

Let say I have an interface interface ICart { property1?: string, propert2?: string, someOtherProperty: string } How can I enforce that only one

How to save line breaks in database

I'm using typeorm to management my databse with nestjs framework on server and vuejs on client side, in settings i must provide a large text and i must to save

React useState - using one State per component vs multiples states? [closed]

What is a better way to optimize and do the code more readable in React using Hooks / Functional components; Having a single setState hook or

Vue 3 - Extend a Vue component with additional props with Typescript support

I'm trying to extend a 3rd party Vue component (from PrimeVue) and add additional props, but I'd like to keep the typings of the original component and also uni

VeeValidate and YUP async lazy email validation sending requests for every input in form on background

I'm trying to add lazy e-mail unique validator to my registration form. It works but when i type something in other fields (including e-mail field also) unique

How to check type of object in typescript

I have a JSON file containing two different types of Objects in it. I want to iterate over the JSON with respect to their type. To illustrate my problem I creat