We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Maybe this means splitting up defining the methods + defining the types, e.g.:
// Types type VecElement = 'x' | 'y' | 'z' | 'w' | 'r' | 'g' | 'b' | 'a' | 'u' | 'v' type Vec2Swizzle = `${VecElement}${VecElement}` type Vec3Swizzle = `${Vec2Swizzle}${VecElement}` type Vec4Swizzle = `${Vec3Swizzle}${VecElement}` type Swizzled = & { [vec2Key in Vec2Swizzle]: () => VectorOp } & { [vec3Key in Vec3Swizzle]: () => VectorOp } & { [vec4Key in Vec4Swizzle]: () => VectorOp } interface VectorOp extends Swizzled {} // Methods const elements = ['x', 'y', 'z', 'w', 'r', 'g', 'b', 'a', 'u', 'v'] const swizzles = [ ...combinations(elements, elements), // vec2 swizzles ...combinations(elements, elements, elements), // vec3 swizzles ...combinations(elements, elements, elements, elements), // vec4 swizzles ] for (const swizzle of swizzles) { this[swizzle.join('')] = function() { // TODO } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Maybe this means splitting up defining the methods + defining the types, e.g.:
The text was updated successfully, but these errors were encountered: