Category "typescript-typings"

How to make some fields in object required

I need an interface for making some fields of other interface as required. For example: I have IUserInterface: interface IUser { name: string; role?: str

function declaration for a generic function return wrapper

How to declare the function wraps that takes any function and returns a version of it that differs only in returning an object that wraps the original return ty

Typescript input onchange event.target.value

In my react and typescript app, I use: onChange={(e) => data.motto = (e.target as any).value} How do I correctly define the typings for the class, so I woul

TypeScript typings give me "index.d.ts is not a module"

I am getting File node_modules/@types/webrtc/index.d.ts is not a module with this code: import * as webrtc from "webrtc"; const peerConnection1 = new RTCPeerCo

How to override a property to be non-nullable in Typescript

The DefinitelyTyped definition of the Node built-in IncomingMessage (the type of req in the (req, res, next) arguments) has defined url to be nullable. Here's t

error TS2306: '...index.d.ts' is not a module

I'm trying to write a lib in Typescript that I want to use in various other typescript or JS projects. All of the those other projects run in browsers. My Type

.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

NPM package cannot be used as a JSX Component - Type errors

Ive been getting these strange type errors on my typescript project for certain packages. Ex: 'TimeAgo' cannot be used as a JSX component. Its instance type '

How to update an older version of a type

I have a project that runs AngularJS 1.5.x, and it uses type declarations from DefinitelyTyped: @types/[email protected]. This is the last 1.5.x version, and it wa