Category "typescript"

How to use ts-node regardless of errors?

I've got some trouble with ts-node when I develop. I want to test something, so as you know, comment is my best friend. But with ts-node I've got this error :

Add a spinner when Mat-table is loading?

I load the data in my material table like that : ngOnInit(){ return this.annuairesService.getMedecins().subscribe(res => this.dataSource.data = res);} I

Importing Javascript library (jsencrypt) into Angular 2 app

I have looked through all the tutorials revolving around this issue, and havn't been able to find a solution. Some background first. I have a Angular 2 app and

Setting values of input fields with Angular 6

I've ran into some trouble setting the value of an input element using Angular. I'm trying to set the value of dynamically created input elements in my applica

TypeORM OneToMany causes "ReferenceError: Cannot access '<Entity>' before initialization"

I have two entities: User and Habit. A user can create multiple Habits, thus I use a OneToMany relation on the User (and ManyToOne on the Habit, respectively).

Using rotate for images leads to blank pdf with pdfkit

I have asked the question on the repository directly, but in my experience SO is more reactive. Hey there, I am trying to create a pdf from photos using pdfk

Define rules for the access control using CASL

I read the article from link and understand there are 3 ways to define abilities. But I have no clue to combine them together. For example, In the three struct

SPFx: Add a new item to existing List Folder (using pnp)

Does anyone know how to add a new item to a List Folder in Sharepoint Framework? In this way I can add the item to the list MyList: let list = pnp.sp.web.lis

Making Prettier understend TS "as" operator when it is working with eslint

I'am tring to use Prettier with ESLint for TS. But it's fails with an error SyntaxError: Unexpected identifier, expected the token `)` (17:55) On line with

How to ignore typescript errors when compile by webpack production mode

environment webpack 4.41.2 typescript 3.7.2 problem When I compile files by webpack development mode, there is no problem. But when I compile by production

NestJS enable cors in production

I've enabled CORS in my NestJS app following the official tutorial, so my main.ts looks like the following: import { FastifyAdapter, NestFactory } from '@nestj

event.preventDefault() or event.stopPropagation() not working with keyUp event

Directive file: I am trying to do that if my counter goes above two it should stop event or keyUp to reflect but is it not working. Can someone help me on this?

Build a complex type from Union type

I'm trying to build a type with two layers from a flat union type Here's my code: type TextVariants = | { size: 'tiny' // available variants for t

Restricting object key type with const

I am able to define an object key type from a union like: type Action = 'foo' | 'bar' | 'baz'; type UserStates = 'active' | 'deleted' | 'dishonoured'; type Pe

Object is of type 'unknown' typescript generics

I have a simple function that takes a function as it's argument and returns a new function. I get Object is of type 'unknown' when calling the returned function

Cant download on iOS with expo-file-system

Im trying to download using Expo-File-System on an expo project with react native. The download option works on Expo-Go during testing but wont work when i push

How to redirect to external url onClick? in React

I'm using react-router which means i'm storing routes in app.tsx file. I have cards components that need to redirect to an external url onClick. So my question

Correctly declare interface or type for functions params

How to correctly declare type for param cardsByStatus inside function addCardsToStatus? It works for cardsByStatus: any, but it doesn't make sense for me. Error

Define an empty object type in TypeScript

I'm looking for ways to define an empty object type that can't hold any values. type EmptyObject = {} const MyObject: EmptyObject = { thisShouldNotWork: {},

How to inject service to validator constraint interface in nestjs using class-validator?

I'm trying to inject my users service into my validator constraint interface but it doesn't seem to work: import { ValidatorConstraintInterface, ValidatorConst