Why is it not allowed for TypeScript derived classes to have the same variable name, even if these members are private? Is there another way to achieve this, or am I making a mistake? class ClassTS { private nom: string = "ClassTS"; ...
After completing an http post request, I want to navigate to the next view in my app. Here is a breakdown of the three services I am using: The server service handles generic http calls such as get and post requests. The city service stores a list of ...
I am a beginner in Angular and I have a JSON file that holds the configuration URL for my application. Path: app/config/development.json { "apiUrl": "http://staging.domain.com:9000/", "debugging": true } Below is the content of my config.service.t ...
I recently developed a service called SecurityService to handle authentication. Check out the code for this service below: import { Injectable } from '@angular/core'; @Injectable() export class SecurityService { items: any[]; construct ...
I have posted my module, component, and package file here. I am attempting to implement a click event with ngif, but I keep encountering an error. The specific error message is "ERROR in NgSemanticModule is not an NgModule". I'm unsure if this error ...
While exploring some code, I came across the following: export interface SomeInterface<T> { <R>(paths: string[]): Observable<R>; <R>(Fn: (state: T) => R): Observable<R>; } After searching through the TypeScript do ...
After creating an array, I need to access the elements outside of the loop. I am aware that they are not in the scope and using 'this.' before them does not grant access. colIdx = colIdx + this.columns.findIndex(c => c.editable); this.focusIn ...
Is there a way to initialize an instance of a class with an object literal that doesn't contain all the elements in the class, but those present are part of the class? class Example{ text:string; number:number; displayResult(){return thi ...
I am trying to implement async await in my code, but I keep getting an error that says await is a reserved word. Here is the snippet of my code: public componentDidMount() { this.startDrag(); } private startDrag = async () => { const eleme ...
Exploring the Implementation of Angular 6 Route Auth Guards Across Root and Child Routes ...
Implementing the async-await technique to handle the promises, I encountered an issue where then() is being called before the completion of Promise.all(). Revised After changing from Promise<void> to Promise<string>, the problem persists wi ...
Within my service class, I have an array of quests defined in the following manner: import { ObservableArray, ChangedData } from 'tns-core-modules/data/observable-array/observable-array'; quests: ObservableArray<Quest>; To add quests to ...
Currently utilizing Angular 6 along with Rxjs 6. A certain piece of code continuously throws undefined at the ListFormsComponent, until it finally displays the data once the Observable is assigned by calling the getForms() method. The execution of getForm ...
Is it possible to import a JSON file without specifying the extension in typescript? For instance, if I have a file named file.json, and this is my TypeScript code: import jsonData from './file'. However, I am encountering an error: [ts] Cannot ...
I'm completely new to Angular and I feel like I might be overlooking something important. Within my component, I have 3 variables which are populated after invoking the .subscribe method on an observable object. For example: this.interRetard = this ...
I am currently trying to calculate the percentages of different statuses based on 3 count values. Let's assume I have 3 statuses: 1) Passed 2) Failed 3) Skipped When dealing with only two cases, I was able to use a combination of the Floor and Ceil ...
Currently, I am working on implementing a more intricate version of a behavior inspired by Angular Material's tutorials. In my simplified example, an Angular Material table is populated with data from a string array. The first column contains input fi ...
While upgrading from Angular 5.2.11 to 7.3.9, I encountered a types issue that was not present in the previous version of Angular. After fixing the import for forkJoin, the code snippet below now throws an error: ERROR in src/app/reports/report-measureme ...
I'm just starting out with Typescript in React. I've created a simple functional component, but eslint is giving me an error saying that the return type for the functional component itself is missing. Can anyone help me figure out what I'm d ...
There are a few issues that I'm struggling to resolve. I am utilizing SwaggerService to fetch data, but the response is coming back as undefined. import {SwaggerService} from '../../services/swagger.service'; export class TestComponent im ...
[Updated on 16th July 2019] I'm feeling perplexed at the moment. I am diving into a .NET Core 3.x Web Application and my aim is to incorporate: jQuery TypeScript I've managed to get TypeScript up and running, but I'm facing an issue where ...
TypeScript Version 3.5.1 Playground I've encountered an issue with TypeScript where the compiler fails to flag missing arguments in function declarations. Here's a basic illustration of the problem. interface IArgs { foo: number; } type MyF ...
I've been exploring different coding styles in TypeScript recently. When it comes to initializing an object from a class, what are the advantages and disadvantages of these two code styles in TypeScript? class Class3 { // members private rea ...
Hello! I am attempting to remove the last digit of a string and update the input value each time my function checks if the input value passes a regex test on keypress. Initially, it works correctly, but then it adds an extra digit. After that, it works a ...
Currently, I am utilizing a Material UI icon as a logout button in my project. Here is how I have implemented it: function logout(props:any){ localStorage.removeItem("token"); return( <Redirect to="/login" /> ) //props.history.push("/log ...
Working on a front-end application utilizing React, Typescript, Effector, FetchAPI, and other technologies. Created an Effector effect to delete an item in the backend: export const deleteItemFX = createEffect({ handler: (id: string) => { return ...
Within my nodeJS application, I have organized a models and seeders folder. One of the files within this structure is address.model.ts where I have defined the following schema: export {}; const mongoose = require('mongoose'); const addressS ...
Disclaimer: I am still learning about angular and TypeScript in general. My goal is to create an activation component that can submit a code directly to the service if it's included in the URL parameter query. If the code is not in the URL, then the ...
Is it possible to transition a VUE JS project from JavaScript to TypeScript without rewriting everything? I heard from a friend that it can be done through the VUE CLI, but I haven't been able to find any documentation or articles on this method. Has ...
My VueJS view was originally written in JavaScript using the component "splitpanes" from npm package. The code was functioning well with the following structure: <template> <div> <Splitpanes :dbl-click-splitter="false" :horizont ...
I'm encountering a slight issue with a dropdown button while working on making my website mobile-friendly. My goal is to have the button drop down on the left-hand side of it. Below is the snippet of my html code: <!-- A div element for the button ...
Does anyone have a solution for subscribing to responses when the tap operator is used in a service? edit(status) { dataObj.val = status; // call post service with status.. this.service .update(dataObj) .pipe(takeUntil(this._n ...
export class AlphaComponent implements OnInit { apiData=[]; //array that stores API data constructor(private helpService:HelpService){ }; ngOnInit(){ this.fetchData() }; fetchData(){ this.helpService.getPostId().subscribe(( ...
My goal here is to design a group of checkboxes. The "Search everywhere" option is initially checked by default. If you check any other checkbox, the "Search everywhere" box automatically unchecks. You're allowed to check multiple checkboxes, but once ...
Is there a method to eliminate the as any in the update_substate function? It seems type-safe when directly invoking the update_state function, so it should also be safe when invoked indirectly, right? These functions are meant to be lightweight helpers ...
I am currently working with React to layout three elements below the topElement. My goal is to have these 3 elements fill up the space equally beneath topElement, removing the right-hand gap highlighted in red in the provided image (while keeping the gap a ...
In my application, I have set up two columns using dragula where I can easily drag and drop elements. <div class="taskboard-cards" [dragula]='"task-group"' [(dragulaModel)]="format"> <div class="tas ...
Hey there, everyone! I'm facing an issue with integrating a template into my Angular project. It seems that the filter function is no longer available in the Observable library (Update from 10 to 11?). I attempted to use pipe as a solution, but as a ...
Click here for a hands-on example. Take a look at the code snippet below: export type BigType = { foo: number; bar?: number; baz: number; qux?: string[]; }; function BuildBigType(params: string[]) { // Here's what I'd like to do: ...
While attempting to download a file in Firefox, a download dialog box pops up. I am looking to disable the download dialog box specifically for zip files so that they are downloaded automatically. Despite trying various preferences settings, the dialog box ...
I've been referencing the Github repository at this link for my project. Following the instructions in the readme file, I proceeded with running a series of commands which resulted in some issues. The commands executed were: yarn install sfdx plugi ...
I've recently received an Ionic + Capacitor app that is primarily meant to run on the Android platform. My current task is to incorporate communication with a remote ActiveMQ broker into the app. To achieve this, I utilized the STOMP JS library which ...
During the development of this project in react and typescript using create-react-app, I encountered no issues. Now, my aim is to publish one of the components on npm. I have come to understand that I need to build this component separately from an existi ...
My current project involves creating a multi-line chart using d3.js in React. However, I am encountering an issue with the alignment of gridlines in the plot. The problem seems to be random, as some graphs have aligned gridlines while others do not. The c ...
After struggling for 48 hours, I still can't figure it out. How can I trigger the onSubmit method in the CreateProject component when the onApply function is called in the ModalContent component using TypeScript and react-hook-form? The concept is sim ...
I'm currently developing a React application and I have come across an issue with importing images. My usual method of importing images is as follows: import image1Src from 'assets/img1.png"; For testing purposes, I need to be able to make ...
I'm currently facing an issue while writing unit test cases using Jest in my Angular project. Whenever I attempt to run my test file, the following errors occur: TypeError: Cannot read property 'features' of undefined TypeError: Cannot read ...
Greetings! I have developed a straightforward Angular 12 project featuring a login page and a home page. Below is the code structure for your reference: <div class="text-center" style="width: 100%"> <h1>home</h1> & ...
I have a Vue3 component where, within the setup(), I have defined the following function: const writeNote(note: Ref<Note>) => { console.log(`note ${note.id}`) } This function takes a Ref<Note>, with Note being an Interface. There are two s ...
I am currently working on a one-page website project to enhance my Angular skills, and I'm facing a challenge with animating multiple DOM elements using a single animation. Defining the animation for each element individually seems like a cumbersome a ...
Here is my implementation of the createSlice() function: import { createSlice, PayloadAction } from "@reduxjs/toolkit"; type TransferDeckModeType = "pipetting" | "evaluation" | "editing"; var initialState: Transfer ...
I am looking to develop an application that can seamlessly update a nested configuration file after it has been imported (similar to swagger). To achieve this, I first created a JSON configuration file and then generated corresponding interfaces using the ...
Currently, I am utilizing Strapi for my backend and have created a small script to handle authorization for specific parts of the API. Additionally, I made a slight modification to the controller. 'use strict'; const { sanitizeEntity } = require( ...
Struggling with adding and removing event listeners to HTML elements capable of focus, such as buttons. encountering a typescript error specifically related to the lines of code responsible for adding and removing the event listener: focusableElements.fo ...
This question shares similarities with another post I made, but this time focusing on using classes instead of plain objects. class Exception1 extends Error { constructor(message: string, public arg1: string) { super(message); } } class Ex ...
interface DataStructure { name: string; url: string; date: string; popular: boolean; } const itemData: DataStructure = { name: "Item 1", url: "item-1", date: "2012", popular: true, }; function getItemByURL(keys: Array<k ...
Our unique project is utilizing a combination of pnpm, workspace, and typescript in adherence to the monorepo standard. Upon cloning the repository, we execute a pnpm install command to download dependencies and establish links between local packages. De ...
While working on a project using Styled Components in React, I have successfully created a component as shown below: export const Screen = styled.div({ display: "flex", }); When implementing this component in my render code, it looks like this ...
type ItemX = { type: 'X', value: 'X1' | 'X2' | 'X3' }; type ItemY = { type: 'Y', value: 'Y1' | 'Y2' }; type Item = ItemX | ItemY; function processItem(item: Item) { // ... } function ...
I am currently working on setting up the Angular environment for a project that was created by another individual. As I try to install all the necessary dependencies, I keep encountering the following error: https://i.sstatic.net/9knbD.png After some inv ...
Within my module, I have a function called shuffle<T>(a: T[]): T[] that is exported by the random module. While testing two methods in another class that rely on this function, I need to mock it. Here's how I attempted to do so: jest.mock(' ...
I have integrated vue-cookies into my app in the main.ts file: import VueCookies from 'vue-cookies'; ... const app = createApp(App) .use(IonicVue) .use(router) .use(VueCookies,{ expires: '30d', }); Despite adding the cookie v ...
There seems to be an issue with the function not being called when passed into a functional component. While the onSubmit function is triggered, the login(email, password) function inside the Login component is never executed. Despite placing console.log s ...
Currently, I am working on integrating charts from antd into my TypeScript application. Everything runs smoothly on localhost, but as soon as I push it to GitHub, one of the tests fails: FAIL src/App.test.tsx ● Test suite failed to run TypeError: ...
I'm currently facing an obstacle while trying to pass a column from a parent component to a child component in Angular. The issue arises when attempting to sort the column. Below is the code snippet: Parent component <table-sorting-example matSort ...
The upcoming release, as outlined in RFC3, will introduce signal-based components with change detection strategy solely based on signals. Given the current zone-based change detection strategy, is there any advantage to using signals instead of the tradi ...
Having built a substantial web application using NextJS 13, I initially utilized the Pages Router. However, as I neared completion of the website, I decided to make the switch to the App Directory. The primary motivation behind this migration was not just ...
In my node application, I am utilizing the typeorm library for entity mapping. My goal is to establish multiple type relations between entities. While following the documentation, I noticed that the entity properties are marked as public, allowing access f ...
I am experiencing an issue with my form element that contains a few input fields. Two of these inputs are set to readOnly and have values passed in from a calendar element. Even though the input elements contain valid dates, they still display an error mes ...
When using the window.addEventListener, I am encountering an issue where it only triggers on the second click. This is happening after I initially click on the li element to view the task information, and then click on the delete button which fires the eve ...
My goal is to utilize Drizzle for inserting data into a table and updating it if the key already exists. In MySQL, the code would look like this: INSERT INTO myTable1(field1,field2,field3,field4) SELECT fieldOne,fieldTwo,fieldThree,fieldFour FROM myTable2 ...
Being new to NextJS, my question may seem trivial but I'd appreciate your patience. Essentially, my goal is to fetch data from a database and display it on the page upon the initial render. To achieve this, I am utilizing the useEffect and useState ho ...
How can I achieve the following ? Given : enum FooEnum1 { Foo = "foo", }; enum FooEnum2 { Foo = 1, }; interface FooInterface { foo1 : FooEnum1, foo2 : FooEnum2, foo3 : string, foo4 : number, }; I am interested in cre ...
Recently, I attempted to upgrade my Angular project from version 13 to version 17. However, during the process, I encountered an error stating "Unexpected value 'AppAsideModule' imported by the module 'AppModule'. Please add an @NgModul ...
Consider a basic queryBuilder implementation: const workout = await this.workouts .createQueryBuilder('workout') .select(['workout.uuid', `workout.name ->> 'it'` as name]) .where(&apos ...