Skip to content

Commit

Permalink
feat(question): add type-challenges#8767 - Permuatation & Combination (
Browse files Browse the repository at this point in the history
…type-challenges#8768)

Co-authored-by: Homyee King <[email protected]>
  • Loading branch information
github-actions[bot] and HomyeeKing authored Apr 16, 2022
1 parent 1fb6132 commit 72fa484
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
7 changes: 7 additions & 0 deletions questions/8767-meduim-permuatation-and-combination/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Give an array of strings, then do Permutation & Combination.
It's also useful for the prop types like video [controlsList](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/controlsList)

```ts
// expected to be `"foo" | "bar" | "baz" | "foo bar baz" | "bar foo" | "baz foo" | "bar baz" | "baz bar"`
type Keys = PermutationCombination<['foo', 'bar', 'baz']>
```
7 changes: 7 additions & 0 deletions questions/8767-meduim-permuatation-and-combination/info.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
difficulty: meduim
title: Permuatation & Combination
tags: array, application, string
author:
github: HomyeeKing
name: Homyee King

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
type PermutationCombination<T extends string[]> = any
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { Equal, Expect } from '@type-challenges/utils'

type cases = [
Expect<Equal<PermutationCombination<['foo', 'bar', 'baz']>,
'foo' | 'bar' | 'baz' | 'foo bar baz' | 'bar foo' | 'baz foo' | 'bar baz' | 'baz bar'>>,
]

0 comments on commit 72fa484

Please sign in to comment.