Category "typescript"

Typescript 4.6 and Arrow Functions

We recently updated to typescript 4.6 (from 4.5) and are experiencing some weird this issues. for example we previously had a function defined at #handleUnsaved

node_modules/@types/react/index"' has no default export

Trying to convert a React app over into Typescript and running into strange errors. node_modules/@types/react/index"' has no default export. node_modules/@type

Get Visual Studio 2022 'Go to' to exclude node_modules

When using the 'Go to' feature in VS 2022 (ctrl + ,) how can I get VS to ignore the node_modules folder. Note that the node_modules folder is already marked as

NestJS cookie-parser is not a function error during e2e test

I have tried to add cookie-parser - https://www.npmjs.com/package/cookie-parser to my NestJS app: import * as cookieParser from 'cookie-parser'; consumer .appl

How to read position x of Shape Object when during tween

I have the Circle object that extends shape and am trying to get the value of x or position of the object in 2d plane. During animation (tween) the position doe

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