I'm looking for ways to define an empty object type that can't hold any values. type EmptyObject = {} const MyObject: EmptyObject = { thisShouldNotWork: {},
We use as const to narrow the types: [ {foo: 'foo' }, { bar: 'bar' } ] as const but this also adds readonly modifiers for all props and values. As of const thi
I need an interface for making some fields of other interface as required. For example: I have IUserInterface: interface IUser { name: string; role?: str
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
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
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
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
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
check this snippet: interface Foo { id: string; } const fooFunc = (arr: Foo[]): Foo[] => arr .map((item: Foo): Foo | null => { const so
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 '
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