235,161 questions
0
votes
0
answers
5
views
How to define prop as one of an array of objects, defined in generated interface
Payload CMS has generated this interface for me:
export interface Page {
id: number;
Title?: string | null;
slug?: string | null;
slugLock?: boolean | null;
sections?:
| (
| {
...
1
vote
0
answers
12
views
In TypeScript, only setters are overridden in subclasses, making it impossible to inherit getters from the parent class [duplicate]
The sample code is simple, as follows:
class Node {
id?: string;
private _parent?: Node;
get parent(): Node | undefined {
return this._parent;
}
set parent(value: Node | ...
0
votes
0
answers
7
views
tsc error TS2307 with tsc when multiple workspaces has interdependence relationship
When front project with sub-workspace , and multiple-workspace has interdependence relationship.
when I try tsc, I get err
error TS2307: cannot find module "w1/xxxx"
because another ...
1
vote
1
answer
9
views
Extract<T, U> in typescript behaves differently than discriminating T "by hand" [duplicate]
Given a simple union, I'm trying to extract one type. I ran into this dealing with more complex objects, but it's reproduced with string literals here:
type PQR = 'p'|'q'|'r';
type P = 'p'
// this ...
-1
votes
1
answer
11
views
Failed to load plugin '@nx' declared in '.eslintrc.json » ../../.eslintrc.json#overrides[0]': Failed to load native binding
After updating my NX version and other packages, I now get this error when trying to run nx affected:lint or other lint commands involving eslint:
Failed to load plugin '@nx' declared in '.eslintrc....
0
votes
0
answers
17
views
Vue 3 & Vuetify | Trouble getting content of Vuetify tab to scroll when there is overflow
I'm trying to get the content of a Vuetify tab to scroll without statically sizing the parent control.
Here is a Vuetify playground that contains the structure of my project:
Vuetify Playground
You ...
1
vote
0
answers
47
views
Enforcing references using TypeScript
I have a Redux state with a structure along the lines of this:
type DocumentId = string;
type State = {
currentId?: DocumentId;
documents: Record<DocumentId, string>
}
I would like to ...
1
vote
1
answer
42
views
Is the order of union types in TypeScript not guaranteed?
// init the array according to number.
type NumberToArr<T,P extends unknown[] = []> = P['length'] extends T ? P : NumberToArr<T,[...P,1]>
// detail impl
type NumberRangeImpl<K,Arr ...
2
votes
0
answers
45
views
Reading a 92 byte CSV file takes 15–20 seconds to process
I'm working on an Angular app and trying to read and parse a simple CSV file that is only 92 bytes.
Surprisingly, the upload and processing takes around 15 to 20 seconds, even for such a tiny file.
...
0
votes
0
answers
8
views
Dynamic LESS Theme Import in Vite Based on Environment Variable
I'm building an application with Vite where the projects' structure is the same but different projects need different color themes. Each project has its own .less file with the same variable names but ...
0
votes
0
answers
22
views
How to pass dynamic generic parameters during class inheritance
type Dict = Record<string, unknown>
class Base<
Events extends Dict = Dict,
Types extends keyof Events = keyof Events
> {
events?: Events
print<T extends Types>(key:...
-1
votes
1
answer
25
views
UndefinedDependencyException [Error]: Nest can't resolve dependencies
I'm working on a NestJS project with GraphQL, and I'm facing a dependency injection issue.
When trying to inject WalletService into RefundService, NestJS throws the following error:
[Nest] 8016 - 29/...
2
votes
2
answers
54
views
Using forkJoin for nested API calls
I am struggling to understand the best way to implement nested calls to a API, using forkJoin (without using nested observables).
I have three APIs:
API to create student (/student/)
API to add ...
0
votes
1
answer
29
views
Sentry Logger [warn]: Discarded session because of missing or non-string release
As per the Sentry setup guide for a React FE project
import * as Sentry from "@sentry/react";
Sentry.init({
dsn: "SOME_SENTRY_DNS",
// Setting this option to true will send ...
1
vote
1
answer
53
views
How to specify an exclusive type for a Typescript function parameter [duplicate]
Is there a way to declare a Typescript function in a way that will cause tsc to reject a call to it if passing in value that is statically known to be of a specific type otherwise accept the call?
In ...
0
votes
1
answer
28
views
TypeError: Cannot read properties of undefined (reading 'id') when using createAdapter() from @socket.io/cluster-adapter
I'm trying to set up Socket.IO with cluster support using PM2, following this docs.
Here's my code:
import { createAdapter } from "@socket.io/redis-adapter";
import { createAdapter as ...
1
vote
2
answers
30
views
ERROR TypeError: Cannot read properties of null (reading 'offsetHeight') in primeng MenuModule
I am using MenuModule primeng
The model inside Menu is of type signal
And it is taken from service
Now when service is called and model is filled this error is displayed
ERROR TypeError: Cannot read ...
0
votes
1
answer
31
views
how to capture double click and hold event in angular/typescript?
I am trying to create random shaped polygons inside svg. I want to implement the functionality to drag the polygons within the svg. To do this, I want to capture double click and hold event, similar ...
0
votes
2
answers
25
views
How to properly type Axios with response interceptor + useSWR Fetcher in TypeScript?
I'm building a Next.js app with useSWR, axios, and TypeScript.
I have an Axios instance with a response interceptor that returns response.data:
// api.ts
import axios from "axios";
export ...
0
votes
1
answer
27
views
How to deal with NonEmptyReadonlyArray type in effect-ts
I am trying to find max value in a give array. I am using https://effect-ts.github.io/effect/effect/Array.ts.html#max to achieve that.
Below is the code I have written
pipe(
arrayOfObjects,
...
-1
votes
0
answers
13
views
How to define a dynamic route in NextJs 15 API? [duplicate]
I am facing this type error when build. I have followed the next.js 15 dynamic api routing. It's working in fine dev mode but not building.
src/app/api/hospitals/[hospitalId]/services/[serviceId]/time-...
-2
votes
0
answers
25
views
checkFields<Diff<PageProps, FirstArg<TEntry['default']>, 'default'>>() in Next.js 15.2.4 [closed]
Linting and checking validity of types .Failed to compile.
.next/types/app/categorias/[slug]/page.ts:34:13
Type error: Type 'OmitWithTag<Promise<{ params: { slug: string; }; }>, keyof ...
1
vote
1
answer
55
views
Angular "No pipe found with name 'async'
I have the following Angular typescript and html template and it prompts the captioned error when build.
Typescript:
import { ChangeDetectionStrategy, Component, Inject, OnDestroy } from '@angular/...
0
votes
0
answers
36
views
How to export separate default type and default value in TypeScript ES Module?
I'm trying to export a value from a module, but I want it to have the same type as another module, namely "monaco-editor". But the other module apparently exports a namespace.
Previously I ...
1
vote
0
answers
20
views
Prisma cannot locate the Query Engine while deploying a NextJS-Prisma app in Vercel with Vercel's Neon PostreSQL
I'm deploying a NextJS App with prisma on Vercel with Vercel's Neon PostreSQl, Vercel doesn't give me any errors while deploying, but when it comes to making request to prisma, it always returns the ...
0
votes
1
answer
53
views
PayPal JavaScript SDK: Unable to Display "PP" Logo on Checkout Button
I'm integrating the PayPal JavaScript SDK into my React + TypeScript application using the @paypal/react-paypal-js package. My goal is to display the PayPal button with the "PP" logo, as ...
0
votes
0
answers
33
views
Error while migrating to Manifest v3 from v2 , it is showing error Cannot read properties of undefined (reading 'TYPED_ARRAY_SUPPORT')
I am getting error after migration to v3 from v2 .
In image 1 the service worker gives error as soon as we run it and it says TYPED_ARRAY_SUPPORT is undefined
In image 2 , same error shows when we ...
0
votes
0
answers
28
views
Mongoose populate plugin with Typescript
I've been trying to create a plugin which implements a query and schema method that populates a user field and selects some inner fields from it (firstName, lastName, image).
I just can't seem to make ...
0
votes
0
answers
60
views
How to reference original interface that was extended in TypeScript?
I'm working on better types for jQuery Terminal. This is d.ts file I have so far:
declare module 'jquery.terminal' {
...
export interface JQueryStatic {
omap(object: { [key: string]: ...
-1
votes
0
answers
37
views
createTheme for theme.tsx has issue
This is in my theme.tsx:
Const baseTheme: Omit<
ThemeOptions,
| “properties1”
| “properties2”
>
export DarkTheme = createTheme({
…baseTheme,
…themeDark,
palette: { …baseTheme....
0
votes
1
answer
40
views
'CreateEntityDto' only refers to a type, but is being used as a value here
currently I'm trying to create a generic controller for my node.js app on typescript basis.
This is the code of a working controller (here only with a create method):
export class CompanyController {
...
1
vote
4
answers
119
views
Poor inference during instantiation of the class
The goal of this code is to extend the functionalities of the t_Prisma object through the Prisma class.
type t_Prisma<MNs extends Record<string, string> > = {
ModelName: MNs
}
class ...
1
vote
1
answer
35
views
Issue with radius of Shadcn Stacked Bar chart
I'm using Recharts via shadcn/ui charts to create a stacked bar chart where each stack represents a day and segments represent different channels. I want the final visual stack for each day to have ...
-7
votes
1
answer
63
views
Unable to use OpenAI API
Failed to load resource: the server responded with a status of 404 (Not Found)
POST /undefined 404 error
I still don t understand what s wrong with the api call although it seems fine and i tried ...
0
votes
0
answers
18
views
Error “Requiring unknown module ‘undefined’” with AWS SDK v3 in Expo SDK 52 (Hermes) when using @aws-sdk/client-cognito-identity-provider
Question
I’m migrating my app to Expo SDK 52 (Hermes) and using AWS SDK v3 to call Cognito from React Native:
import { CognitoIdentityProviderClient } from '@aws-sdk/client-cognito-identity-provider';
...
0
votes
1
answer
33
views
How to share packages between apps in pnpm monorepo
I'm extremley confused with how monorepos work, I want to build an app with next.js and sanity studio so i have 2 folders
next
studio
both uses some similar packages like
react
react-dom
@types/react
@...
-1
votes
2
answers
35
views
get property from nested object
I have this dto:
import { Expose, Type } from 'class-transformer';
import { UserDto } from '../../../admin/users/dtos/user.dto';
export class CompanyDto {
constructor(partial: Partial<CompanyDto&...
0
votes
2
answers
46
views
Typescript Generic and Non-Generic Version of Type 2 -Define VOID property?
To build off of the question found here: Generic and Non-Generic Version of Type
The question asks: "how to have a generic and non-generic version of a typescript type" like
export class ...
0
votes
0
answers
83
views
Angular 19 returning partially correct DTOs from server eventhough all server data is correct
Return in controller shows "mostly" correct data but when returning it on client side is null.
I use Angular 19, .NET Core and EF Core. The mapping seems to be selective.
I create an Article ...
-2
votes
0
answers
21
views
How to correctly pass generic types to a custom Autocomplete component in React/TypeScript?
I often use this component in my project, so I decided to create a separate, reusable component for it.
However, I'm running into an issue: I don't know how to properly invoke it with a generic type.
...
0
votes
1
answer
68
views
Supabase returning empty object when trying to insert data in table and not adding data
i am currently learning supabase so for practicing i am creating simple todo app using Electron + React so when i am trying to insert data in my todos table supabase returning {} instead of error
...
-1
votes
0
answers
28
views
Mock React component with Jest [closed]
I have a problematic component that Jest cannot parse, so I want to mock it, but nothing I do seems to work at all. I've tried mocking other components that work just fine and I can't mock them either....
0
votes
1
answer
51
views
Toggle button doesn't show chart from db.json data
I'm starting to learn how to build Angular apps and I need to implement a toggle button that show/hide 2 charts, one chart has static data and the other on call data from a db.json file through a ...
1
vote
1
answer
44
views
How do I get TypeScript and the IDE to bind all of a function's args to one parent object of a discriminated union
I have a discriminated union where each item in the union has an array of nested objects.
I'm trying to write a function that takes in one or more of these nested objects as params and is smart enough ...
0
votes
2
answers
36
views
confusion between import in NestJS with global module implementation
I have a confusion regarding the implementation of a global module in NestJS, and the import of a shared service
I'm following this guide: NestJS- Global Modules
and this is what I have so far:
shared....
1
vote
1
answer
45
views
Chaining two mapped object types leads to undesired union & intersection issues
I have two parametrized maps where the result of the first map for any key (context) matches with the required inputs for the second one of the associated context. How can I get typescript to check ...
-2
votes
0
answers
33
views
How to implement seamless scroll/state restoration when navigating back to infinitely scrolling page like reddit.com / pinterest [closed]
I’m using nextjs v14.2, graphql, and Apollo to build an infinitely scrolling feed. When users click on an internal link and then navigate back to the infinite feed, I want the feed to be at the same ...
0
votes
1
answer
15
views
How can I allow non-standard attributes on a tag in Astro/TypeScript?
I'm in the process of porting my website across to Astro - it is mostly working fine, but there is one TypeScript error that I cannot figure out a proper fix for.
My website uses Utterances for ...
0
votes
0
answers
42
views
How to use TypeScript transformers on Vue files
I use plugins to generate objects from types in my Quasar project. They work fine, but only on .ts files. All files with .vue extension (I use <script setup lang='ts'>) don't come to plugin's ...
1
vote
1
answer
60
views
Type 'Signal<boolean>' is not assignable to type 'Signal<unknown>'
I am working on an app which is using a pretty simple signal store. It worked the last days but suddenly today I got the following error:
Type 'Signal<boolean>' is not assignable to type 'Signal&...