Category "typescript"

.filter() does not affect type of array in TypeScript?

check this snippet: interface Foo { id: string; } const fooFunc = (arr: Foo[]): Foo[] => arr .map((item: Foo): Foo | null => { const so

How to run event loop when doing nested/recursive computations?

The usual examples of how to break a computation and release using setTimeout() seem to rely on having a shallow (1-deep) call stack. But what about when you ar

tsc not found in typescript express and react app when deploying to heroku

I am working on an express app(in typescript) and a react app bootstrapped with create-react-app(in js). The directory structure is here. The server directory c

HTTPClient POST tries to parse a non-JSON response

I'm trying to make a request in Angular and I know that the HTTP response will not be in JSON but in text. However, Angular seems to be expecting a JSON respons

Type 'ListRenderItem<IPhotos>' is not assignable to type 'ListRenderItem<unknown>

why I get this error: Type 'ListRenderItem<IPhotos>' is not assignable to type 'ListRenderItem<unknown> Code: import { Dimensions, Image, ListRend

Extend Express Request object using Typescript

I’m trying to add a property to express request object from a middleware using typescript. However I can’t figure out how to add extra properties to

How do I extend the color palette from mui with Typescript

I'm trying to extend the color palette that mui provides. The overriding of primary, secondary etc colors works well but if I want to create a custom set of col

Custom React Hook typescript error on array return type

I've created a very simple custom hook: export function useI18n() : [ string, Dispatch<SetStateAction<string>> ] { const [ language, setLanguage

Angular 13: Namespace '"/node_modules/firebase/compat/index"' has no exported member 'User'. ts(2694)

1st error: Namespace '"D:/desktop/Programming/oauthAngular/node_modules/firebase/compat/index"' has no exported member 'User'. 2nd error: Type 'import("D:/desk

Custom React Hook typescript error on array return type

I've created a very simple custom hook: export function useI18n() : [ string, Dispatch<SetStateAction<string>> ] { const [ language, setLanguage

Material table datasource filter with column value

How can I filter the material data table with specific column ? public dataSource; this.dataSource = new MatTableDataSource(this.items); this.dataSo

Angular Can't bind to 'ngModel' With FormsModule already imported

Note : I'm not a front end dev, even if I do a bit of it. If anything you see can be improved, do not hesitate to share ;) Strange behavior here, I can't find o

Rollup preserveModulesRoot not working as expected

I feel like the preserveModulesRoot option while using preserveModules does not work as it should. Let's say I have a src/index.ts and a bunch of src/components

Invalid hooks call. Hooks can only be called inside of the body of a function component

Please have a look at the validate method inside the elfe-if condition in the below code. I am unable to call the useLocation method of react-router-dom. I have

Property Type Does Not Exist - MongoDB WithId<Document>

Using: ts-node: 10.7.0 MongoDB: 4.4.1 GraphQL: 16.3 I am trying to get a response back from a mongo db request. The request is successfully coming back, but typ

tslint says calls to console.log are not allowed - How do I allow this?

I just started using create-react-app with typescript create-react-app my-app --scripts-version=react-scripts-ts and the default tslint.json configuration d

Is there a way to "extract" the type of TypeScript interface property?

Let's suppose there's a typing file for library X which includes some interfaces. interface I1 { x: any; } interface I2 { y: { a: I1,

How to tell typescript, that process is not undefined?

In the following line of code: internalWhiteList = process.env.INTERNAL_IP_WHITELIST.split( ',' ) I get an error saying, Object is possibly undefined. env va

Is it possible to restrict TypeScript object to contain only properties defined by its class?

Here is my code async getAll(): Promise<GetAllUserData[]> { return await dbQuery(); // dbQuery returns User[] } class User { id: number; name

Local server won't start TS-Error Container TS2345 NodeJS?

I'm trying to run a test project on the server. Gives an error message ~/www/ork-wiki-admin-back-test $ npm run test-start > [email protected] test-