Category "typescript"

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

Selected Field Value visible in matToolTip but not in disabled divTable dropdown

I have the following code: table.component.html <div *ngFor="let person of persons; let i = index;" class="tbody"> <div class="row"> <

Webpack5 + react-refresh-webpack-plugin does not work

I wanted to setup react with webpack, babel, and typescript myself since I would like to know more and have a consistent boilerplate for development. I have bee

Function with RxJS and combineLatest sometimes works and sometimes doesn't

If you call this function multiple times with the values of the observables obs1 and obs2 being the same each time, the returned array is not always the same. g

Declare types from file with `export .. from` to global interface

I have the file with a lot of export { default as NAME } from './PATH_TO_FILE'; And I want to declare types to global @vue/runtime-core inside GlobalComponents.

How to use Haversine formula in Sequelize-typescript to get distance between two coordinates

SELECT id, ( 6371 * ACOS( COS( RADIANS( db_latitude ) ) * COS( RADIANS( $user_latitude ) ) * COS( RADIANS( $user_longitude ) -

Nuxt Error : Cannot read properties of null (reading 'addEventListener') default.vue and index.vue not rendering

I'm using nuxt.js and vuesax as an UI framework, I did modify my default.vue in /layouts with a basic navbar template exemple from vuesax. Then I used @nuxtjs/r

Class constructor optional parameter

I want to be able to initialise a class with or without value. If you pass a value then all methods of this class will expect this value as an argument and the

Cannot find module '@material-ui/lab'

I am building a front-end page where I need @material-ui/lab. After installing the package with npm, I get a typescript error when compiling: TS2307: Cannot fin

Combining generics with index type

Since this works: const f = <T extends string>(x: T) => x; f(""); interface Dictionary<T> { [key: string]: T; } const dict: Dictionary<numbe

Changing material UI button text based on a condition

I am using the material UI button for my component and want to change the button text based on a condition that if order amount is 0, show button text as "cance

Property does not exist on type void

I am writing a hook to make a post request that returns two properties, sessionId and sessionData. I am using this hook in a component. My hook looks like this.

unable to load image file from server in angular

i am sending an image file named figure.png from flask api and it is working fine. i have checked it in postman. now here is the angular code -> chart-compon

Template Parse Error: 'mat-sidenav-container' is not a known element, and about router-outlet, ngif

I used angular13. and Vs code. 'mat-sidenav-container' is not a known element Property binding ngIf not used by any directive on an embedded template. Make sure