Skip to content

Commit 34ce0f9

Browse files
authored
three: Fix ConstructorUnion's distributivity (#62011)
Typescript 4.9 [optimises substitution types](https://github.com/microsoft/TypeScript/pull/50397a), but this exposes that ConstructorUnion isn't correctly distributive. I used the [fix suggested by Anders Hejslberg](microsoft/TypeScript#50397 (comment)) on the same PR.
1 parent c69ad1e commit 34ce0f9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

types/three/examples/jsm/nodes/shadernode/ShaderNode.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,10 @@ type FilterConstructorsByScope<T extends AnyConstructors, S> = {
8282
* "flattens" the tuple into an union type
8383
*/
8484
type ConstructorUnion<T extends AnyConstructors> =
85-
| (T['a'] extends undefined ? never : T['a'])
86-
| (T['b'] extends undefined ? never : T['b'])
87-
| (T['c'] extends undefined ? never : T['c'])
88-
| (T['d'] extends undefined ? never : T['d']);
85+
| Exclude<T['a'], undefined>
86+
| Exclude<T['b'], undefined>
87+
| Exclude<T['c'], undefined>
88+
| Exclude<T['d'], undefined>;
8989

9090
/**
9191
* Extract list of possible scopes - union of the first paramter

0 commit comments

Comments
 (0)