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
type StringToUnion = S extends ${infer L}${infer R} ? L | StringToUnion : S; type PermutationUnion<All extends string, Item extends string = All> = Item extends '' ? '' : Item extends any ? ${Item}${PermutationUnion<Exclude<All, Item>>} : never; type PermutationUnion2<All extends string, Item extends string = All> = All extends '' ? '' : Item extends any ? ${Item}${PermutationUnion2<Exclude<All, Item>>} : never;
${infer L}${infer R}
${Item}${PermutationUnion<Exclude<All, Item>>}
${Item}${PermutationUnion2<Exclude<All, Item>>}
type A = PermutationUnion<'' | 'a' | 'b'>; type B = PermutationUnion2<'' | 'a' | 'b'>;
A会得到全排列的值,但是B则只会返回空的字符串,PermutationUnion2也只是修改了第一个All为Item。 请问递归中Item始终没有赋值,所以Item永远和All相等,为什么修改第一个判断的来源就会出现结果不同呢
The text was updated successfully, but these errors were encountered:
No branches or pull requests
type StringToUnion
= S extends${infer L}${infer R}
? L | StringToUnion : S;type PermutationUnion<All extends string, Item extends string = All> = Item extends ''
? ''
: Item extends any
?
${Item}${PermutationUnion<Exclude<All, Item>>}
: never;
type PermutationUnion2<All extends string, Item extends string = All> = All extends ''
? ''
: Item extends any
?
${Item}${PermutationUnion2<Exclude<All, Item>>}
: never;
type A = PermutationUnion<'' | 'a' | 'b'>;
type B = PermutationUnion2<'' | 'a' | 'b'>;
A会得到全排列的值,但是B则只会返回空的字符串,PermutationUnion2也只是修改了第一个All为Item。
请问递归中Item始终没有赋值,所以Item永远和All相等,为什么修改第一个判断的来源就会出现结果不同呢
The text was updated successfully, but these errors were encountered: