Category "typescript"

How to make some fields in object required

I need an interface for making some fields of other interface as required. For example: I have IUserInterface: interface IUser { name: string; role?: str

I get "Http failure response for (unknown url): 0 Unknown Error" instead of actual error message in Angular

I'm using Angular 4 HttpClient to send requests to external service. It is a very standard setup: this.httpClient.get(url).subscribe(response => { //do so

Vue3 Vuex Persist not saving data appropriately

I'm having a difficult time getting Vuex-Persist to work properly. Basically, not saving the data it should: Secondly, it disappears upon refresh. Which defeat

Angular: Google Material Icons not rendering

In Angular project Google material icons are working fine in chrome but not rendering in chrome incognito mode and firefox . In index.html below lines are used

Angular oriana weather city condition

We had written code for angular Oriana weather condition. in that there is a file / code for weather ts. when compiling getting error. Code is - Search TS impo

@types included in 'typeRoots' but only working if explicitly included

I'm attempting to use the grecaptcha types package (@types/grecaptcha), but even though in my tsconfig, its setup as: "typeRoots": [ "node_modules/@types" ],

Angular: Cannot Get /

I am trying to open, build and run someone else's Angular 4 project but I am not able to view the project when I run it my way. I don't see what is going wrong

TS2307: Cannot find module './images/logo.png'

I'm trying to import a local png image into my ts webpack project, and I get the following error. TS2307: Cannot find module './images/logo.png'. All my othe

How to install typescript + jest with create-react-app?

I want to install typescript and jest in a create-react-app-based app. I feel that since this is such a common installation choice there must be at least one "e

Angular/Jest - Test that the subject has thrown error after setter is called

I have a class that is responsible for setting the theme for my application. I'm trying to test that it throws an error if you give it a theme that it does not

How do I mock AWS S3 GetObjectCommand with jest using the v3 sdk?

Testing an s3 upload? The method to test is export class ProcessData { constructor() {} async process(): Promise<void> { const data = await s3Cl

How do I create a generic factory method that access static members of the class type it's creating

I'm using Typescript to write REST API endpoints as Functions over Firebase, and the methods all follow a similar pattern: check for a request.body, pull the ap

Including / importing .d.ts file exports

Simple question but couldn't find the answer: I have one file example.d.ts and one file example.ts, and I have a export type myType = {a: string} in the .d.ts.

How to import directives in a nestJS graphQLModule?

I need to generate typeScript types for mongoDB using graphql-code-generator and the typescript-mongodb plugin, but I don't understand how to import the directi

TypeScript, Vue, and MirageJS: Problems with TS compile errors

The problem: I am required to use Vue and MirageJS in a TypeScript web app, and in that web app, I get TS compile errors. The code: import { Server, Model } fro

Angular: 7.2.1 ES6 class ReferenceError : Cannot access 'X' before initialization

I'm having the following TypeScript class export class Vehicule extends TrackableEntity { vehiculeId: number; constructor() { super(); return supe

How to create nested moduleNameMapper in Jest?

My simplified jest.config.js is: module.exports = { preset: "ts-jest", collectCoverage: true, collectCoverageFrom: [ "src/**/*.ts", "!**/node_mod

How to save Dynamic Form Answer in Angular?

I'm trying to save some data that I display dynamic in the browser.This is my HTML where I iterate trough a list of exam questions dragged from the database and

How to give a unique constraint in lucid model, I am using lucid in adonis with typescript

In adonis.js i am trying to add a unique constraint to email field just like we do it in sequelize,prismajs or any other orm.Is it posible to add in adonis.

Disable the entire form at once (Angular reactive form)

Is there any way to disable the entire form in angular when using Reactive forms. I know it is possible to make them disable one by one. this.tempForm = this.