Category "typescript"

Create a global function like jest does

I am working on a meta framework that will use react. I would like to offer some functions that are directly available without the need of an import, exactly li

How to order an array of object during a forEach()?

So, basically I have this array of objects and I need to order them dependently on the value caricoData, which is a date. Problem is, the value is a string and

Enforce Typescript object has exactly one key from a set

Basic Question and Context I'm trying to type an array of objects where each object has exactly one key from a set. For example: const foo = [ { a: 'foo' },

Angular: Dynamically find headers when converting JSON array to HTML table

In Angular, I want to convert a JSON array to an HTML table. I have seen an old answer for AngularJS: <table> <thead> <tr> &

How to find the length of data source using typescript in angular application

Unable to find length of data source(array) using typescript in angular application this.activatedRoute.data.subscribe( (res) => { console.log(re

Routing in Aurelia2

After I click Save Device, I want it to return to my default route where is list with all my devices, it adds a new Device but it show error on : "this.router.l

Is there a way to combine ES6 imports and commonJS require in TS compiled files?

I have changed the code of a project made in NodeJS to Typescript. Everything is working fine, except for the fact that apparently a third-part package (file-ty

Mochawesome use AddContext in afterEach with cypress

I spent the last 10 days trying to use the function addContext in the afterEach function as I'm using in "test:after:run" post action. The reason to do this is

How to access vue router in Vuex store module actions with Quasar framework?

I am using Quasar Framework v2 Beta Vue 3 Composition Api Vuex 4 Typescript My problem: When I import router and try to redirect User in Vuex store module actio

Upload single image from axios to FastAPI: "Expected UploadFile, received: <class 'str'>"

I try to upload an image from my react-admin app to FastAPI using axios. The ImageInput component returns a File object which I cast to a Blob and try to upload

Use react-intl imperative formatMessage with TypeScript?

I want to use formatMessage from react-intl (v5.25.1) for creating a string in order to use them later (in an event callback). For example this for my message (

React Router Dom v6 - Image not found in nested routes

In my tsconfig.json file, I have a "compilerOptions":{baseUrl} that enables me to look for images in public/images/foo.png like this <img src='images/foo.png

Material Icon showing as the name when site first loads

There is an issue with Angular 7 and materials icon where the name of the icon shows when the site is initially loading. Is there a way to prevent this

React Router: Conditional redirect if not query parameter present

I am trying to do a conditional redirect, if there is no 'state' query parameter in the url, I want to redirect to an error page. I am trying to do it in my App

Typing a partial record where any present key must be defined

How could one type a record/object where the properties are optional, but if they are present they must be defined? For example: type K = "foo" | "bar"; type R

Type 'object' is not assignable to type 'NgIterable<any> | null | undefined'

<!--app component.html--> <div class="position-relative container"> <div class="row justify-content-center"> <div cla

How can I aggregate/pivot this non-numeric data to show in a chart?

I'd like to show some data on a line chart. The source data looks like this: [ { date: 1, depth: 1, river: 'trent',

How to unit test typeorm getRepository with Jest?

I am using typescript with typeorm and i have an repository like this: import { EntityRepository, getRepository, createQueryBuilder } from 'typeorm'; @EntityR

How can I get live-reload on a local npm package in a monorepo?

I'm setting up a monorepo workspace for a Vue 3 (vite + ts), cloud functions, & shared-lib (shared functions and ts interfaces etc.). I can get the import o

Reduce height of mat-flat-button

I have a message board that I want to add delete buttons to, unfortunately the mat-flat-button seems to be doubling the height of the message items. If i set it