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
4 views

How can I load data from secrets-manager synchronously in TypeScript

I have the following: { "extends": "./node_modules/gts/tsconfig-google.json", "compilerOptions": { "lib": ["ESNext"], "...
ipinak's user avatar
  • 5,869
0 votes
0 answers
11 views

Transform an object of types to a union type of these types

I have a file index.ts which exports a few types, as follows: // [...] export { UsalonData, TalonData, UsageData, GateSaclayData, EcsData, EffacementData, SplineData, ...
Zorzi's user avatar
  • 778
0 votes
0 answers
4 views

Next auth (auth.js) V5 redirect according to the user role (role based redirect)

I have implemented next-auth v5 in my next.js 14 application. I have implemented role-based authentication, I have two roles, provider admin Now in my application, I have two dashboards, one for the ...
Ahsan Farooq's user avatar
1 vote
0 answers
15 views

Passing 'props' to children component and conditionally render it

It's my loginButton which is the wrapper of Button component in another file. 'use client'; import { useRouter } from 'next/navigation'; import { useTransition } from 'react'; interface ...
Samiul Islam Shibly's user avatar
-1 votes
0 answers
8 views

Getting a total line, branch, statement and function count per file in a TypeScript project

I have a large React code base with ~3% code coverage. I'm trying to up the code coverage. I'm looking to inspire the rest of the team to write tests, so I'd like to raise the number quickly as ...
Justin Dearing's user avatar
0 votes
0 answers
10 views

Property 'location' does not exist on type 'File'

I have changed multer to multer-s3. Changing in controllers for that. I will store "location" instead of "filename". But I am getting typescript error. I am using Localstack for ...
Nikhil Mandaliya's user avatar
0 votes
0 answers
11 views

Create generic WritableComputedRef with keyOf type

Let's say I have a Ref holding an object and I want to generate WritableComputedRef from its properties. I thought I could do it in a generic way like this: type KeysOfType<B, P> = { [K in ...
Cilenco's user avatar
  • 7,017
0 votes
0 answers
7 views

Firestore query with 'array-contains-any' operator not returning expected data

I am using Firestore to fetch data based on a filter that utilizes the 'array-contains-any' operator. Here is the code I am using to fetch the data - const fV = this.getFV(this.selectedButton); return ...
jessiepinkman's user avatar
0 votes
1 answer
12 views

NG8003: No directive found with exportAs 'ngForm'. [plugin angular-compiler]

i was trying to run my website but i get this erreur when i do ng build i get this erreur : Prerendered 0 static routes. Application bundle generation failed. [5.115 seconds] ✘ [ERROR] NG8003: No ...
mokhtar ben ftima's user avatar
0 votes
1 answer
11 views

why is this react login page not working?

I am trying to make a react app I want to make some login that will then give access to the main site. the problem is that it just doesn't really do its job at all. on initial login with correct ...
frenchDude12399's user avatar
0 votes
1 answer
31 views

Why does TypeScript not allow passing an array with the spread operator as function parameters?

This is how the JavaScript spread operator allows passing an array as function arguments: function f(a, b) { console.log(a, b) } let arr = [1, 2] f(...arr) // all fine! TypeScript 5.3.2 does not ...
citykid's user avatar
  • 10.4k
0 votes
1 answer
13 views

Getting a wrong value while converting date from german locale to english using moment

All I want is to get the date value received in german language to english format for which i tried using moment library as given below It does convert but unfortunately returns a wrong value. moment('...
chandan kumar's user avatar
-2 votes
0 answers
6 views

Configuring package.json exports for mixed file and directory imports

Adding this to my npm package: "name": "@repo/ui", "exports": { "./*": "./src/*/index.tsx", }, Let's me make imports like this: // ./src/Form/index....
wyc's user avatar
  • 54.3k
0 votes
0 answers
8 views

How can I know if a vscode intelliSense suggestion is visible?

I am creating an inline code completion plugin for vscode. I am using the InlineCompletionItemProvider to show the inline suggestions. However, I am making the call to generate suggestion even when an ...
Ayush Surana's user avatar
  • 1,846
0 votes
0 answers
15 views

How to use PrimeNG multiselect search to trigger an API call based on user search input and populate the multiselect with the retrieved data?

When ever we enter text in the filter section, we need to call an API to get the relevant output list and update this into multiselect results. Here I tried onFilter event to call the API, I got the ...
Gyalbu Sherpa's user avatar
0 votes
1 answer
13 views

Nuxt.js 3 - useAppConfig() returning unknown

In a NuxtJs 3 project I tried to add some specific stuff into my app.config.ts a the root directory of my project. When I tried to call useAppConfig() to use my config data, VSCode raise an error ...
Yggor's user avatar
  • 61
0 votes
0 answers
18 views

Node import/require files while ignoring file extension?

I have a shared config file that's used in a lot of places. My code doesn't care what extension the config file has. However, some packages expect it to be .js, others expect it to be .ts. E.g. if I ...
Leo Jiang's user avatar
  • 25.3k
0 votes
0 answers
6 views

VSCode Extension Help: How can I retrieve the content of all "find highlights"? editor.action.selectHighlights only seems to work when in Regex mode

I need to retrieve the text of all "find occurrences" in the active editor. By "find occurrences" I mean the highlighted matches that appear when you search in the find widget. I'...
fmotion1's user avatar
  • 415
0 votes
1 answer
16 views

Argument of type 'void' is not assignable to parameter of type 'SetStateAction<{}>'

I'm trying to create an app using TMDB using NextJS an Typescript. I have a movies.ts file with this code: export async function getTrendMovies() { const url = 'https://api.themoviedb.org/3/...
Carlos Eduardo Diaz Torres's user avatar
0 votes
0 answers
5 views

In a VSCode extension (Using Typescript) - How can I get the text content of all matches when the user executes a search in the Find Widget?

I'm trying to implement a command in my VSCode extension that auto-trims the document, leaving nothing left but the found text from the find widget (joined by newlines). Example image: Ideally when I ...
fmotion1's user avatar
  • 415
0 votes
1 answer
19 views

Unhandled Runtime Error TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator))

I am making a multiselect component in Next.js and I am using states and setting states. But this error occurs: Whenever I click this: Below is the code of MultiSelect.tsx: import { useState } from ...
Jey-Es's user avatar
  • 13
0 votes
1 answer
15 views

Typescript Maybe, error about null not being covered

I don't know how to get rid of this error, and I don't know why it talks about null. Shouldn't the seo?.breadcrumbs || [] already cover the case where breadcrumbs is null? However in the Intro Propos, ...
JorgeeFG's user avatar
  • 5,765
0 votes
0 answers
40 views

`Boolean()` and `!!`, is this intended?

Boolean type type infers to be a boolean type, and !! operator type infers to be a true or false. Is it intended? and why? Here's the code: const truthy = true const falsy = false const ...
sebanim's user avatar
-1 votes
0 answers
12 views

What boilerplate is the best for dynamic form building with reactjs typescript and .Net core microservices

I've researched several bootstraps and boilerplates of reactjs. Tsdx for example just doesn't run properly for meat this point. I need a framework which will allow me to build forms automatically ...
Tzvi Gregory Kaidanov's user avatar
0 votes
0 answers
11 views

Typescript error: "./src/models/MenuModel").SortOrder' is not assignable to parameter of type 'number'.ts(2345) (property) MenuModel.order: SortOrder

error on line: 98 /src/models/MenuModel").SortOrder' is not assignable to parameter of type 'number'.ts(2345) this: this 120 Type 'number | SortState[]' is not assignable to type 'SortState[]'. ...
Donghol Diallo's user avatar
0 votes
0 answers
33 views

Angular component's interface ( @Output / @Input ) how do you expose methods? Or certain type of events?

In angular, we can encapsulate functionality in a component and define its interface via @Input and @Output Interfaces in other systems typically include properties, methods and events. It is clear ...
ILIA BROUDNO's user avatar
  • 1,711
0 votes
1 answer
23 views

Spotify Auth access token givin error code 400

I have been trying to get my spotify access tokens and refresh tokens for my react native application and its been giving me serious issues. https://docs.expo.dev/guides/authentication/#spotify I was ...
Iseoluwa ariyibi's user avatar
2 votes
2 answers
33 views

Generics and arrays: why do I end up with `Generic<T[]>` instead of `Generic<T>[]`?

I have a simple function that can accept a single object of type T or an array of objects of type T[]. It will then do its thing and return a result matching the type passed in (i.e. if an array is ...
Wilco's user avatar
  • 33k
0 votes
0 answers
13 views

Cannot include .woff files into dist build directory when running tsc command

I'm building a simple lambda function and i'm trying to include some statics font assets within the compiled directory. I have created a .d.ts file inside the project with the image file extension, ...
Sgt_Scott's user avatar
0 votes
0 answers
10 views

ASP.NET MVC web app looping between fields only on some devices

devtools screenshotI'm not a developer but working with one to try and get a fix for my web application. This specific issue is not happening on any desktop computer but appears to be happening on my ...
Stephen Wiggins's user avatar
0 votes
0 answers
12 views

NextJS refused to execute script from fetched resource because its MIME type ('') is not executable, and strict MIME type checking is enabled

I'm using nextjs:14.1.0 react:^18 with typescript:5.3.3 and post npm run build command build, I'm getting this document sample - <!DOCTYPE html> <html lang="en"> <head> ...
ArifMustafa's user avatar
  • 4,797
-1 votes
2 answers
32 views

When to extend and provide an abstract class in Angular?

@Component({ selector: 'my-component', template: `<ng-content></ng-content>`, providers: [ { provide: AbstractClass, useExisting: forwardRef(() => TargetComponent) } ] }) ...
Alan-A's user avatar
  • 1
0 votes
0 answers
10 views

Running Test in Azure failed at Cypress: "The plugins file is missing or invalid"

I'm quite a novice to React and TypeScripting. I'm creating my first Build Pipeline in Azure for a React app. It is for now just a dummy app, to make sure the build can be completed. But it is failing ...
KVN's user avatar
  • 903
0 votes
1 answer
13 views

Intellisense not working when importing custom npm package

I have a custom npm package i created using storybook. The components work fine in other projects when importing them however the intellisense is not working. When i import the same component within ...
Maxqueue's user avatar
  • 2,324
-1 votes
0 answers
13 views

Trace a single endpoint with AWS Distro for OpenTelemetry (ADOT)

I'm working on a Node.js application with ADOT. The issue is that by default ADOT creates traces for the entire app. How can I create traces for a specific endpoint? This is the way I'm using ADOT: ...
Sebastián's user avatar
0 votes
0 answers
12 views

Creating base pinia action that can be mixed-in to several stores with typescript

I am trying to create generic actions that can be mixed-in to several pinia stores. However I don't manage to make the types work. Consider the following base state and actions : import { Store, ...
sebpiq's user avatar
  • 7,642
0 votes
0 answers
15 views

Getting the following Error "http://localhost:3000/api/signup 500 (Internal Server Error)" on Sign Up feature trying to build in Next React TypeScript

Can anyone tell me why I am getting this error: Here is my Sign Up front end code `"use client"; import { zodResolver } from "@hookform/resolvers/zod"; import React from "...
SHUBHANKAR SHAKHARI's user avatar
1 vote
0 answers
17 views

Slate.js - How to get Absolute Text Selection

I'm trying to implement a collaborative text editor using Slate.js, with React and Typescript. For applying text styling and broadcasting to other clients, I need the exact selection of the text that ...
r1c4rdco5t4's user avatar
2 votes
1 answer
33 views

How can I create a compiler error if a variable is NOT of type never?

Let's say I have a list of conditionals and I want to handle every possible value of type. If I added a new type in the future and I forget to handle it, I want an error - at least a run-time error, ...
d2vid's user avatar
  • 2,176
0 votes
1 answer
20 views

How can I get + sign from url parameter

I am trying to send a bloodGroup in a url parameter like A+ or A- but I can't get any sign. https://blood-donation-servers.vercel.app/api/donor-list?bloodType=A+ how can I solve this? I want to get + ...
Md Emon Sheikh's user avatar
1 vote
0 answers
10 views

NX Monorepo 'rootDir' is expected to contain all source files

I was playing around with NX monorepo NestJS + React. It has a many shared library, for sharing types and DTO-s. I have a setup for TypeORM migrations, which compiles the NestJS project using TSC, not ...
szelephezag's user avatar
0 votes
0 answers
7 views

'EChartsOption' is not assignable to parameter of type 'EChartOption<Series>'

I am getting this error. Tried to fix but not getting anything. I need to deploy the app. Due to this error I am unable to build the app. Want some help in this. This is the code part I am getting ...
Anish Kumar Mohanty's user avatar
0 votes
0 answers
22 views

react-hook-form generic field component

I am trying to implement form field component that can be used in root form level and as nested field. export type FirstNameField = { firstName: string; }; type GenericFormType<T, NS extends ...
Denis Autushenka's user avatar
0 votes
0 answers
15 views

Material UI doesn't read custom interfaces

I have a custom defined index.d.ts file inside @types/@mui folder in order to define custom interfaces for the edited material ui components. Here is my index.d.ts file: import { DefaultTheme } from '@...
andorando's user avatar
0 votes
0 answers
21 views

React: Implementing Long Press Button Functionality

I'm attempting to implement a long press button functionality in React where pressing and holding the '0' digit button for 3 seconds turns it into a '+' symbol, and when it's just clicked, it should ...
Adil Hashmi's user avatar
1 vote
1 answer
33 views

Why is typescript converting this nullish coallesce to a ternary?

I am working on an Angular app and I have the following code: // ... this.x = y ?? z; // ... When I run ng serve I get the following error in my terminal: error TS1109: Expression ...
deltasxb's user avatar
-1 votes
1 answer
13 views

What's causing this Next.js type error on build?

With Next.js 14.1.0 I got the following build error (similar to this SO post): Type error: Type 'OmitWithTag<typeof import("{omitted}/src/app/{omitted}/page"), "default" | "...
strongmmc's user avatar
  • 145
0 votes
0 answers
11 views

How to Configure Separate Paths for Components and Shared/Utils in a Vite React Library

I have a Vite-based React library, currently structured like this: import { Button, Typography, Box, Flex, Color, TypographyVariant } from '@placeholder-library'; I want to separate the imports so ...
Manspof's user avatar
  • 193
0 votes
0 answers
15 views

Autocomplete does not work correctly in WebStorm (TypeScript)

The same project is open. My Icon component is typed correctly. Why does VSCode, when displaying values for the name field, show only the values available to it, while in WebStorm it offers values ...
Gorbatov Sergey's user avatar
0 votes
0 answers
8 views

NextAuth custom adapter creation for an API endpoints

I have a Rest Api application with back-end written in Spring Boot and UI in NextJS. This is my first experience wit Nextjs. NextAuth docs says that to do a connection between my UI and API we can ...
Nikodev's user avatar
  • 13

1
2 3 4 5
4593