Category "typescript"

React Router: Conditional redirect if not query parameter present

I am trying to do a conditional redirect, if there is no 'state' query parameter in the url, I want to redirect to an error page. I am trying to do it in my App

Typing a partial record where any present key must be defined

How could one type a record/object where the properties are optional, but if they are present they must be defined? For example: type K = "foo" | "bar"; type R

Type 'object' is not assignable to type 'NgIterable<any> | null | undefined'

<!--app component.html--> <div class="position-relative container"> <div class="row justify-content-center"> <div cla

How can I aggregate/pivot this non-numeric data to show in a chart?

I'd like to show some data on a line chart. The source data looks like this: [ { date: 1, depth: 1, river: 'trent',

How to unit test typeorm getRepository with Jest?

I am using typescript with typeorm and i have an repository like this: import { EntityRepository, getRepository, createQueryBuilder } from 'typeorm'; @EntityR

How can I get live-reload on a local npm package in a monorepo?

I'm setting up a monorepo workspace for a Vue 3 (vite + ts), cloud functions, & shared-lib (shared functions and ts interfaces etc.). I can get the import o

Reduce height of mat-flat-button

I have a message board that I want to add delete buttons to, unfortunately the mat-flat-button seems to be doubling the height of the message items. If i set it

Is it possible to set top border on ChartJS Doughnut Gauge chart

Target Doughnut gauge with green top border: Example Doughnut gauge: https://codesandbox.io/s/jlonjk9zv5 The question: Is it possible to implement abovemention

React - react-final-form validation

I have a question regarding react-final form error message when using record-level validation. I have the following field present within FormFilterFields compon

react-select and typescript: Type 'string' is not assignable to type 'ValueType<OptionTypeBase>'

I am trying to create an example component that uses react-select with typescript. For this, I created a functional component and added the default example fro

How to stop infinite refresh in react webpack app?

When I change the TS file, Webpack doesn't stop refreshing the page. Console says: @ebpack 5.66.0 compiled successfully I've googled this and tried different pl

Deprecated compiler module in Angular 13

with Angular 13 I'm seeing deprecations for the usual compiler tools to instantiate an NgModule and Here is my usual go-to code for loading a module contain

Print file on client side

I am using FileSaver.js to print an object array on the client side (HTML/Typescript). var blob = new Blob([JSON.stringify( marray)], {type: "text/plain;charset

How to use moment in nestjs application

I want to use momentjs in a nestjs app, and also be able to test my services. So I provided momentjs as below in my module providers: [ { provide: '

What is the correct type for React Click Event?

I want to use a type for my event handler instead of using type any, Can anyone help me with this,please? here is the code I'm trying to refactor: const MyComp

Exported variable 'store' has or is using name '$CombinedState' from external module error Redux toolkit and redux persist

Hi I'm trying to get redux persist working with redux toolkit (also in typescript) I'm getting the following error: Exported variable 'store' has or is using na

Typescript asserting types if they have one property true or false [duplicate]

I have the following function: type Option = { map?: { lat: number, lng: number } location?: boolean } const foo = (option: Opt

Nest.js is giving cors error even when cors is enabled

I am developing a next.js application with nest.js as the backend. Now, I am having cors error even when I have cors enabled in my main.ts file of nest.js. Here

Prisma, update scalarList/array

I´m doing an Spotify clone and I´m trying to add a song to a playlist but my query doesn't work, until this point, everything was good following the

Typechecking React library with Styled Components

I'm currently working in a design system library to test some things. Basically, the library is a Styled Component wrapper in order to create themes. I built th