This works, but I'm sure there's a nicer way of doing this, I'm using zod for schema validation on values i have zero control over from the user. I ...
This works, but I'm sure there's a nicer way of doing this, I'm using zod for schema validation on values i have zero control over from the user. I ...
I have a function that may take a parameter in the form of a callable like this: type Initial<T> = T | PromiseLike<T> | (() => T) | (( ...
In this example, I'm using a parameter type (keyof TFoo)[] to expect an array that includes any keys from TFoo, to keep the example simple, but I'm se ...
Introduction (Apologies if the title is confusing, but I explain the question better here!) I'm building a networking library that can perform JSON ...
In Scala 2, you can of course use use wildcard or existential types as type arguments. However, this means that you do not always have a name for a ty ...
I would like to figure out if there is a way of applying a map to a type predicate to be able to replace the repeated calls (one for each variable) in ...
In our app we have an enum defined that covers all the back end endpoints that can be hit by the app... These get translated into the individual en ...
This must be a very basic misunderstanding on my part. It appears that assignments of parametric types are covariant without any indication on my part ...
I fail to understand, why the following compiles: but this doesn't: Am I correctly assuming that in the first case, the type of it is inferred v ...
I'm trying to access object[property], and TypeScript is throwing the element implicitly has any type error. If we don't know whether property in o ...
We can return struct literal from a function by casting anonymous literal initializer to the return type: Is it possible without mentioning struct ...
I have this basic layers object, and I want to add things to each layer later. Here is how I add things to each layer: This causes 2 expected er ...
On the TypeScript official documentation, type MyReturnType<T extends (...args: any) => any> = T extends ( ...args: any ) => infer R ...
I try to borrow from a RefCell: and it works but this one doesn't: and the error message doesn't help: error[E0283]: type annotations needed fo ...
What I'm trying to do is to define a type like so where the two used anys are the same. So the Component Prop Type passed to component should be th ...
I'm trying to do something I think should be pretty simple, but I'm running into trouble with Swift's type inference. I really don't understand why it ...
I have a higher order function, createHandler, that takes rest arguments in the form of a variadic mapped tuple, mapping them to a generic object type ...
def test[T: ClassTag]: T = { println(classTag[T]) null.asInstanceOf[T] } val x1: Int = test val x2: Int = test[Int] prints I would expect the ...
Consider This is an error in TypeScript 4.9, namely Argument of type boolean is not assignable to parameter of type bigint So clearly TS has ...
type Foo struct { a string b int } type Bar[K Foo|string] struct { c K d string } func someRandomFunc (x []Bar[Foo], y [ ...