-
-
Notifications
You must be signed in to change notification settings - Fork 151
New issue
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
[shader-ast] Exhaustive types for swizzle #438
base: develop
Are you sure you want to change the base?
Conversation
Thank you for this PR (and the other one too) - I've actually used template literal types for swizzles, but then have been consciously avoiding them after discovering they're causing very bad auto-complete performance (IDE freezes/hangs), especially if there're multiple types with hundreds or thousands of shared possibilities. Also language server RAM usage seems to blow up when using those template types. Maybe something has changed/improved in recent TS versions, but this will require further user testing (and bandwidth to do so). For now I'm happy to accept a PR for the rgba aliases, but only using non-templated versions... |
// prettier-ignore | ||
type SwizzleXYZW_3 = "xxx" | "xxy" | "xxz" | "xxw" | "xyx" | "xyy" | "xyz" | "xyw" | "xzx" | "xzy" | "xzz" | "xzw" | "xwx" | "xwy" | "xwz" | "xww" | "yxx" | "yxy" | "yxz" | "yxw" | "yyx" | "yyy" | "yyz" | "yyw" | "yzx" | "yzy" | "yzz" | "yzw" | "ywx" | "ywy" | "ywz" | "yww" | "zxx" | "zxy" | "zxz" | "zxw" | "zyx" | "zyy" | "zyz" | "zyw" | "zzx" | "zzy" | "zzz" | "zzw" | "zwx" | "zwy" | "zwz" | "zww" | "wxx" | "wxy" | "wxz" | "wxw" | "wyx" | "wyy" | "wyz" | "wyw" | "wzx" | "wzy" | "wzz" | "wzw" | "wwx" | "wwy" | "wwz" | "www"; | ||
// prettier-ignore | ||
type SwizzleXYZW_4 = "xxxx" | "xxxy" | "xxxz" | "xxxw" | "xxyx" | "xxyy" | "xxyz" | "xxyw" | "xxzx" | "xxzy" | "xxzz" | "xxzw" | "xxwx" | "xxwy" | "xxwz" | "xxww" | "xyxx" | "xyxy" | "xyxz" | "xyxw" | "xyyx" | "xyyy" | "xyyz" | "xyyw" | "xyzx" | "xyzy" | "xyzz" | "xyzw" | "xywx" | "xywy" | "xywz" | "xyww" | "xzxx" | "xzxy" | "xzxz" | "xzxw" | "xzyx" | "xzyy" | "xzyz" | "xzyw" | "xzzx" | "xzzy" | "xzzz" | "xzzw" | "xzwx" | "xzwy" | "xzwz" | "xzww" | "xwxx" | "xwxy" | "xwxz" | "xwxw" | "xwyx" | "xwyy" | "xwyz" | "xwyw" | "xwzx" | "xwzy" | "xwzz" | "xwzw" | "xwwx" | "xwwy" | "xwwz" | "xwww" | "yxxx" | "yxxy" | "yxxz" | "yxxw" | "yxyx" | "yxyy" | "yxyz" | "yxyw" | "yxzx" | "yxzy" | "yxzz" | "yxzw" | "yxwx" | "yxwy" | "yxwz" | "yxww" | "yyxx" | "yyxy" | "yyxz" | "yyxw" | "yyyx" | "yyyy" | "yyyz" | "yyyw" | "yyzx" | "yyzy" | "yyzz" | "yyzw" | "yywx" | "yywy" | "yywz" | "yyww" | "yzxx" | "yzxy" | "yzxz" | "yzxw" | "yzyx" | "yzyy" | "yzyz" | "yzyw" | "yzzx" | "yzzy" | "yzzz" | "yzzw" | "yzwx" | "yzwy" | "yzwz" | "yzww" | "ywxx" | "ywxy" | "ywxz" | "ywxw" | "ywyx" | "ywyy" | "ywyz" | "ywyw" | "ywzx" | "ywzy" | "ywzz" | "ywzw" | "ywwx" | "ywwy" | "ywwz" | "ywww" | "zxxx" | "zxxy" | "zxxz" | "zxxw" | "zxyx" | "zxyy" | "zxyz" | "zxyw" | "zxzx" | "zxzy" | "zxzz" | "zxzw" | "zxwx" | "zxwy" | "zxwz" | "zxww" | "zyxx" | "zyxy" | "zyxz" | "zyxw" | "zyyx" | "zyyy" | "zyyz" | "zyyw" | "zyzx" | "zyzy" | "zyzz" | "zyzw" | "zywx" | "zywy" | "zywz" | "zyww" | "zzxx" | "zzxy" | "zzxz" | "zzxw" | "zzyx" | "zzyy" | "zzyz" | "zzyw" | "zzzx" | "zzzy" | "zzzz" | "zzzw" | "zzwx" | "zzwy" | "zzwz" | "zzww" | "zwxx" | "zwxy" | "zwxz" | "zwxw" | "zwyx" | "zwyy" | "zwyz" | "zwyw" | "zwzx" | "zwzy" | "zwzz" | "zwzw" | "zwwx" | "zwwy" | "zwwz" | "zwww" | "wxxx" | "wxxy" | "wxxz" | "wxxw" | "wxyx" | "wxyy" | "wxyz" | "wxyw" | "wxzx" | "wxzy" | "wxzz" | "wxzw" | "wxwx" | "wxwy" | "wxwz" | "wxww" | "wyxx" | "wyxy" | "wyxz" | "wyxw" | "wyyx" | "wyyy" | "wyyz" | "wyyw" | "wyzx" | "wyzy" | "wyzz" | "wyzw" | "wywx" | "wywy" | "wywz" | "wyww" | "wzxx" | "wzxy" | "wzxz" | "wzxw" | "wzyx" | "wzyy" | "wzyz" | "wzyw" | "wzzx" | "wzzy" | "wzzz" | "wzzw" | "wzwx" | "wzwy" | "wzwz" | "wzww" | "wwxx" | "wwxy" | "wwxz" | "wwxw" | "wwyx" | "wwyy" | "wwyz" | "wwyw" | "wwzx" | "wwzy" | "wwzz" | "wwzw" | "wwwx" | "wwwy" | "wwwz" | "wwww"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar blocks of code found in 2 locations. Consider refactoring.
// prettier-ignore | ||
type SwizzleRGBA_3 = "rrr" | "rrg" | "rrb" | "rra" | "rgr" | "rgg" | "rgb" | "rga" | "rbr" | "rbg" | "rbb" | "rba" | "rar" | "rag" | "rab" | "raa" | "grr" | "grg" | "grb" | "gra" | "ggr" | "ggg" | "ggb" | "gga" | "gbr" | "gbg" | "gbb" | "gba" | "gar" | "gag" | "gab" | "gaa" | "brr" | "brg" | "brb" | "bra" | "bgr" | "bgg" | "bgb" | "bga" | "bbr" | "bbg" | "bbb" | "bba" | "bar" | "bag" | "bab" | "baa" | "arr" | "arg" | "arb" | "ara" | "agr" | "agg" | "agb" | "aga" | "abr" | "abg" | "abb" | "aba" | "aar" | "aag" | "aab" | "aaa"; | ||
// prettier-ignore | ||
type SwizzleRGBA_4 = "rrrr" | "rrrg" | "rrrb" | "rrra" | "rrgr" | "rrgg" | "rrgb" | "rrga" | "rrbr" | "rrbg" | "rrbb" | "rrba" | "rrar" | "rrag" | "rrab" | "rraa" | "rgrr" | "rgrg" | "rgrb" | "rgra" | "rggr" | "rggg" | "rggb" | "rgga" | "rgbr" | "rgbg" | "rgbb" | "rgba" | "rgar" | "rgag" | "rgab" | "rgaa" | "rbrr" | "rbrg" | "rbrb" | "rbra" | "rbgr" | "rbgg" | "rbgb" | "rbga" | "rbbr" | "rbbg" | "rbbb" | "rbba" | "rbar" | "rbag" | "rbab" | "rbaa" | "rarr" | "rarg" | "rarb" | "rara" | "ragr" | "ragg" | "ragb" | "raga" | "rabr" | "rabg" | "rabb" | "raba" | "raar" | "raag" | "raab" | "raaa" | "grrr" | "grrg" | "grrb" | "grra" | "grgr" | "grgg" | "grgb" | "grga" | "grbr" | "grbg" | "grbb" | "grba" | "grar" | "grag" | "grab" | "graa" | "ggrr" | "ggrg" | "ggrb" | "ggra" | "gggr" | "gggg" | "gggb" | "ggga" | "ggbr" | "ggbg" | "ggbb" | "ggba" | "ggar" | "ggag" | "ggab" | "ggaa" | "gbrr" | "gbrg" | "gbrb" | "gbra" | "gbgr" | "gbgg" | "gbgb" | "gbga" | "gbbr" | "gbbg" | "gbbb" | "gbba" | "gbar" | "gbag" | "gbab" | "gbaa" | "garr" | "garg" | "garb" | "gara" | "gagr" | "gagg" | "gagb" | "gaga" | "gabr" | "gabg" | "gabb" | "gaba" | "gaar" | "gaag" | "gaab" | "gaaa" | "brrr" | "brrg" | "brrb" | "brra" | "brgr" | "brgg" | "brgb" | "brga" | "brbr" | "brbg" | "brbb" | "brba" | "brar" | "brag" | "brab" | "braa" | "bgrr" | "bgrg" | "bgrb" | "bgra" | "bggr" | "bggg" | "bggb" | "bgga" | "bgbr" | "bgbg" | "bgbb" | "bgba" | "bgar" | "bgag" | "bgab" | "bgaa" | "bbrr" | "bbrg" | "bbrb" | "bbra" | "bbgr" | "bbgg" | "bbgb" | "bbga" | "bbbr" | "bbbg" | "bbbb" | "bbba" | "bbar" | "bbag" | "bbab" | "bbaa" | "barr" | "barg" | "barb" | "bara" | "bagr" | "bagg" | "bagb" | "baga" | "babr" | "babg" | "babb" | "baba" | "baar" | "baag" | "baab" | "baaa" | "arrr" | "arrg" | "arrb" | "arra" | "argr" | "argg" | "argb" | "arga" | "arbr" | "arbg" | "arbb" | "arba" | "arar" | "arag" | "arab" | "araa" | "agrr" | "agrg" | "agrb" | "agra" | "aggr" | "aggg" | "aggb" | "agga" | "agbr" | "agbg" | "agbb" | "agba" | "agar" | "agag" | "agab" | "agaa" | "abrr" | "abrg" | "abrb" | "abra" | "abgr" | "abgg" | "abgb" | "abga" | "abbr" | "abbg" | "abbb" | "abba" | "abar" | "abag" | "abab" | "abaa" | "aarr" | "aarg" | "aarb" | "aara" | "aagr" | "aagg" | "aagb" | "aaga" | "aabr" | "aabg" | "aabb" | "aaba" | "aaar" | "aaag" | "aaab" | "aaaa"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar blocks of code found in 2 locations. Consider refactoring.
// prettier-ignore | ||
type SwizzleXYZ_3 = "xxx" | "xxy" | "xxz" | "xyx" | "xyy" | "xyz" | "xzx" | "xzy" | "xzz" | "yxx" | "yxy" | "yxz" | "yyx" | "yyy" | "yyz" | "yzx" | "yzy" | "yzz" | "zxx" | "zxy" | "zxz" | "zyx" | "zyy" | "zyz" | "zzx" | "zzy" | "zzz"; | ||
// prettier-ignore | ||
type SwizzleXYZ_4 = "xxxx" | "xxxy" | "xxxz" | "xxyx" | "xxyy" | "xxyz" | "xxzx" | "xxzy" | "xxzz" | "xyxx" | "xyxy" | "xyxz" | "xyyx" | "xyyy" | "xyyz" | "xyzx" | "xyzy" | "xyzz" | "xzxx" | "xzxy" | "xzxz" | "xzyx" | "xzyy" | "xzyz" | "xzzx" | "xzzy" | "xzzz" | "yxxx" | "yxxy" | "yxxz" | "yxyx" | "yxyy" | "yxyz" | "yxzx" | "yxzy" | "yxzz" | "yyxx" | "yyxy" | "yyxz" | "yyyx" | "yyyy" | "yyyz" | "yyzx" | "yyzy" | "yyzz" | "yzxx" | "yzxy" | "yzxz" | "yzyx" | "yzyy" | "yzyz" | "yzzx" | "yzzy" | "yzzz" | "zxxx" | "zxxy" | "zxxz" | "zxyx" | "zxyy" | "zxyz" | "zxzx" | "zxzy" | "zxzz" | "zyxx" | "zyxy" | "zyxz" | "zyyx" | "zyyy" | "zyyz" | "zyzx" | "zyzy" | "zyzz" | "zzxx" | "zzxy" | "zzxz" | "zzyx" | "zzyy" | "zzyz" | "zzzx" | "zzzy" | "zzzz"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar blocks of code found in 3 locations. Consider refactoring.
// prettier-ignore | ||
export type Swizzle4_2 = "xx" | "xy" | "xz" | "xw" | "yx" | "yy" | "yz" | "yw" | "zx" | "zy" | "zz" | "zw" | "wx" | "wy" | "wz" | "ww"; | ||
type SwizzleRGB_4 = "rrrr" | "rrrg" | "rrrb" | "rrgr" | "rrgg" | "rrgb" | "rrbr" | "rrbg" | "rrbb" | "rgrr" | "rgrg" | "rgrb" | "rggr" | "rggg" | "rggb" | "rgbr" | "rgbg" | "rgbb" | "rbrr" | "rbrg" | "rbrb" | "rbgr" | "rbgg" | "rbgb" | "rbbr" | "rbbg" | "rbbb" | "grrr" | "grrg" | "grrb" | "grgr" | "grgg" | "grgb" | "grbr" | "grbg" | "grbb" | "ggrr" | "ggrg" | "ggrb" | "gggr" | "gggg" | "gggb" | "ggbr" | "ggbg" | "ggbb" | "gbrr" | "gbrg" | "gbrb" | "gbgr" | "gbgg" | "gbgb" | "gbbr" | "gbbg" | "gbbb" | "brrr" | "brrg" | "brrb" | "brgr" | "brgg" | "brgb" | "brbr" | "brbg" | "brbb" | "bgrr" | "bgrg" | "bgrb" | "bggr" | "bggg" | "bggb" | "bgbr" | "bgbg" | "bgbb" | "bbrr" | "bbrg" | "bbrb" | "bbgr" | "bbgg" | "bbgb" | "bbbr" | "bbbg" | "bbbb"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar blocks of code found in 3 locations. Consider refactoring.
// prettier-ignore | ||
type SwizzleSTP_3 = "sss" | "sst" | "ssp" | "sts" | "stt" | "stp" | "sps" | "spt" | "spp" | "tss" | "tst" | "tsp" | "tts" | "ttt" | "ttp" | "tps" | "tpt" | "tpp" | "pss" | "pst" | "psp" | "pts" | "ptt" | "ptp" | "pps" | "ppt" | "ppp"; | ||
// prettier-ignore | ||
type SwizzleSTP_4 = "ssss" | "ssst" | "sssp" | "ssts" | "sstt" | "sstp" | "ssps" | "sspt" | "sspp" | "stss" | "stst" | "stsp" | "stts" | "sttt" | "sttp" | "stps" | "stpt" | "stpp" | "spss" | "spst" | "spsp" | "spts" | "sptt" | "sptp" | "spps" | "sppt" | "sppp" | "tsss" | "tsst" | "tssp" | "tsts" | "tstt" | "tstp" | "tsps" | "tspt" | "tspp" | "ttss" | "ttst" | "ttsp" | "ttts" | "tttt" | "tttp" | "ttps" | "ttpt" | "ttpp" | "tpss" | "tpst" | "tpsp" | "tpts" | "tptt" | "tptp" | "tpps" | "tppt" | "tppp" | "psss" | "psst" | "pssp" | "psts" | "pstt" | "pstp" | "psps" | "pspt" | "pspp" | "ptss" | "ptst" | "ptsp" | "ptts" | "pttt" | "pttp" | "ptps" | "ptpt" | "ptpp" | "ppss" | "ppst" | "ppsp" | "ppts" | "pptt" | "pptp" | "ppps" | "pppt" | "pppp"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar blocks of code found in 3 locations. Consider refactoring.
I have a suggestion that like here that we can keep the template literals in other places to verify the shipped types, which can be useful. |
Thank you for these updates, I will take a closer look at this in the next few days. I'm sorry you feel this is a "stupid" demand to not use template literals here. As I said earlier, I'm not totally opposed to them, just want to err on the side of caution due to very bad previous experience with them (IMHO they don't seem to be intended for cases with hundreds or more of variations each). Just need to do more testing (in situ, on existing projects and with recent TS versions)... FWIW Here's the full code generator for the swizzle types, now updated to include your proposed new variations. These types are based on the cartesian product (aka import { writeText } from "@thi.ng/file-io";
import { ConsoleLogger } from "@thi.ng/logger";
import { upper } from "@thi.ng/strings";
import {
map,
permutations,
range2d,
repeat,
str,
transduce,
} from "@thi.ng/transducers";
const variations = ["xyzw", "rgba", "stpq"];
const types: string[][] = [];
const body = [`// generated by /tools/swizzle-gen.ts - DO NOT EDIT!\n`];
for (let syms of variations) {
// iterate over target & source vector sizes
for (let [src, dest] of range2d(2, 5, 1, 5)) {
const type = `Swizzle${upper(syms)}_${src}_${dest}`;
const swizzles = transduce(
map((x) => `"${str("", x)}"`),
str(" | "),
permutations(...repeat(syms.substring(0, src), dest))
);
body.push(`// prettier-ignore`, `export type ${type} = ${swizzles};`);
if (!types[src]) types[src] = [];
types[src].push(type);
}
}
for (let i = 2; i < 5; i++) {
body.push(
`// prettier-ignore`,
`export type Swizzle${i} = ${str(" | ", types[i])};`
);
}
// write results to source file
writeText("src/api/swizzles.ts", body, new ConsoleLogger("swizzlegen")); The codegen is supposed to be run from the shader-ast pkg root, e.g.: (cd packages/shader-ast && bun tools/swizzle-gen.ts) Also, another thing to bear in mind here is that this proposed change will also require some updates to the swizzle implementations in the shader-ast-js package |
// prettier-ignore | ||
type SwizzleXYZW_2 = "xx" | "xy" | "xz" | "xw" | "yx" | "yy" | "yz" | "yw" | "zx" | "zy" | "zz" | "zw" | "wx" | "wy" | "wz" | "ww"; | ||
// prettier-ignore | ||
type SwizzleXYZW_3 = "xxx" | "xxy" | "xxz" | "xxw" | "xyx" | "xyy" | "xyz" | "xyw" | "xzx" | "xzy" | "xzz" | "xzw" | "xwx" | "xwy" | "xwz" | "xww" | "yxx" | "yxy" | "yxz" | "yxw" | "yyx" | "yyy" | "yyz" | "yyw" | "yzx" | "yzy" | "yzz" | "yzw" | "ywx" | "ywy" | "ywz" | "yww" | "zxx" | "zxy" | "zxz" | "zxw" | "zyx" | "zyy" | "zyz" | "zyw" | "zzx" | "zzy" | "zzz" | "zzw" | "zwx" | "zwy" | "zwz" | "zww" | "wxx" | "wxy" | "wxz" | "wxw" | "wyx" | "wyy" | "wyz" | "wyw" | "wzx" | "wzy" | "wzz" | "wzw" | "wwx" | "wwy" | "wwz" | "www"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar blocks of code found in 3 locations. Consider refactoring.
// prettier-ignore | ||
type SwizzleRGBA_2 = "rr" | "rg" | "rb" | "ra" | "gr" | "gg" | "gb" | "ga" | "br" | "bg" | "bb" | "ba" | "ar" | "ag" | "ab" | "aa"; | ||
// prettier-ignore | ||
type SwizzleRGBA_3 = "rrr" | "rrg" | "rrb" | "rra" | "rgr" | "rgg" | "rgb" | "rga" | "rbr" | "rbg" | "rbb" | "rba" | "rar" | "rag" | "rab" | "raa" | "grr" | "grg" | "grb" | "gra" | "ggr" | "ggg" | "ggb" | "gga" | "gbr" | "gbg" | "gbb" | "gba" | "gar" | "gag" | "gab" | "gaa" | "brr" | "brg" | "brb" | "bra" | "bgr" | "bgg" | "bgb" | "bga" | "bbr" | "bbg" | "bbb" | "bba" | "bar" | "bag" | "bab" | "baa" | "arr" | "arg" | "arb" | "ara" | "agr" | "agg" | "agb" | "aga" | "abr" | "abg" | "abb" | "aba" | "aar" | "aag" | "aab" | "aaa"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar blocks of code found in 3 locations. Consider refactoring.
// prettier-ignore | ||
type SwizzleSTPQ_2 = "ss" | "st" | "sp" | "sq" | "ts" | "tt" | "tp" | "tq" | "ps" | "pt" | "pp" | "pq" | "qs" | "qt" | "qp" | "qq"; | ||
// prettier-ignore | ||
type SwizzleSTPQ_3 = "sss" | "sst" | "ssp" | "ssq" | "sts" | "stt" | "stp" | "stq" | "sps" | "spt" | "spp" | "spq" | "sqs" | "sqt" | "sqp" | "sqq" | "tss" | "tst" | "tsp" | "tsq" | "tts" | "ttt" | "ttp" | "ttq" | "tps" | "tpt" | "tpp" | "tpq" | "tqs" | "tqt" | "tqp" | "tqq" | "pss" | "pst" | "psp" | "psq" | "pts" | "ptt" | "ptp" | "ptq" | "pps" | "ppt" | "ppp" | "ppq" | "pqs" | "pqt" | "pqp" | "pqq" | "qss" | "qst" | "qsp" | "qsq" | "qts" | "qtt" | "qtp" | "qtq" | "qps" | "qpt" | "qpp" | "qpq" | "qqs" | "qqt" | "qqp" | "qqq"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar blocks of code found in 3 locations. Consider refactoring.
// prettier-ignore | ||
export type Swizzle3_3 = "xxx" | "xxy" | "xxz" | "xyx" | "xyy" | "xyz" | "xzx" | "xzy" | "xzz" | "yxx" | "yxy" | "yxz" | "yyx" | "yyy" | "yyz" | "yzx" | "yzy" | "yzz" | "zxx" | "zxy" | "zxz" | "zyx" | "zyy" | "zyz" | "zzx" | "zzy" | "zzz"; | ||
type SwizzleXY_4 = "xxxx" | "xxxy" | "xxyx" | "xxyy" | "xyxx" | "xyxy" | "xyyx" | "xyyy" | "yxxx" | "yxxy" | "yxyx" | "yxyy" | "yyxx" | "yyxy" | "yyyx" | "yyyy"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar blocks of code found in 6 locations. Consider refactoring.
// prettier-ignore | ||
type SwizzleRG_3 = "rrr" | "rrg" | "rgr" | "rgg" | "grr" | "grg" | "ggr" | "ggg"; | ||
// prettier-ignore | ||
type SwizzleRG_4 = "rrrr" | "rrrg" | "rrgr" | "rrgg" | "rgrr" | "rgrg" | "rggr" | "rggg" | "grrr" | "grrg" | "grgr" | "grgg" | "ggrr" | "ggrg" | "gggr" | "gggg"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar blocks of code found in 6 locations. Consider refactoring.
I assume that the place to change code to implement swizzle, could be Also, I want to see if tests could be implemented for js target. |
I think that
r, g, b, a
ors, t, p, q
swizzles are missing from the type definition, which can be useful.It is also possible to use template literal types to exhaustively list all the combinations of swizzles.