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
232,364
questions
0
votes
1
answer
6
views
Telegram tapper on angular and types
Люди, нужна ваша помощь. Как мне написать программу на подобии HamsterKombat с помощью ангуляра и питона? Я читал на каком-то форуме, что для этого может понадобиться SQL, но это не точно. Это моя ...
0
votes
0
answers
12
views
I'm getting 401 Unauthorized when accessing protected routes using http only cookies in Laravel with axios
I'm working on a Laravel application with JWT authentication, and I'm trying to use http-only cookies for authentication. Despite setting the cookie correctly on login, I'm still receiving a 401 ...
0
votes
0
answers
5
views
logto.io | get a jwt token on login to access my api
I'm using logto.io to manage my app authentication with React.
When I only authenticate using the frontend, everything is fine as described on the docs.
Let's say this is my AuthProvider component, ...
0
votes
0
answers
9
views
Importing typescript modules within Google Apps Script
I would like to import modules written in typescript for Google Apps Script.
Currently, in my actions/action.ts I have:
import {Foo} from "../module.ts";`
Unfortunately, when using clasp ...
0
votes
1
answer
15
views
npx tsc --init is compulsory in typescript
I'm a newbie about typescript. I prefer installing Typescript locally in a project folder by running:
npm i typescript --save-dev
After installing Typescript compiler, my tutorial told me run npx tsc -...
0
votes
1
answer
25
views
Incorrect form validations triggered
I have formgroup which has input fields, the validations are set like this :
<mat-form-field class="mat-width-98" appearance="outline">
<mat-label&...
1
vote
1
answer
11
views
Injecting nested services
I have this folder structure:
.
├── lib/
│ └── dma/
│ ├── modules/
│ │ └── cmts/
│ │ ├── cmts.module.ts
│ │ └── cmts.service.ts
│ └── dma.module.ts
└── ...
0
votes
2
answers
27
views
"Each child in a list should have a unique 'key' prop", I don't understand how to do it
Hi so I have an assignment from my school, it has something to do with data fetching from randomuser.me and as I have followed the steps that were taught, I stumbled upon this sentence written on the ...
0
votes
1
answer
15
views
I can not place what causing NativeWind props to not be recognised in tsx
I am able to call className in jsx file, but not in tsx files. Can someone assist.
The error being thrown is:
No overload matches this call.
Overload 1 of 2, '(props: ViewProps): View', gave the ...
0
votes
0
answers
7
views
ClerkProvider Error in Nextjs. Attempted import error: 'SWRConfig' is not exported from 'swr'
I just started a new nextjs project installed clerk, set up the env.local and the middleware.ts files. Then I went to wrap the html div with ClerkProvider and got this error when i tried to run it on ...
1
vote
1
answer
36
views
Is it possible to force narrowing of a string type to the actual string value used?
Given a "passthrough" function that forwards an object where one of the keys is a string, is it possible to infer the type of that string prop as the actual value used rather than have it ...
1
vote
1
answer
24
views
Subtask is Updated Without Saving and Incorrect Icon Displayed on Reopening Task Dialog
I am encountering two issues with the subtask editing functionality in my application:
When I click the "Edit" button to edit a subtask and make changes, the subtask gets updated even if I ...
-3
votes
1
answer
21
views
Adding ignores to the typescript-eslint recommended configuration?
I'm trying to add an ignores object to the typescript-eslint configuration
I figured this would do the trick:
import eslint from "@eslint/js";
import tseslint from "typescript-eslint&...
1
vote
0
answers
9
views
Angular 8 to 17 upgrade: ngModel binding and PrimeNG component issues
I'm upgrading an Angular 8 application to Angular 17 and encountering issues with ngModel binding and PrimeNG components. My application uses a module-based structure with app.module.ts as the main ...
0
votes
0
answers
44
views
why can promise have only resolve [duplicate]
I can define as below
new Promise((resolve) => {
setTimeout(() => {
console.log('Promise Done');
}, 2000);
});
But according to the below promise.d.ts file, both resolve ...
0
votes
0
answers
7
views
Live reload a shared Typescript Library during React + Firebase development
I am working on a small React + Firebase app and I am implementing some backend functions through firebase functions. There are some shared datatypes and logic between the front end and backend and, ...
0
votes
0
answers
9
views
angular ssr not rendering in production
i have created a Angular app with @angular/ssr in v-17. It works fine in localhost but when deployed to production it is not rendering from server. I mean its rendering in network tab but is not ...
0
votes
0
answers
16
views
Render Error View config getter callback for component RCTModalHostView must be a function (received 'undefined')
I am working on a mobile application in React native (using Expo [SDK :~51.0.18])
Note : I am using Expo router to handle all routing in my project.
I am attempting to integrate this new SDK (Lean ...
0
votes
0
answers
28
views
next.js: useSession is not a function
I have a next.js project using next-auth and I've successfully set up login and now I'm trying to use the session to get userdata on a page but when I try to use useSession() I get
TypeError: (0 , ...
0
votes
0
answers
18
views
Input field in React/Next.js not accepting commas
I'm encountering an issue with an input field in my React application built with Next.js. Specifically, when using an iPad device, the input field behaves inconsistently with commas.
On desktop ...
0
votes
0
answers
20
views
Auth0 callback route - visible in requests but not executing related code
I have an express backend to which I added Auth0. I'm also using express-openid-connect to handle most of the work. The problem is that whatever I do, I cannot get the callback route to work. I see it ...
0
votes
0
answers
16
views
Using zod form validation with radio button group that has no default checked value on first render
I have a simple form that I am using zod to validate. For simplicity let's say the form has exactly one user field for specifying a selection:
const FormSchema = z.object({
options: z.enum(["...
1
vote
1
answer
38
views
Is it possible to inherit type based on keyof template in typescript?
I was trying to do a little hack. I can see how for example DOM ts files map different element names to their types.
I was wondering if I could make it so that a type MyType extends a different set of ...
0
votes
0
answers
24
views
Why esbuild desn't include functions from the lodash-es into the bundle?
I'm creating a plugin for the Chrome browser and using esbuild to create a single js file from the set of the typescript files, everything is fine except that esbuild does not include the function ...
0
votes
0
answers
9
views
Jest has different behavior in watch mode
I'm writing a extension for chrome omnibox. And I'm using jest to write testing, but I found that the behavior of npx jest and npx jest --watchAll are different.
Detailly, npx jest works fine and it ...
0
votes
0
answers
12
views
Need assistance for understanding code (TypeScript with Playwright and Axe-Core)
I'm new to TypeScript and working on a Playwright-Test-Project for Accessibility-Testing with the axe-core package.
It all works fine, but I dont get some parts of the code and I hate this feeling of ...
-3
votes
2
answers
33
views
Why 'eslint' + 'typescript-eslint' used for TypeScript linting when 'tsc' appears to work better? [duplicate]
Goal: To create a strict TypeScript linter script
eslint checks for poor JavaScript code patterns.
The docs suggests initialising eslint with npm init @eslint/config@latest
This also installs ...
1
vote
1
answer
24
views
Typescript error based on logical AND and OR check (defensive programming)
I'm learning typescript, type safety (defensive programming), and i'm trying to implement a linked list with typescript.
I don't understand why when I change the logical OR (||) to logical AND (&&...
0
votes
1
answer
21
views
How to handle a iframe which is available in another iframe
There is a iframe which is embedded in another iframe in a page. I need to do action in elements which is present in child iframe and exactly here facing an error to perform action on element.
Rough ...
0
votes
0
answers
16
views
SAPUI5 - TreeTable - How to store and bind the expanded state of node
I am using typescript for views and controllers for this one. I just want to store the expanded state of nodes of TreeTable somewhere when table is filtered and restore if table is not filtered ...
1
vote
0
answers
20
views
Pagination doesn't working for dynamic angular material table
I'm working with Angular 18 and use angular material. I build preview component with dynamic talbe, so any json that comes from parent table should be places as table. But my pagination doesn't work.
...
0
votes
0
answers
15
views
Angular - "Invalid ICU message. Missing '}'.ngtsc(-995002)" error
In my Angular code, I use interpolation. But, it poses an error although the syntax is correct. (Angular v18.1.0, node v20.15.0, typescript v5.4.5, rxjs v7.8.1)
Here are code snippets from the same ...
0
votes
0
answers
19
views
Is there any way that I export my styles from a package I write to use in my other projects?
I have a package made up by ReactJs, rollup. I used TS in my structure and use .module.scss files to add styles to my components.
but when I build the package in /dist directory, it doesn't have any ...
0
votes
2
answers
26
views
when i install node js npm did not working
PS C:\Users\hp> npm -v
node:internal/modules/cjs/loader:1143
throw err;
^
Error: Cannot find module 'C:\Program Files\nodejs\node_modules\npm\bin\node_modules\npm\bin\npm-prefix.js'
at ...
-1
votes
0
answers
23
views
Trying to Implement Authorization Routes in React using react-router-dom v6
I am trying to implement a protected route system through the use of a context that holds the data to be kept in mind in order to give access to said routes.
The way I am checking these files ...
0
votes
1
answer
26
views
How to implement Optional chaining in ngModel using angular 18
I have scenario in my project that a common shared service having a common variable (object) to store nested objects. I have to access and update its value in html using NgModel. Optional-chaining ...
0
votes
0
answers
14
views
redux-persist failed to create sync storage. falling back to noop storage. in NextJS/App Router
I'm trying to set up a simlpe Redux store in my NextJS 14/Typescript web app with persistent data. Here's what I have so far from following official doc, and a few blogs here and there.
provider.tsx
&...
0
votes
0
answers
17
views
Why does the touch event only work sometimes?
I would like to make a touch event that works like a click on a button to toggle an expander. The problem is related to this component.
The problem is that on one component and DOM it works fine and ...
0
votes
1
answer
34
views
In TypeScript, how to solve the error: 'ReferenceError: HTMLElement is not defined'
I am trying to use TypeScript while I build a SPA on top of NodeJS and Express.
I'm type-hinting my modules to return types of HTMLElement, but it seems to give me an error.
For example:
export ...
0
votes
0
answers
13
views
Initializing a boolean formcontrol as null with formbuilder
I'm trying to use a radio button to get a boolean value from a user. The value should default to null, as the user hasn't answered anything yet. Here is the current implementation that works, but is ...
0
votes
0
answers
13
views
Angular Unit Test - Mocking a function on a property
Updating with some new attempts
I've tried several different approaches, and I'm obviously missing something fundamental on how to avoid this error and mock out this function. I've updated the mock ...
-1
votes
1
answer
28
views
How to import ESM inside nestjs?
I want to use this package called Ora from npm.
So, I did this:
$ npm i ora
Then, inside my project, I simply did:
import ora from 'ora'
But in my terminal, I got this error:
╰─>$ npm run start:...
0
votes
1
answer
10
views
Include a font asset in the html sent to Expo Print (React Native)
I'm needing to print a barcode in a Expo (React Native) App. I've tried to require the tff file (see below), but this does not work for me. If I use the same methodology to include an image, however, ...
0
votes
0
answers
14
views
@nestjs/axios - Axios Only Returns 502 Errors When Request Fails
I am currently facing an odd problem with Axios (through NestJS HttpService):
I have some Nest endpoints that make HTTP requests to another service. When the HTTP request succeeds, I get a good ...
0
votes
0
answers
19
views
Page keeps loading but data do not render from the API
Using Next.js and integrating with an API. I am able to get some search data from the api but to get further information from the api, when a link is clicked and goes to another component that is ...
0
votes
0
answers
9
views
Have an issue with types when creating a Fastify plugin to decorate mongoose models using Zod
I have created a Fastify plugin to decorate Mongoose models, adding them to the Fastify interface:
declare module 'fastify' {
export interface FastifyInstance {
models: {
[key: ...
0
votes
0
answers
8
views
TypeScript drizzle errors for a column that has been defined
I'm using Drizzle in order to interface with a postgres DB and a query to insert into the "stop" table randomly errors
Query
await db.insert(stopTable).values({
name: stopDetails.name,
...
0
votes
0
answers
33
views
How to Manage User State in Next.js 14: Context, Zustand, or Redux? [closed]
I've been working on a Next.js 14 application that supports two types of users: Admin and User. My goal is to have a globally accessible user state throughout my application without needing to run ...
0
votes
1
answer
30
views
How to read environment variables inside the app module import statement?
I have created a module called DmaModule, and expect the consumer of it (me), to pass in some options into it during its instantiation. These options are [dmaHost, superadminUsername, and ...
0
votes
0
answers
4
views
Searchbar API: i need to create search bar api in which data will get from database user record by using name, email or number
i am learning backend, new to express framework and having difficult creating search bar api, i am using typescript, express.js with prisma & postgresql with db client Dbeaver, help me out how to ...