Category "typescript"

JIT compilation failed for NgModule class

Here i got an Error like JIT Compilation failed and needed to flag some -aot and etc.. stuff

How do I get Intellisense for JavaScript in VS Code to work? (npm installed @types)

I am writing a little web project with p5.js. Basically it is just this right now: <!DOCTYPE html> <html lang="en"> <head> <script src="h

How to rotate material-ui icon

I'm trying to rotate material-ui icon using css property animation but not getting the desired result. Can somebody please help me identify what's going wrong h

Remove certain fields from the mongoose HydratedDocument

When we lean the documents, the id property is still included which is undefined and can cause unexpected errors. To simplify this for my team, I want to remove

How to flush promises since Jest 26+

Jest 26 shipped a new implementation of fake timers based on @sinonjs/fake-timers. Previously I used const flushPromises = () => new Promise(setImmediate); a

Differentiate between different Strings in TypeScript

I have a set of Types which are just strings, ie. type FooId = string type BarId = string const callFoo = (id: FooId) => {} const b: BarId = 'bar' callFoo

TypeScript function that works on all numerical array types

I am trying to write a function that works on all of the JavaScript array types, e.g. on number[], Float32Array etc. It should return the same type that it gets

Typescript inference for unions not picking up the correct type

Apologies for the vagueness, but I can't use the original files for security. I have four types: types.js export type BaseType = { requestType: string; oth

How to use createAsyncThunk with Typescript? How to set types for the `pending` and `rejected` payloads?

Right now I've got these actions that I use for an upload thunk's lifecycle. type UPLOAD_START = PayloadAction<void> type UPLOAD_SUCCESS = PayloadAction

manually copying types to @types/ directory during npm post-install

I would like to distribute a NPM package already containing type declarations which expand the global environment. (think of jest or mocha with a global test fu

Configuring tsconfig.json and eslint for a monorepo using Yarn workspaces

I'm using a Yarn workspace monorepo structure in a TypeScript React project: packages admin package.json user package.json package.json // Workspace

TypeScript/Eslint throwing a 'Promise returned' error on a Express Router async route

I have the following endpoint setup to reset a database after test runs: import { getConnection } from 'typeorm'; import express from 'express'; const router =

.tsx files throw errors while .js files work fine

in react-native, when I try to pass parameters to functions/components/etc, typescript files will always complain and it won't work until I have specified the t

error NG8002: Can't bind to 'dep' since it isn't a known property of 'app-add-edit-dep'

i am very new to Angular and trying to follow an anugular tutorial where he passes an object to app-add-edit-dep component on a modal in show-dep.component.html

Hide nav menu when on login page in ANGULAR

I have a routing module that has a LoginComponent on the login page I want to hide the <app-nav-menu></app-nav-menu> when not logged in. I have trie

how to delete a property from an object in Typescript without the operand of a 'delete' operator must be optional error?

I have tried to read how to delete a property from an object in here: How do I remove a property from a JavaScript object? it should use delete, I try it like t

window.dispatchEvent from test code does not trigger window.addEventListener

I have below listener added for which I am trying to write test using Jest. However, it seems as though the event I'm dispatching doesn't reach my code. window.

What is the difference between Query builder, find and findone in typeorm?

I have used a query in typeorm using query builder as: getManager().CreateQueryBuilder(class_name_from_entity_file, 'xyz').select('column_name').where('active_s

How to extend a .js file with a .ts file

Let's say I have a legacy codebase with a .js file that looks like this: // myFile.js export const returnStuff = () => 'stuff'; Now I want to add functional

HTMLElementWrapper solution for extending prototype -- adding new functions

The problem is quite simple: add two functions to the HTMLElement which is on and off. The on functions works exact same as addEventListener The off functions w