234,328
questions
0
votes
0
answers
5
views
Error 'cannot find prettier-plugin-tailwindcss' when trying to run ESLINT with a custom package
I would like to run ESLINT and a custom ESLINT package that's on this link
However I have this error in my output:
[Info - 9:42:21 AM] ESLint server is running.
[Info - 9:42:25 AM] ESLint library ...
0
votes
1
answer
10
views
How to get typescript to infer the literal string value for a type, rather than the generic `string`
I am writing a library to define schemas.
Consider the following example:
type Cardinality = 'many' | 'one';
type ValueType = 'string' | 'number';
interface ILinkDef<Source> {
fwdCardinality:...
1
vote
0
answers
9
views
How to correctly infer dependent properties in recursive TS types
Context
I am writing a schema library, where users can define a relationship between tables.
For example:
Users can define tables posts, users
Users can define a relationship: posts have one owner, ...
0
votes
0
answers
8
views
Ionic / Angular - Transform Promise in callback - Storage don't get a value to use in next functions
I have a token in storage memory, but on load with "get" method:
import { Injectable } from '@angular/core';
import { Storage } from '@ionic/storage-angular';
@Injectable({
providedIn: '...
0
votes
0
answers
9
views
How to config a react vite project to microfrontend approach using dynamic remotes from module federation?
I have a project that uses react and vite, and I set up a microfrontend approach using @module-federation/vite to get the remotes, also in the remotes the same stack and config. Now I want to dynamic ...
-4
votes
0
answers
49
views
Construct object from type? [closed]
I'm getting tired of updating my TS types and my object literals everytime I change a model. For instance:
interface MyModel {
A: string | number
B: string | number
}
const myModel : MyModel = {
...
0
votes
0
answers
17
views
Angular carousel timer block webapp
i have an issue i am developing a web app in angular V18 my problem is when i implement a carousel this just have text and it must be change every 3 seconds the idea its ok, but in the code when i ...
0
votes
2
answers
24
views
Add Comma After Each Space
I am trying to add an event in a textarea to put commas after each space. As an example:
Input 1:
2 2 2 2
Output 1:
2,2,2,2 or 2, 2, 2, 2
Input 2:
2 2 2 2 2 2
Output 2:
2,2,2,2,2,2 or 2, 2, 2,...
-1
votes
0
answers
21
views
Typescript and Django REST API: Typing a Generic Fetch Function
Django REST Framework's (DRF) Typescript generator produces unique and unparameterized versions for
retrieving content from Django. For example, in my codebase there are two Django-side models,
"...
1
vote
1
answer
26
views
How to correctly type useTemplateRefsList in a recursive component in Vue 3?
I'm working on a recursive Vue 3 component using the Composition API and the useTemplateRefsList function from @vueuse/core.
My goal is to collect references to each instance of the recursive ...
1
vote
2
answers
31
views
How to Prevent Child Component Destruction When Re-fetching Data with Angular Observables
I have an Angular app that makes multiple HTTP API calls. I combine the results of these APIs into a single stream of data, which is then passed as inputs to child components. In the template, I use ...
0
votes
1
answer
31
views
Stripe not showing paymentDetails in production. Using NextJS
I've already tested my application using Sandbox credentials, both publishable key and secret.I'm now trying to enable stripe in production mode.
The issue
In my ui when I change the publishable key ...
0
votes
0
answers
18
views
Deno-ts typing support identifies lists (string[], ...) as empty object ({ })
I work on VS Code and I use denoserv. The deno.json of my project is quite simple:
{
"compilerOptions": {
"lib": [
"DOM"
]
},
&...
0
votes
1
answer
40
views
How to type a variable to contain a derived class
I don't know how to type a variable to contain a derived class that will be instantiated when needed.
// I have a base class...
abstract class Base {
constructor() {
console.log("...
3
votes
1
answer
43
views
Can we remove all the constructor-based injections?
Recently, Angular put in place a migration to replace constructor-based injection with inject function.
In most of the cases, it is straightforward and it clearly has benefits:
// before
@Injectable({ ...
1
vote
0
answers
20
views
Typescript: Type is assignable to type T but T could be instantiated with a different subtype of constraint error when passing function prop
I've seen quite a few questions about this error, mostly in the form of a function taking a generic that extends a type and expecting the return to be of the same type.
What I currently understand:
...
0
votes
1
answer
38
views
React function in child component can't see state when called from another component
I have a Parent component containing a Child component.
The Child holds multiple form elements, along with their state and functions to validate them.
The Parent has a form button that, when clicked, ...
0
votes
0
answers
12
views
Loom SDK: How to configure camera-only recording mode?
I'm trying to implement camera-only recording using the Loom SDK (version 2.2.0), but I'm having trouble getting it to work. I want to restrict the recording to webcam only, without screen sharing.
...
1
vote
1
answer
26
views
IntelliJ showing errors in standalone components
I recently created a new Angular 18 project, and I decided to use the standalone component approach. However, in my IntelliJ IDEA editor, I keep encountering the following error underlined in ...
-2
votes
0
answers
26
views
How to use fetch/axios call api get data in react is correct? [closed]
I have been learning React with TypeScript for a while now and have a question about fetching server data in React.
In Angular 2, fetching server data using a service is straightforward and easy to ...
1
vote
0
answers
13
views
Text Misalignment in Tables Generated with html2pdf.js and TypeScript
I'm building a TypeScript application that generates PDF documents using html2pdf.js. While the HTML tables render perfectly in the browser, the text inside the table cells appears misaligned (shifted ...
0
votes
0
answers
21
views
Jest failing because of import/export syntax
One of the files under test is importing the estree-util-to-js library, which causes Jest to exit with an error:
Details:
/.../node_modules/estree-util-to-js/index.js:8
export { toJs } from '....
0
votes
1
answer
35
views
Interface or type where type of one field depends on type of another one
I already have similar question: Declare type where type of one field based on value of another field
The main difference is that now I don't know the list of possible values
So let's say that I have ...
-1
votes
1
answer
33
views
How to handle authentication in a backend using Firebase Admin SDK and Express with TypeScript?
I am implementing sign-in logic for my app's backend, built using Express with TypeScript, and leveraging the Firebase Admin SDK. However, after exploring the methods provided by the auth instance and ...
1
vote
1
answer
128
views
Expo React Native ts Nativewind ( (NOBRIDGE) ERROR Error: Exception in HostFunction: Unable to convert string to floating point value: "large" )
I have problem with my expo react native with nativewind project,
when I upgrade the expo SDK from 51 to 52 and test the app on actual device iPhone 12 pro via expo app downloaded from app store
it ...
0
votes
1
answer
28
views
Getting request with auth token via Angular Interceptor and Intercepting further calls
I'm trying to authenticate to an API first and then "attach" the token to each one of my requests, but the one including 'connect'.
I have the following:
Interceptor
@Injectable()
export ...
1
vote
1
answer
21
views
Terminal gets stuck when trying to update Typescript for and Angularv18 project
I have a an Angular project (which has multiple projects inside) which I updated to Angular v18.2.12. I managed to update all dependencies but TS doesn't let me build, since 4.0.8 is installed but ...
0
votes
0
answers
14
views
How to create such a swiper/slider/carousel with animated indicators using framer motion?
I've created this slider/swiper using GSAP draggable for swipes and timeline for animating indicators.
Unfortunately, in order to make draggable more natural, it's required to use inertia plugin which ...
0
votes
0
answers
20
views
Using types from Vue3-mq
The Vue3-mq plugin apparently supports TypeScript, but I don't seem to be able to actually use the types in a Vue3 app.
We are installing the plugin in the "standard" way (according to the ...
0
votes
1
answer
23
views
Angular 18 Chart libraries [closed]
I am planning on migrating my angular project from version 17 to 18.
Currently I am using Plotly.js-dist-min library for graphs.
When building the project (ng build) the plotly.js library does not ...
0
votes
0
answers
25
views
How can I embed a PDF into the template via a web service?
Instead of using a PDF Exante button, I want to embed the PDF directly into the HTML. Is it possible to do that?
template
<ng-container *ngIf="step == 2">
<div class="home-...
1
vote
1
answer
26
views
Changing mantine TextInput error border color
Is there a way to use a selector to change the border color for Mantine V6 TextInput when the error is set?
I can do this by setting the borderColor within the sx object as follows:
<TextInput sx={{...
-1
votes
0
answers
33
views
How to resolve apiRequestContext.get: Invalid URL error [closed]
I have problem with making API request in my playwright project.
Here is example of code
const { test, expect, request, chromium } = require('@playwright/test');
test('API request with browser ...
1
vote
0
answers
18
views
Setting up Keycloak using keycloak-js on nextjs app - context values not updating
i'm trying to set up keycloak on my next-js app using keycloak-js, It needs to be setup in a way where it is able to do something like the screenshot attachedkeycloak required structure
So the journey ...
0
votes
0
answers
12
views
useSound dynamic volume in NextJS
I am trying to implement a global volume button that sets volume level for button click, I'm using https://github.com/joshwcomeau/use-sound.
I have this VolumeButton.tsx
export default function ...
0
votes
1
answer
44
views
Type narrowing outside switch
I have interfaces like this.
interface subA {
attr1: number;
}
interface subB {
attr2: number;
}
interface A {
type: 'A';
subList: subA[];
}
interface B {
type: 'B';
subList: subB[];
}
...
0
votes
1
answer
33
views
default type arguments doesn't check object property names
I want to create a HiddenField type to ensure an object has both value and hiddenValue properties. However, even though I've provided default type arguments, I'm not getting an error when I pass an ...
0
votes
1
answer
19
views
Why i'm getting this property in promise : body.__zone_symbol__value? Angular 16
I'll be simple this is a method to find any File type key in a formdata object, to save it in a indexed db.
So, first i save the info like this: const data = item instanceof FormData ? await this.idb....
2
votes
2
answers
51
views
Typescript can't see default properties in JSX
I expected it works:
interface Point {
x: number;
y: number;
}
function A({x, y}: Point = {x: 1, y: 1}) {
return `x:${x}y:${y}`;
}
export default function App() {
return <A/>; //error ...
0
votes
1
answer
40
views
how to create a downloadable link which loads the file from a backend server only when clicked in Angular
I have a situation where I have a list of items each represent a file. All these files can be fetched from a backend as blobs. I want to have links in the frontend when user clicks should be able to ...
0
votes
0
answers
20
views
Problem building query sequelize-typescript
I am currently facing an issue when creating a query with sequelize-typescript. The problem arises when trying to fetch records from a many-to-many relationship. Here is the SQL query I am trying to ...
0
votes
0
answers
20
views
toggle button status is not changing
{
dataField: activationStates.active,
text: "Active",
formatter: (cell, row, rowIndex) => {
const toggleId = `active-status-toggle-${rowIndex + 1}`;
...
-1
votes
0
answers
27
views
SyntaxError: Cannot use import statement outside a module : jest + Angular
I am trying to run a jest test and I am getting
D:\my-proj\node_modules\@angular\core\fesm2022\testing.mjs:7
import { ɵDeferBlockState, ɵtriggerResourceLoading, ɵrenderDeferBlockState, ...
1
vote
1
answer
54
views
Make Typescript infer object type by its property [duplicate]
I would like to have a function that takes a list of sections and then renders them. Here's a simplified example:
enum SectionType {
Image = 'image',
Title = 'title',
}
type ImageSection = {
...
1
vote
1
answer
52
views
Conditional parameter always resolves to undefined
I'm trying to make a value resolver like this:
type Method<TValue, TArgs extends [...any]> = (...args: [...TArgs]) => TValue;
function getValue<TValue, TArgs extends [...any]>(value: ...
0
votes
0
answers
40
views
why is typescript subclass returning superclass?
import * as pl from "nodejs-polars"
const foo: pl.Datetime = pl.Datetime("ms")
is getting Property 'timeUnit' is missing in type 'DataType' but required in type 'Datetime'. error....
1
vote
0
answers
21
views
Why does TypeScript infer a different type when using T extends unknown[] vs T extends (number)[]? [duplicate]
I'm trying to understand why TypeScript infers different types in the following cases:
Case 1:
declare function Test<T extends unknown[]>(values: [...T]): T;
const test = Test([1, 2, 3]); // The ...
0
votes
0
answers
7
views
Storyboard Docs "Copy Code" and "tags" integrations in custom docs pages
Storyboard Docs - "Copy Code" and "tags" integrations in custom doc pages
Hey, I'm new to Storybook. I'm currently displaying an array of components into a custom Docs page UI, but ...
0
votes
0
answers
13
views
React js with Zod validation superRefine not updated realtime with values changes
React js with Zod validation superRefine not updated realtime with values changes
for this code every thing is fine but I want when the user start with the end date and then the error show "...
1
vote
0
answers
18
views
Cannot use OpenPGP.js V6 in the browser: JavaScript module + TypeScript + Vite + SvelteKit
The issue
I am trying to use OpenPGP.js V6 in a webapp made with SvelteKit, TypeScript and Vite.
OpenPGP.js V6 is now declared as a module, and I cannot find a way to import it correctly with my ...