Category "typescript"

How to import js module when Typescript declaration file is located in a separate directory?

Question: When I run npm run build with the configuration below, rollup.js is unable to resolve the dependency (import) and displays the following message below

Angular MatStepper fails to recognize cached values from two str arrays (but successfully recognizes values from another str array)

I have a MatStepper that's used to navigate to the next page of a signup flow. I also have a method that loads values from a cache if it's available, and if so

unable to determine transport target for "pino-pretty"

I am trying to use pino library but I am getting error My code I created a logger.js file and imported pino from node_module and added transport of pino-pretty.

Error in React-Router: 'Type expected. TS1110' after deleting my node_modules folder and package-lock.json

My project was working perfectly well but I went and accidentally deleted my node_modules folder and package-lock.json and then reinstalled everything using npm

How to create a signal that delays the underlying signal and clears immediately

I want to make a signal that sets itself to underlying signal or a memo after a certain delay, and clears immediately if the underlying signal is cleared. The f

Condtional type is not working properly as return type

I'm trying to make a settings system for my desktop app. having a config that includes several settings like add_while_paused, min_chars, and startup_settings (

Is it possible to setup live typescript type checking in Vscode virtual workspaces

I am using Vscode to edit my typescript projects in virtual workspaces which I am connecting to through SSH FS extension. Whilst benefitting from the convenienc

How to use Solana Wallet Key to sign TX for ArweaveJS

Is there any way to use a Solana wallet keypair and load it into the JWKInterface as per the node_modules/arweave/node/lib/wallet.d.ts and then create an Arweav

Using JSDoc to set an index signature on an ES6 Class

In Typescript, you'd just do this: class Test { [key: string]: whatever } Which allows you to access computed property names like so... class Test { getPro

Force a component property to be an h2

I'm trying to define a props interface for a component using Typescript which requires the value passed for that property to be an instance of <h2>-<h6

How to handle map product not found in react dropdown

I would like to handle unmatch result in the code highlighted in bold below. Currently, it will use GraphAPI to get the information from AzureAD. if product mat

Typescript property does not exist on union type

This is a situation I have ran into a couple of times, it seems like it should be fairly straightforward, but I can't find a solution that doesn't set the type

Omit specific prop from an emotion styled component?

I have a BoxWithAs component, defined something like this: const BoxWithAs = styled.div( { WebkitFontSmoothing: 'antialiased', MozOsxFontSmoothing: 'g

How to write a global store plugin?

I'm trying to make a reactive $store object globally available via plugin but am failing to make it work. store.ts: import {reactive} from "vue"; export defaul

It Is possibile to map typescript object to another based on interface/or type [duplicate]

If i have an object in typescript const x = {a:1, b:2} And an interfacce interface MyInterface { a: number } It possibile to do something li

Why doesn't typescript warn about the return type in this function?

For example, I have an onClick handler on a <div> tag. The handler should expect a return type of React.MouseEventHandler<HTMLDivElement> | undefine

How to make a reactive copy from props with Vue3/TypeScript?

How can I take a value (in this case, an object) outside of the props it was provided in and place it into a reactive variable without affecting the original pr

How to expose any API globally on Node

I have a web development framework which I use on personal backend projects. All web apps revolve around my framework and the API is quite big so importing it i

Can't access state object in child component with React/TypeScript

I'm a beginner at TypeScript and I'm trying to access my state object (from App.tsx) within Questions.tsx. So I want/need to access for example chosenAmount in

Return subset of union depending on class in generic function

This is very much like my other question, but this time using classes instead of plain objects. class Error1 extends Error { constructor(message: string, pu