Stevenaces

Results 8 comments of Stevenaces

If you have some question about `PromiseLike` type, you can see [PromiseLike](https://microsoft.github.io/PowerBI-JavaScript/interfaces/_node_modules_typedoc_node_modules_typescript_lib_lib_es5_d_.promiselike.html) reference.

```ts type Pop = T extends [] ? [] : T extends [...infer R, infer L] ? R : never; ```

What a clever answer!

Now arrays not only include string, but also numeric types: ```typescript type TupleToObject = { [P in T[number]]: P } ```

> anybody can tell me why this doesn't work. > > ```ts > type LookUp = U['type'] extends T ? U : never > ``` May you need write as...

Now, the above solution can't pass the follow case: `Expect` My answer is as folllows, which hash a bit different from above: ```ts type RemoveUndefined = [T] extends [undefined] ?...

```ts type IndexOf = U extends T[number] ? T extends [infer F, ...infer R] ? Equal extends true ? Count['length'] : IndexOf : -1 : -1 ```

```ts type PickByType = { [K in keyof T as T[K] extends U ? K : never]: U } ```