Skip to main content

Questions tagged [typescript]

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

typescript
Filter by
Sorted by
Tagged with
0 votes
0 answers
13 views

Transforming function's argument types, and inconsistency between Mapped types (works) and Recursive type (does not work)

I've been fiddling with some transformation of arguments of a function via a recursive type, have some issue to make the type work, I made same simplified example to highlight the issue, together with ...
Jarek's user avatar
  • 7,619
1 vote
1 answer
16 views

How can i get current page index from PrimeNG table

I use the PrimeNg library and the Table component with paginator enabled. The Django backend application uses PageNumberPagination. How can I get the current page number from this component? <p-...
TalVik99's user avatar
  • 140
0 votes
0 answers
9 views

How to update the state for only one component using Zustand?

I'm writing a simple Todo List and I want my tasks to be added and removed from favorites with a single button. Task code: import React, {useState} from "react"; import { StarOutlined, ...
ladafmn's user avatar
0 votes
0 answers
12 views

react recharts pie chart custom style

I developed an half donut pie chart but i could not add red circle to the point 2 pies touch each other I need to add a red circle white bordered in pic below. this is my component import { PieChart,...
ozgur's user avatar
  • 17
0 votes
0 answers
12 views

Print Plotly.js graph to PDF using React

I am using React with Typescript on my project. I also use plotly.js for plots. At a click of a button which I place below the plot, I would like to take a screenshot of the plot and then print it out ...
Ovayo Matiwane's user avatar
0 votes
0 answers
6 views

"TypeScript Error: Property 'comparePassword' does not exist on type 'Document<unknown, {}, IUser> & IUser' in Mongoose Model"

I'm developing a LMS in Node.js application along with TypeScript and Mongoose. I have defined a user schema and model, and I'm trying to add a custom method comparePassword to the user model for ...
giriraj shankar's user avatar
1 vote
2 answers
31 views

How to disable dynamic control in angular

I'm trying to create dynamic fields using this code formInputfieldsForm: FormGroup[]; defaultFields: any = [ { inputType: 'textbox', inputValues: '' }, { inputType: 'textbox', ...
user3653474's user avatar
  • 3,679
0 votes
0 answers
13 views

Implement logic in back-end using getServerSideProps

Good morning, my head hurts i've been smashing it against the wall for so long! As the subject says i need to move some logic from the client-side to the backend, so that the API url is not exposed ...
Alex's user avatar
  • 8,965
0 votes
0 answers
11 views

Figma plugin API delay in loading all children form a node

I am working on developing a Figma plugin using their API. As per the below code, I'm trying to access a specific node in the mainLayer.children, but when mainLayer is logged to the console it shows ...
Abhishek Konnur's user avatar
0 votes
0 answers
10 views

How to transform a ReadableStream back into a file in TypeScript

right now I'm working on a Next.js Typescript project. I am using Primereact for my Frontend. I prepared a File Upload. import { FileUpload } from 'primereact/fileupload'; <FileUpload mode="...
Ruffyg's user avatar
  • 83
0 votes
0 answers
13 views

Antd Form.Item validator doesn't trigger while i change input value via side buttons

I have an input with validator for min / max values. Also there is a button which sets value as max value in this input. The button is out of this form. I type in input value under min and an error ...
huhhell's user avatar
  • 11
0 votes
0 answers
14 views

TS target config does not support browserlist

It seems TS target config does not support browserlist's browsers versions like "Chrome >= 48", found related issue#19183 and issue#53373. I created a utils package, currently, I set the ...
Lin Du's user avatar
  • 98.3k
0 votes
1 answer
13 views

Type error: Type 'Element' is not assignable to type 'NextPage'

"use client" import React from 'react'; import Sidebar from './page'; import type { NextPage } from 'next'; interface LayoutProps { children: React.ReactNode; } export default function ...
Ponraj Thuvarakan's user avatar
-1 votes
0 answers
22 views

Hook doesn't update data immediatly since React 18

We have a strange behaviour since we updated from React 16 to React 18. We have data that we determine through a hook. This worked with React 16, now with React 18 it seems so that the component is ...
Tommy's user avatar
  • 503
0 votes
0 answers
15 views

How to hide or remove Facebook suggested videos at the end or when pausing using Facebook Embed code?

I'm embedding Facebook videos in my Angular project using the Facebook Embed code. However, I'm seeing suggested videos appear at the end of the video or when I pause the video. Here is an example of ...
discussion forall's user avatar
0 votes
0 answers
8 views

How to prevent Autocomplete from showing only the selected value after selection in React Hook Form?

I have an issue with an Autocomplete component that uses React Hook Form. When I select a value in the Autocomplete, the search input updates with the selected value, which results in the list of ...
m3nur's user avatar
  • 1
0 votes
2 answers
27 views

TSX : 'Routes' refers to a value, but is being used as a type here. Did you mean 'typeof Routes'?

Typescript code (.tsx) import { Route, Routes } from "react-router-dom"; const AppRoutes = () => { return ( <Routes> <Route path="/" element={&...
Aditya Mistri's user avatar
0 votes
0 answers
12 views

Router of Next/Router is undefined in test.tsx file

LeftSidebar.tsx component import { usePathname, useRouter } from 'next/navigation'; interface LeftSidebarProps { leftSidebarData: InnerPathItem; leftSidebarDataIndex: number; } export const ...
Saif Farooqui's user avatar
0 votes
0 answers
15 views

How can I make mixin type works in nested mixin functions?

This mixin is borrowed from https://github.com/1nVitr0/lib-ts-mixin-extended , I want write a mixin function also has mixins, for nested I mean function createBarFields() { return <TBase extends ...
wener's user avatar
  • 7,580
-3 votes
0 answers
17 views

VS Code Extensions - How to implement semantic highlighting for a custom language?

I can't figure out how to implement semantic highlighting, the docs have like 10 different ways to write it and all my code hasn't worked. I just need someone to help explain the code for it. I tried ...
AssemblyLine's user avatar
0 votes
0 answers
18 views

Typescript/Node.js file extensions - 'module not found' when trying to run the app

I'm facing a problem with the configuration of my node.js/typescript project. The imports need extensions otherwise I got an error - 'ERR_MODULE_NOT_FOUND'. But if include .ts to them then i will need ...
Christian's user avatar
0 votes
0 answers
11 views

Data from the Notion API not updating when deployed NextJS app on Vercel

I have a blog application in NextJS that takes the posts content from the Notion API. It works perfectly running on localhost, I make changes in Notion and they are loaded normally. But using the ...
ewrt86's user avatar
  • 13
-2 votes
1 answer
32 views

Why my Dialog is not closing after submitting?

I'm having a little bit of trouble, I can now pass the data to the backend, but the problem I'm encountering right now wherein after the user submit the form, the Dialog didn't close. I have here a ...
Stykgwar's user avatar
  • 557
0 votes
0 answers
10 views

How to resolve imported types to their actual definition with ts-morph

I'm trying to see if its possible to use ts-morph to auto-generate documentation, for a few specific files. Assume I have the following file: import { SomeInterface } from 'some-module'; const ...
Ruben's user avatar
  • 1,729
1 vote
1 answer
33 views

Invoke an assertion function passed as a named argument

I want to pass an assertion function as a named argument and invoke it. TypeScript complains when I try this: const myFunc = ({ myAssertionFunc }: { myAssertionFunc: (x: unknown) => asserts x is ...
JRagone's user avatar
  • 70
0 votes
0 answers
28 views

THREE.js Object is not visible when inheriting from other class

I am fairly new to THREE.js and Angular.. well, let's just say JavaScript and TypeScript in general, so my question might be a rookie one. I apologize in advance. I have been building a project in ...
Firewolf89's user avatar
1 vote
0 answers
13 views

Type safety in returned state union from useReducer

I have an edit state that returns an edit for a single key out of many. type EditState_Empty = { name: null value: null } type EditState_InProgress = { name: 'name1' | 'name2' value: ...
user2453676's user avatar
3 votes
0 answers
25 views

How can I suppress React imports in TypeScript output to allow CDN references?

I am trying to use CDN URLs to reference the react and react-dom libraries in my typescript app. I do not want to bundle them into my compiled .js file, as I'm concerned with performance in production....
Jordan Rieger's user avatar
0 votes
0 answers
13 views

getToken occurs error Dynamic Code Evaluation (e. g. 'eval', 'new Function', 'WebAssembly.compile') not allowed in Edge Runtime

I'm creating a project which uses NextAuth.JS as authentication library and using Redux-Saga as state manager. In order to implement refresh token rotation I created following functions: get-token.ts: ...
Lvasche's user avatar
  • 302
-3 votes
1 answer
38 views

How to loop through a nested JSON object which contains objects and and arrays of objects

I am trying to recreate the search functionality of outlook. My entire data set is contained in the following interfaces: export interface Folder{ id: string | null; name: string; folders: ...
Qiuzman's user avatar
  • 1,423
0 votes
0 answers
34 views

Use of React project within Angular project

I'm at a crossroads and this may be an easier issue than I'm worrying about. An application I'm taking on has been written in React to near completion. However, expectations were for it to be Angular. ...
JustThatGuy93's user avatar
0 votes
1 answer
15 views

Enforce shape of object values while treating keys still as const's

I have a map of filters defined like this: type TFiltersNext = { [key: string]: { type: 'date' | 'enum' } }; const filtersNext: TFiltersNext = { foo: { type: 'date' } }; I want to define valid ...
Noitidart's user avatar
  • 36.7k
-2 votes
1 answer
49 views

How to HTMLElement[] type from DOM?

In TypeScript I need to collect all top level document of a page and using below code (the condition inside if is made simpler for brevity): const getHTMLElement() : HTMLElement[] { const doc = ...
xkeshav's user avatar
  • 53.4k
0 votes
0 answers
17 views

Issues with zxing-js/library and Rollup Build: "this" has been rewritten to "undefined"

I'm new to JavaScript and TypeScript and I'm using the zxing-js/library package in my project. When I try to build my project with Rollup, I'm encountering the following errors: (!) "this" ...
Ophir Yaniv's user avatar
1 vote
1 answer
14 views

How to specify that a function argument is one of the keys of an Interface? [duplicate]

In TypeScript, I want to ensure that the argument to myFunction is one of the keys of MyInterface. That is, I want the type checking on arg specified below. export interface MyInterface { option1: ...
dB''s user avatar
  • 8,088
1 vote
1 answer
27 views

Mongoose Virtual Field Population Problem

I have a problem with current state of my database since it started with a very old backend wrapper. (Parse Server) So here is the problem let's say I have two different collections Users and Stores ...
zautopilot's user avatar
-2 votes
1 answer
17 views

Is it possible to have Bun bundle my TypeScript on file save in VS Code?

Is it possible to have Bun bundle my TypeScript on file save in VS Code? The guide says I can call bun run index.ts in the command line and add it to the package.json like so but I don't know how to ...
1.21 gigawatts's user avatar
0 votes
0 answers
12 views

react-hook-form conditional error message typing

I'm fairly new to using Typescript and I'm having a go at setting up Auth in my first ts React project. I've successfully set up validation using react-hook-form in an AuthForm.tsx component that ...
Dan Gray's user avatar
-1 votes
0 answers
8 views

How to set up Bun to compile and bundle the TypeScript files in a directory

I have a project that I need to use Bun to bundle up the TypeScript of the web page. I don't know if I should bundle the HTML pages or the TypeScript files. Here are my bun.js settings: import html ...
1.21 gigawatts's user avatar
1 vote
0 answers
17 views

Weaviate Client v3 in Next.js: delete() method not deleting and iterate() method not iterating

Description I'm using the Weaviate client v3.0.8 in a Next.js application v14.2.4. I connect to Weaviate locally via Docker and use Ollama for vectorization. Problem However, I'm encountering two ...
Rok Benko's user avatar
  • 21k
0 votes
4 answers
54 views

Regular Expression to validate a CAGE Code

We need to write a RegEx which can validate a CAGE Code A CAGE Code is a five (5) position code. The format of the code is the first and fifth position must be numeric. The second, third and fourth ...
Angular animal's user avatar
0 votes
1 answer
18 views

How do I find out what causes a "Debug Error" in TypeScript's compiler?

When running nx serve (using NRWL NX) on my TypeScript project, the build now fails with this error: <my-file>.ts - Error: Module build failed (from ./node_modules/@ngtools/webpack/src/ivy/...
F-H's user avatar
  • 933
0 votes
1 answer
22 views

Subclass method override not assignable to same property in base type when returning super

Say I want to extend the Promise class with an overriden then() method that does something before calling super.then(): class ExtendedPromise<T> extends Promise<T> { then(...x: ...
mt_xing's user avatar
  • 642
0 votes
0 answers
12 views

tanstack table:custom sorting

I am creating a table with filters, with the following columns name | amount | unit price | total , I want to know how you could keep several columns filtered at the time and uncheck them so that they ...
loquinho's user avatar
-1 votes
0 answers
19 views

How to Use AWS SDK (v3) with Non-AWS S3-Compatible Object Storage?

I'm trying to use the AWS SDK to interact with an S3-compatible object storage service that is not hosted by AWS. I've configured the S3Client with the endpoint, access key, secret key, and region ...
AbdALNasser Gamal's user avatar
-2 votes
0 answers
8 views

cannot get images when fetching the url localhost/uploads/filename

the photo is storing perfectly in the uploads file and even in mongo db too but when i try to get/fetch them im not getting the photo [enter image description here](https://i.sstatic.net/kEgyRh[enter ...
user25573263's user avatar
0 votes
4 answers
47 views

How to bypass useEffect dependency for custom hook?

Here's my sample code: const { getConversionList, conversionList } = useConversion(); useEffect(() => { getConversionList(); }, []); useConversion is a GraphQL resolver hook, I'm getting ...
Aryan Kumar's user avatar
1 vote
1 answer
18 views

How to add data-autoload, data-origin and data-callback script tags in Angular typescript

I want to add my script in angular application which contains 'data-autoload, data-origin and data-callback' keys. I tried with _renderer2.createElement('script') method but it is throwing error. ...
Bhushan Khaladkar's user avatar
-2 votes
0 answers
15 views

config eslint to follow Airbnb style in ReactJS Typescripts

I want to use Airbnb as eslist style but unfortunately with the newer version of @eslint/create-config, it only supports flat system. I'm not good at eslint configuration. Is there any luck to config ...
Harshana Srimal's user avatar
0 votes
0 answers
23 views

Deno is queuing up request when a setTimeout operation is going on

Version: Deno 1.44.4 I have written a basic rate limiter implementation. It uses setTimeout to delay between the request. Here's the code implementation. The issue is whenever there are more than 2 ...
supxd's user avatar
  • 1

1
2 3 4 5
4645