From 3a472370287de229f19b1e3c3195d235a6efd2c9 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Mon, 29 Aug 2022 10:09:29 -0700 Subject: [PATCH] three: Fix ConstructorUnion's distributivity 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](https://github.com/microsoft/TypeScript/pull/50397#issuecomment-1227746792) on the same PR. --- types/three/examples/jsm/nodes/shadernode/ShaderNode.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/types/three/examples/jsm/nodes/shadernode/ShaderNode.d.ts b/types/three/examples/jsm/nodes/shadernode/ShaderNode.d.ts index 900a3b3e568bf4..08b9779f780ae0 100644 --- a/types/three/examples/jsm/nodes/shadernode/ShaderNode.d.ts +++ b/types/three/examples/jsm/nodes/shadernode/ShaderNode.d.ts @@ -82,10 +82,10 @@ type FilterConstructorsByScope = { * "flattens" the tuple into an union type */ type ConstructorUnion = - | (T['a'] extends undefined ? never : T['a']) - | (T['b'] extends undefined ? never : T['b']) - | (T['c'] extends undefined ? never : T['c']) - | (T['d'] extends undefined ? never : T['d']); + | Exclude + | Exclude + | Exclude + | Exclude; /** * Extract list of possible scopes - union of the first paramter