Category "typescript"

Using named parameters JavaScript (based on typescript)

I have problems, when using named parameter in TypeScript, I know it is not supportetd the way I use it in TS. But how can I TypeScript: SomeFunction(name1:

Unable to resolve signature of property decorator when called as an expression

import { isEmail, isEmpty, isPhoneNumber, Length } from "class-validator" import { Field, InputType } from "type-graphql"; @InputType() export class RegisterIn

Could not find a declaration file for module 'react/jsx-runtime'

I am using material-ui in react with typescript template. All of my code is working fine but I am getting this error on multiple lines (not an error warning but

Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema

I have this simple helloworld react app created from an online course, however I get this error: Invalid configuration object. Webpack has been initialised

event.target.value as a number?

const [data, Setdata] = useState<number[] >([]); const [inputData, SetinputData] = useState<number>(0); const [canAdd, SetcanAdd] = useState<boo

useRef TypeScript - not assignable to type LegacyRef<HTMLDivElement>

I am trying to use useRef with TypeScript but am having some trouble. With my RefObject (I assume) I need to access current. (ie node.current) I have tried the

TypeScript: Partially "Partial" type

Environment TypeScript's version is 3.2.1 and "tsconfig.json" is like below. { "compilerOptions": { "target": "es5", "module": "commonjs", "stri

How to forbid replacing process.env variables during compilation in webpack?

Story I'm developing the AWS Lambda functions and compile the code using webpack. I've read some of the articles and it seems that the process.env variables a

Angular 2 - [(ngModel)] not updating after [value] changes

I'm setting the the value of an input calculating two other ngModels, and that seems to be working fine. But if I inspect my ngModel, it doesn't change at all.

TypeScript: Partially "Partial" type

Environment TypeScript's version is 3.2.1 and "tsconfig.json" is like below. { "compilerOptions": { "target": "es5", "module": "commonjs", "stri

How to declare an interface above an angular component?

I have a component with a method that receives values from a form. I would like to describe the form data with an interface. However, at runtime (ng serve), th

Installing WebDriverIO with Typescrit and Cucumber gives me an error

When I finish configuring the project, the wdio.conf.ts and tsconfig.json files are saved in a folder called tests and the wdio.conf.ts file gives me the follow

how to get an object literal properties with ts-morph

I am parsing a file like this using ts-morph const a = {property1: 20, property2: 30} I can't seem to figure out how to get an ObjectLiteralExpression mention

How to use deep-equal (Angular 7)

Auto import by VS Code: import deepEqual = require('deep-equal'); Doesn't work: error TS1202: Import assignment cannot be used when targeting ECMAScrip

How to build VS Code TreeView with custom JSON?

I'd like to build a TreeView based on a JSON file / REST Call and have an icon for each type of my objects. I have only three types of objects: Server, Host and

How to validate request in typeorm controller

I have created a sample application to save data for a user. I wanted to know how to validate it before saving and showing the response in JSON. I have got a re

TypeScript this in interface should reference itself and children, not only itself

There is the example: interface A { method: (itself: this) => string; } interface B extends A { additionalProperty: boolean; } type Extend<T ext

How can I assign a TypeScript type for event payloads for a class like EventEmitter?

I have a class that is just like Node's EventEmitter (it could even be the same class). How do I type it in such a way that I can specify what the callback typ

I'm new to Angular, I'm trying to figure out where I'm wrong

I keep getting this error and I'm not sure what to do?[1] [1]: https://i.stack.imgur.com/mQ3Xo.png

Could not find a declaration file for module 'module-name'. '/path/to/module-name.js' implicitly has an 'any' type

I read how TypeScript module resolution works. I have the following repository: @ts-stack/di. After compiling the directory structure is as follows: ├&#