Questions tagged [typescript]

TypeScript is a typed superset of JavaScript that transpiles to plain JavaScript. It adds optional types, classes, interfaces, and modules to JavaScript. This tag is for questions specific to TypeScript. It is not used for general JavaScript questions.

Filter by
Sorted by
Tagged with
0 votes
0 answers
7 views

Can't connect Prisma to MySql database running i AKS cluster

I'm trying to connect a prismaClient to a mysql db in any way possible: Prisma is part of a express api and running as a service in the cluster. The database is running as a helm chart in the cluster. ...
Øystein Seel's user avatar
0 votes
0 answers
6 views

How to keep directory structure in Vite build?

I have a Vite library with the following structure: And the following vite config: export default defineConfig(() => ({ base: './', plugins: [tsconfigPaths(), dts({ rollupTypes: true })], ...
Ronny Efronny's user avatar
1 vote
0 answers
11 views

Express session deleted on page reload

I started my first backend-frontend website. In this project I use: express, react with typescript, mongodb, passportjs. It will be a single page application. I got as far as redirecting to the "...
vaszilvalentin's user avatar
0 votes
1 answer
19 views

prevent user from entering negative sign and only 0 on angular input field

I have an input field where in when user type a number it will be automatically converted to a negative number which is being handled by onInputChange but I don't want the user to manually or prevent ...
Rav Kumar's user avatar
0 votes
0 answers
13 views

prime ng: Identify which p-splitter-gutter-handle was moved inside p-splitter

I need to to identify the p-splitter-gutter-handle moved inside a nested template. I prepared a stackblitz with an example of what I mean by nested. That is, multiple handlers in a single <p-...
Nek90's user avatar
  • 3
-1 votes
0 answers
27 views

mongodb aggregate query not working on dates

i am trying to fetch data from mongodb using aggregate query in nodejs for a specific date range, let date = '20230925' let year = date.slice(0, 4); let month = String(date.slice(4, 6))....
Shreyas Heda's user avatar
0 votes
0 answers
10 views

How do I implement a custom required error in zod error map?

I want to implement my custom zod error map messages but wonder how do I make my custom required_message in the zod map? I couldn't find it in the switch/case for zodIssuecode. Before that I had to do ...
steve123's user avatar
0 votes
0 answers
9 views

How to use required fields when using react-hook-form with yupResolver and Typescript?

The following type is auto-generated from the OpenAPI specs of the Rest API, therefore I can't simply change it: export type InventoryItemCreate = { name: string; status_id: number; barcode?: ...
Daniel's user avatar
  • 1,398
-1 votes
0 answers
26 views

Unable to display date picker on safari browser (works fine on chrome) [closed]

<Tooltip direction="top" content="Pick a date"> <Popover> <PopoverTrigger asChild> <button ...
Rita Nkem Daniel's user avatar
0 votes
0 answers
11 views

Angular tsconfig cannot use different noImplicitAny settings for different projects

I have an Angular 15 workspace with a main app and multiple independent projects (aka libraries). For the main app and some projects, I want to set noImplicitAny: true for the TypeScript compiler, but ...
AsGoodAsItGets's user avatar
0 votes
0 answers
19 views

react router tries to get files from relative path instead of base path

a react-router question: I have this react-router code: const router = ([ { path: '*', element: <Page1 />, errorElement: <div /> children: [ { path: 'path2/:id', ...
Matan's user avatar
  • 83
0 votes
1 answer
30 views

How to store token in local storage and pass it as bearer in all api cals in Angular

This is my first time building a login where I get user data from an API call and I need some help with it. So the Login "workflow" is like this (Ihope I described it good, if more ...
weinde's user avatar
  • 1,078
0 votes
1 answer
13 views

Component call by click Nuxt open

How can I make a modal window open when a button is clicked. That the modal window itself is not stored in the header? file header: <template> <section class="header"> &...
JuliaBland299's user avatar
0 votes
0 answers
19 views

Issue with Next.js v.13 - Typescript - Axios

I'm new to typescript and next.js 13 but I'm trying to accomplish without success the retrieving of data in my component using getServerSideProps. Seems like my code it's not printing any of the ...
Matteo_Konsept's user avatar
0 votes
1 answer
43 views

Passed onClick function not identified as a function

I am passing an onClick function as a prop in my react app from one component to another. It gives an error which shows as Uncaught TypeError: handleOnClick is not a function . Here is my function ...
Nimantha Fernando's user avatar
0 votes
1 answer
39 views

Get data from an http url Angular

Im trying to make an Angular app where it displays all the public repositories of Google's GitHub (https://github.com/google) and i manage to display a part of it by using the angular-in-memory-web-...
lei's user avatar
  • 1
0 votes
1 answer
58 views

Is there a way to check if any of values (previous and current) are the same in array?

So I have 3 input fields which could contain 3 similar values, but I need that data to be unique for each field. {productFormData.Roles.map((role: string, index: number) => { ...
CraneDev's user avatar
0 votes
0 answers
25 views

How to use quill2.0.0-dev.3 to create table in angular14

My angular project version: "@angular/animations": "^14.2.0", "@angular/cdk": "^14.2.7", "@angular/common": "^14.2.0", "@angular/...
Ruru's user avatar
  • 1
-3 votes
0 answers
20 views

Golang Cron Jobs or NodeJS Cron Jobs? [closed]

I'm trying to decide between using Go robfig/cron and Node.js with the node-cron package for a backend application that needs to regularly make requests to a specific API every 10 seconds. I've heard ...
Vikas Rushi's user avatar
0 votes
3 answers
32 views

In react, in element event listener how to get latest state value

following is my code var C = () => { var [s, setS] = useState(0) var dRef = useRef<HTMLDivElement>() useMount(() => { setShortcut("ArrowDown", () => { ...
chikadance's user avatar
  • 3,617
0 votes
0 answers
5 views

Getting a bunch of compile errors when testing create a react library using Typescript

I am attempting to create my first NPM library. So i have approached t the same way i approach most of my projects which is to just write the code then try and error till it works. So i have created ...
Amos Machora's user avatar
0 votes
0 answers
17 views

TypeScript with VSC: Intellisense not recognizing inherited methods from super class

I've been developing a monorepo project and in one of my packages I have an abstract class to deal with Firestore CRUD: export abstract class FirestoreOperator<E> implements DataOperator<E&...
Higor Oliveira's user avatar
0 votes
0 answers
12 views

useFieldArray remove does not remove all fields

I am new to ReactJS and have built a dynamic form using useFieldArray from react-hook-form. Then if I want to remove a form to a corresponding id via remove(index) the file is still the same interface ...
Dru.Dru's user avatar
  • 57
0 votes
0 answers
8 views

Got weird error in react-data-table-component

i have this code in react typescript interface Cart { ID: number; ... user: User; trucking: Trucking | null; ShippingLine: ShippingLine; OurServices: OurService[]; company: ...
Danendra's user avatar
  • 165
0 votes
0 answers
24 views

Index html generation failed

C:\Users\mypc\Documents\GitHub\my-project> ng build ✔ Browser application bundle generation complete. ✔ Copying assets complete. ✖ Index html generation failed. undefined:6:349398: property missing ...
Samet Yesil's user avatar
0 votes
1 answer
24 views

Cannot create property 'mirror' on string 'true' in Kendo Chart

I am using Kendo chart in my project. This is my kendo chart html file. <kendo-chart> <kendo-chart-tooltip [shared]="true"></kendo-chart-tooltip> <kendo-chart-...
Harshad Pansuriya's user avatar
-1 votes
1 answer
49 views

How can I change a column in repository.cs?

I change the day value in the list by doing some calculations. But I can't show it in the list. When I try as follows, I get the error customerId must be uniqueid. I would be happy if you help. I'm ...
Şebnem Seymen's user avatar
-1 votes
1 answer
21 views

Unexpected token on valid typescript file

When starting jest with a pattern from intelliJ (jest --testNamePattern=MySpecialComponent), i get an error on my jest.config.ts stating Error: Jest: Failed to parse the TypeScript config file /home/...
Andresch Serj's user avatar
-4 votes
0 answers
24 views

Getting error as Cannot read properties of undefined (reading 'toString') [closed]

Question: I'm encountering an issue while submitting a review in my API code, and I'm getting the following error: "Cannot read properties of undefined (reading 'toString')." Description: I'...
Ashwin Chavan's user avatar
0 votes
0 answers
29 views

Prevent implicit conversion from number to bigint [closed]

Given this code: const myBigInt: bigint | undefined; const finalBigInt: bigint = 0; // error const finalBigInt: bigint = myBigInt ?? 0; // no error :( how to prevent the number to bigint implicit ...
kitta's user avatar
  • 1,743
0 votes
1 answer
16 views

Global runtime configuration variable in NextJS (server side)

I am using instrumentation.ts file of NextJS to dynamically fetch configuration on the startup of the server and would like to make this configuration available during runtime to all api routes and ...
mike_t's user avatar
  • 2,483
1 vote
2 answers
49 views

How to avoid TypeScript error when using closest() in React Testing Library?

In my unit test, I am trying to select the following div so that I can click on it. <div> <h1>Avocado Toast</h1> <p>Avocado toast served on country bread, served with a ...
Naresh's user avatar
  • 24.1k
1 vote
1 answer
45 views

Preserve type when getting nested property via a helper function

I am trying to write a helper function to extract properties from an object card of Card type, in typescript. (card: Card, key: string) => data a card must have either properties card_faces: {name:...
Cipher's user avatar
  • 85
0 votes
0 answers
52 views

JWT invalid signature using RS256 algorithm

I was facing problem while generating OAuth2.0 access token using JWT token validation for Azure AD. I am sure that I added the correct certificate to my Azure application. But no matter what, I am ...
theimpatientcoder's user avatar
0 votes
0 answers
18 views

dynamic autocomplete in mui next js

is autocomplete in mui can dynamic it i use const { fields: BenchMarkFields, append: BenchMarkAppend, remove: BenchMarkRemove, } = useFieldArray({ control, name: "BenchMark", }); like this ...
waragorn naja's user avatar
1 vote
1 answer
24 views

Can't correctly index an object using "union" index type

First of all, I'm not really sure what's wrong with my code, so if there's any better title suggestion, I will edit it, thanks. I try to index an object using "key" which is of a union type, ...
alveifbklsiu259's user avatar
1 vote
1 answer
28 views

Why do TS conditional returns require ambiguous casts over precise casts?

I am building an entity-component-system and want the method to retrieve entity components to either return a single component or an array of components depending on if the component being queried is ...
pinkboid's user avatar
  • 103
0 votes
0 answers
15 views

Logger not displaying logs in terminal

I have a nodejs app that's not logging to the console. what am I doing wrong? import { createLogger, format, transports } from 'winston'; import fs from 'fs'; import path from 'path'; import ...
dayo's user avatar
  • 3
0 votes
0 answers
25 views

VUE 3 SETUP @vue/compiler-sfc

Error: [@vue/compiler-sfc] Unresolvable type reference or unsupported built-in utility type. I can't use InputHTMLAttributes like props in defineProps <script lang="ts" setup> import {...
vigilio's user avatar
  • 29
0 votes
1 answer
26 views

typescript how to handle/distinguish the nested object in union

I have a following example while 3 objects sharing some common configs inside the nested object. There are two functions that does exactly the same thing, the second one follows the typescript ...
Yunhai's user avatar
  • 1,303
0 votes
0 answers
12 views

my credential authentication using next-auth wont work

so I am practicing on creating a login/signup form using nextjs with proper authentication and so on. My signin/registration works and enters the database, but the problem I am dealing right now is ...
Desu Chan's user avatar
-1 votes
0 answers
12 views

How to get the date from the year, the week number and day of the week

It's not a question. I needed a function that could generate a specific date based on year, week number and day of the week. The function should ignore local time and respect leap years, i.e. years ...
zbynekr's user avatar
0 votes
2 answers
52 views

Typing the returned value of a store selector function with typescript

I have a store function. I am trying to make a selector function so I can only select a portion of the store and return it. Here is a very stripped down version of what I have. Playground Sandbox Code ...
user3331344's user avatar
0 votes
0 answers
9 views

Int the following code : Drawer is opening on every screen how can i restrit that I have also used 'locked-closed' function and etc but not working

I'm relatively new to React Native and have been working on a project that involves Tab Drawer and Stack Navigators. However, I've been struggling for the past 5 days to find a solution to a specific ...
Aurang Zeb Khan's user avatar
0 votes
0 answers
26 views

@nestjs/swagger: Not Adding Example and Status Code from within applyDecorators

I have had quite a bit of trouble getting my docs to update. Here is a small example: // export-decorators.ts export function ApiOkAndErrorResponses() { return applyDecorators( HttpCode(200), ...
Sa'id Kharboutli's user avatar
0 votes
1 answer
22 views

How to translate coordinates at loading GeoJSON objects for OpenLayers VectorlLayer?

I have an image map with X Y coordinates and load Objects from GeoJSON source. The coordinates in the JSON file need to be translated with a X and Y offset. For this the geometry is taken and ...
ckid's user avatar
  • 1
0 votes
0 answers
8 views

implicitly has type 'any' because it does not have a type annotation

I have this function: and I'm receiving this error message from Typescript: 'this' implicitly has type 'any' because it does not have a type annotation. Here's the function in text: async function ...
KaMZaTa's user avatar
  • 547
0 votes
0 answers
12 views

Error while creating build for nodejs application

Here is my package.json { "main": "index.js", "scripts": { "prebuild": "rimraf dist && tsc", "prod": "knex migrate:...
Girish Gupta's user avatar
  • 1,241
0 votes
0 answers
10 views

How import an mjs module into an Playwright test that uses typescript?

I am trying to integrate playwright into my Angular/Ionic app. It uses Typescript. To setup special scenarios, I need to store specific data into the app IndexedDb database. It is created using @ionic/...
distante's user avatar
  • 6,478
1 vote
2 answers
40 views

Typescript instanceof operator does not work for class that extends Error

I have an app in node.js with typescript and express.js, compiled with ts-node in node v18.14.0 and trying to handle the errors I ran into this problem and I can't quite understand why it happens and ...
Dante Allievi's user avatar

1
2 3 4 5
4460