├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE │ ├── 0-answer.md │ ├── 0-bug.md │ ├── 0-discussion.md │ ├── 0-help.md │ ├── 0-new.md │ ├── 1-answer.ja.md │ ├── 1-answer.ko.md │ ├── 1-answer.zh-CN.md │ ├── 1-new.ja.md │ └── 1-new.zh-CN.md └── workflows │ ├── index-update.yaml │ ├── issue-pr.yaml │ ├── labeling.yaml │ └── toggle-pr-with-issue.yaml ├── .gitignore ├── .npmrc ├── .vscode ├── i18n-ally-custom-framework.yml └── settings.json ├── CODE_OF_CONDUCT.md ├── LICENSE ├── README.ja.md ├── README.ko.md ├── README.md ├── README.pt-BR.md ├── README.zh-CN.md ├── TODOs.md ├── eslint.config.js ├── guides ├── infer.md ├── infer.zh-CN.md ├── key-in.md ├── key-in.zh-CN.md ├── recursive.md └── recursive.zh-CN.md ├── package.json ├── pnpm-lock.yaml ├── pnpm-workspace.yaml ├── questions ├── 00002-medium-return-type │ ├── README.ja.md │ ├── README.ko.md │ ├── README.md │ ├── README.pt-BR.md │ ├── README.zh-CN.md │ ├── info.pt-BR.yml │ ├── info.yml │ ├── info.zh-CN.yml │ ├── template.ts │ └── test-cases.ts ├── 00003-medium-omit │ ├── README.ja.md │ ├── README.ko.md │ ├── README.md │ ├── README.pt-BR.md │ ├── README.zh-CN.md │ ├── info.yml │ ├── info.zh-CN.yml │ ├── template.ts │ └── test-cases.ts ├── 00004-easy-pick │ ├── README.ja.md │ ├── README.ko.md │ ├── README.md │ ├── README.pt-BR.md │ ├── README.zh-CN.md │ ├── info.yml │ ├── info.zh-CN.yml │ ├── template.ts │ └── test-cases.ts ├── 00005-extreme-readonly-keys │ ├── README.ja.md │ ├── README.ko.md │ ├── README.md │ ├── README.pt-BR.md │ ├── README.zh-CN.md │ ├── info.yml │ ├── info.zh-CN.yml │ ├── template.ts │ └── test-cases.ts ├── 00006-hard-simple-vue │ ├── README.ja.md │ ├── README.md │ ├── README.pt-BR.md │ ├── README.zh-CN.md │ ├── info.yml │ ├── info.zh-CN.yml │ ├── template.ts │ └── test-cases.ts ├── 00007-easy-readonly │ ├── README.ja.md │ ├── README.ko.md │ ├── README.md │ ├── README.pt-BR.md │ ├── README.zh-CN.md │ ├── info.yml │ ├── info.zh-CN.yml │ ├── template.ts │ └── test-cases.ts ├── 00008-medium-readonly-2 │ ├── README.ja.md │ ├── README.ko.md │ ├── README.md │ ├── README.pt-BR.md │ ├── README.zh-CN.md │ ├── info.yml │ ├── info.zh-CN.yml │ ├── template.ts │ └── test-cases.ts ├── 00009-medium-deep-readonly │ ├── README.ja.md │ ├── README.ko.md │ ├── README.md │ ├── README.pt-BR.md │ ├── README.zh-CN.md │ ├── info.yml │ ├── info.zh-CN.yml │ ├── template.ts │ └── test-cases.ts ├── 00010-medium-tuple-to-union │ ├── README.ja.md │ ├── README.ko.md │ ├── README.md │ ├── README.pt-BR.md │ ├── README.zh-CN.md │ ├── info.yml │ ├── info.zh-CN.yml │ ├── template.ts │ └── test-cases.ts ├── 00011-easy-tuple-to-object │ ├── README.ja.md │ ├── README.ko.md │ ├── README.md │ ├── README.pt-BR.md │ ├── README.zh-CN.md │ ├── info.pt-BR.yml │ ├── info.yml │ ├── info.zh-CN.yml │ ├── template.ts │ └── test-cases.ts ├── 00012-medium-chainable-options │ ├── README.ja.md │ ├── README.ko.md │ ├── README.md │ ├── README.pt-BR.md │ ├── README.zh-CN.md │ ├── info.pt-BR.yml │ ├── info.yml │ ├── info.zh-CN.yml │ ├── template.ts │ └── test-cases.ts ├── 00013-warm-hello-world │ ├── README.ja.md │ ├── README.ko.md │ ├── README.md │ ├── README.pt-BR.md │ ├── README.zh-CN.md │ ├── info.pt-BR.yml │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 00014-easy-first │ ├── README.ja.md │ ├── README.ko.md │ ├── README.md │ ├── README.pt-BR.md │ ├── README.zh-CN.md │ ├── info.pt-BR.yml │ ├── info.yml │ ├── info.zh-CN.yml │ ├── template.ts │ └── test-cases.ts ├── 00015-medium-last │ ├── README.ja.md │ ├── README.ko.md │ ├── README.md │ ├── README.pt-BR.md │ ├── README.zh-CN.md │ ├── info.pt-BR.yml │ ├── info.yml │ ├── info.zh-CN.yml │ ├── template.ts │ └── test-cases.ts ├── 00016-medium-pop │ ├── README.ja.md │ ├── README.ko.md │ ├── README.md │ ├── README.pt-BR.md │ ├── README.zh-CN.md │ ├── info.pt-BR.yml │ ├── info.yml │ ├── info.zh-CN.yml │ ├── template.ts │ └── test-cases.ts ├── 00017-hard-currying-1 │ ├── README.ja.md │ ├── README.md │ ├── README.pt-BR.md │ ├── README.zh-CN.md │ ├── info.pt-BR.yml │ ├── info.yml │ ├── info.zh-CN.yml │ ├── template.ts │ └── test-cases.ts ├── 00018-easy-tuple-length │ ├── README.ja.md │ ├── README.ko.md │ ├── README.md │ ├── README.pt-BR.md │ ├── README.zh-CN.md │ ├── info.pt-BR.yml │ ├── info.yml │ ├── info.zh-CN.yml │ ├── template.ts │ └── test-cases.ts ├── 00020-medium-promise-all │ ├── README.ja.md │ ├── README.md │ ├── README.pt-BR.md │ ├── README.zh-CN.md │ ├── info.pt-BR.yml │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 00043-easy-exclude │ ├── README.ja.md │ ├── README.ko.md │ ├── README.md │ ├── README.pt-BR.md │ ├── README.zh-CN.md │ ├── info.pt-BR.yml │ ├── info.yml │ ├── info.zh-CN.yml │ ├── template.ts │ └── test-cases.ts ├── 00055-hard-union-to-intersection │ ├── README.ja.md │ ├── README.md │ ├── README.pt-BR.md │ ├── README.zh-CN.md │ ├── info.pt-BR.yml │ ├── info.yml │ ├── info.zh-CN.yml │ ├── template.ts │ └── test-cases.ts ├── 00057-hard-get-required │ ├── README.ja.md │ ├── README.md │ ├── README.pt-BR.md │ ├── README.zh-CN.md │ ├── info.pt-BR.yml │ ├── info.yml │ ├── info.zh-CN.yml │ ├── template.ts │ └── test-cases.ts ├── 00059-hard-get-optional │ ├── README.ja.md │ ├── README.md │ ├── README.pt-BR.md │ ├── README.zh-CN.md │ ├── info.pt-BR.yml │ ├── info.yml │ ├── info.zh-CN.yml │ ├── template.ts │ └── test-cases.ts ├── 00062-medium-type-lookup │ ├── README.ja.md │ ├── README.ko.md │ ├── README.md │ ├── README.pt-BR.md │ ├── README.zh-CN.md │ ├── info.pt-BR.yml │ ├── info.yml │ ├── info.zh-CN.yml │ ├── template.ts │ └── test-cases.ts ├── 00089-hard-required-keys │ ├── README.ja.md │ ├── README.md │ ├── README.pt-BR.md │ ├── README.zh-CN.md │ ├── info.pt-BR.yml │ ├── info.yml │ ├── info.zh-CN.yml │ ├── template.ts │ └── test-cases.ts ├── 00090-hard-optional-keys │ ├── README.ja.md │ ├── README.md │ ├── README.pt-BR.md │ ├── README.zh-CN.md │ ├── info.pt-BR.yml │ ├── info.yml │ ├── info.zh-CN.yml │ ├── template.ts │ └── test-cases.ts ├── 00106-medium-trimleft │ ├── README.ja.md │ ├── README.ko.md │ ├── README.md │ ├── README.pt-BR.md │ ├── README.zh-CN.md │ ├── info.pt-BR.yml │ ├── info.yml │ ├── info.zh-CN.yml │ ├── template.ts │ └── test-cases.ts ├── 00108-medium-trim │ ├── README.ja.md │ ├── README.ko.md │ ├── README.md │ ├── README.pt-BR.md │ ├── README.zh-CN.md │ ├── info.pt-BR.yml │ ├── info.yml │ ├── info.zh-CN.yml │ ├── template.ts │ └── test-cases.ts ├── 00110-medium-capitalize │ ├── README.ja.md │ ├── README.ko.md │ ├── README.md │ ├── README.pt-BR.md │ ├── README.zh-CN.md │ ├── info.pt-BR.yml │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 00112-hard-capitalizewords │ ├── README.ja.md │ ├── README.md │ ├── README.pt-BR.md │ ├── README.zh-CN.md │ ├── info.pt-BR.yml │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 00114-hard-camelcase │ ├── README.ja.md │ ├── README.md │ ├── README.zh-CN.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 00116-medium-replace │ ├── README.ja.md │ ├── README.ko.md │ ├── README.md │ ├── README.zh-CN.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 00119-medium-replaceall │ ├── README.ja.md │ ├── README.ko.md │ ├── README.md │ ├── README.zh-CN.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 00147-hard-c-printf-parser │ ├── README.ja.md │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 00151-extreme-query-string-parser │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 00189-easy-awaited │ ├── README.ja.md │ ├── README.ko.md │ ├── README.md │ ├── README.zh-CN.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 00191-medium-append-argument │ ├── README.ja.md │ ├── README.ko.md │ ├── README.md │ ├── README.zh-CN.md │ ├── info.yml │ ├── info.zh-CN.yml │ ├── template.ts │ └── test-cases.ts ├── 00213-hard-vue-basic-props │ ├── README.ja.md │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 00216-extreme-slice │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 00223-hard-isany │ ├── README.ja.md │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 00268-easy-if │ ├── README.ja.md │ ├── README.ko.md │ ├── README.md │ ├── README.zh-CN.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 00270-hard-typed-get │ ├── README.ja.md │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 00274-extreme-integers-comparator │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 00296-medium-permutation │ ├── README.ja.md │ ├── README.ko.md │ ├── README.md │ ├── README.zh-CN.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 00298-medium-length-of-string │ ├── README.ja.md │ ├── README.ko.md │ ├── README.md │ ├── README.zh-CN.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 00300-hard-string-to-number │ ├── README.ja.md │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 00399-hard-tuple-filter │ ├── README.ja.md │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 00459-medium-flatten │ ├── README.ja.md │ ├── README.ko.md │ ├── README.md │ ├── README.zh-CN.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 00462-extreme-currying-2 │ ├── README.md │ ├── README.zh-CN.md │ ├── info.yml │ ├── info.zh-CN.yml │ ├── template.ts │ └── test-cases.ts ├── 00472-hard-tuple-to-enum-object │ ├── README.ja.md │ ├── README.md │ ├── README.zh-CN.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 00476-extreme-sum │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 00517-extreme-multiply │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 00527-medium-append-to-object │ ├── README.ja.md │ ├── README.ko.md │ ├── README.md │ ├── README.zh-CN.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 00529-medium-absolute │ ├── README.ja.md │ ├── README.ko.md │ ├── README.md │ ├── README.zh-CN.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 00531-medium-string-to-union │ ├── README.ja.md │ ├── README.ko.md │ ├── README.md │ ├── README.zh-CN.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 00533-easy-concat │ ├── README.ja.md │ ├── README.ko.md │ ├── README.md │ ├── README.zh-CN.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 00545-hard-printf │ ├── README.ja.md │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 00553-hard-deep-object-to-unique │ ├── README.ja.md │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 00599-medium-merge │ ├── README.ja.md │ ├── README.ko.md │ ├── README.md │ ├── README.zh-CN.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 00612-medium-kebabcase │ ├── README.ja.md │ ├── README.ko.md │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 00645-medium-diff │ ├── README.ko.md │ ├── README.md │ ├── README.zh-CN.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 00651-hard-length-of-string-2 │ ├── README.ja.md │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 00697-extreme-tag │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 00730-hard-union-to-tuple │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 00734-extreme-inclusive-range │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 00741-extreme-sort │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 00847-hard-string-join │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 00869-extreme-distributeunions │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 00898-easy-includes │ ├── README.ja.md │ ├── README.ko.md │ ├── README.md │ ├── README.zh-CN.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 00925-extreme-assert-array-index │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 00949-medium-anyof │ ├── README.ko.md │ ├── README.md │ ├── README.zh-CN.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 00956-hard-deeppick │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 01042-medium-isnever │ ├── README.ko.md │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 01097-medium-isunion │ ├── README.ko.md │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 01130-medium-replacekeys │ ├── README.ko.md │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 01290-hard-pinia │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 01367-medium-remove-index-signature │ ├── README.ko.md │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 01383-hard-camelize │ ├── README.md │ ├── README.zh-CN.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 01978-medium-percentage-parser │ ├── README.ko.md │ ├── README.md │ ├── README.zh-CN.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 02059-hard-drop-string │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 02070-medium-drop-char │ ├── README.md │ ├── README.zh-CN.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 02257-medium-minusone │ ├── README.md │ ├── README.zh-CN.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 02595-medium-pickbytype │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 02688-medium-startswith │ ├── README.md │ ├── README.zh-CN.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 02693-medium-endswith │ ├── README.md │ ├── README.zh-CN.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 02757-medium-partialbykeys │ ├── README.ko.md │ ├── README.md │ ├── README.zh-CN.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 02759-medium-requiredbykeys │ ├── README.md │ ├── README.zh-CN.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 02793-medium-mutable │ ├── README.md │ ├── README.zh-CN.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 02822-hard-split │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 02828-hard-classpublickeys │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 02852-medium-omitbytype │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 02857-hard-isrequiredkey │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 02946-medium-objectentries │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 02949-hard-objectfromentries │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 03057-easy-push │ ├── README.ja.md │ ├── README.ko.md │ ├── README.md │ ├── README.zh-CN.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 03060-easy-unshift │ ├── README.ja.md │ ├── README.ko.md │ ├── README.md │ ├── README.zh-CN.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 03062-medium-shift │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 03188-medium-tuple-to-nested-object │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 03192-medium-reverse │ ├── README.md │ ├── README.zh-CN.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 03196-medium-flip-arguments │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 03243-medium-flattendepth │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 03312-easy-parameters │ ├── README.ja.md │ ├── README.ko.md │ ├── README.md │ ├── README.zh-CN.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 03326-medium-bem-style-string │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 03376-medium-inordertraversal │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 04037-hard-ispalindrome │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 04179-medium-flip │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 04182-medium-fibonacci-sequence │ ├── README.md │ ├── README.zh-CN.md │ ├── info.yml │ ├── info.zh-CN.yml │ ├── template.ts │ └── test-cases.ts ├── 04260-medium-nomiwase │ ├── README.ja.md │ ├── README.md │ ├── info.ja.yml │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 04425-medium-greater-than │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 04471-medium-zip │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 04484-medium-istuple │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 04499-medium-chunk │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 04518-medium-fill │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 04803-medium-trim-right │ ├── README.ko.md │ ├── README.md │ ├── README.zh-CN.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 05117-medium-without │ ├── README.md │ ├── README.zh-CN.md │ ├── info.yml │ ├── info.zh-CN.yml │ ├── template.ts │ └── test-cases.ts ├── 05140-medium-trunc │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 05153-medium-indexof │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 05181-hard-mutable-keys │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 05310-medium-join │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 05317-medium-lastindexof │ ├── README.md │ ├── README.zh-CN.md │ ├── info.yml │ ├── info.zh-CN.yml │ ├── template.ts │ └── test-cases.ts ├── 05360-medium-unique │ ├── README.md │ ├── README.zh-CN.md │ ├── info.yml │ ├── info.zh-CN.yml │ ├── template.ts │ └── test-cases.ts ├── 05423-hard-intersection │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 05821-medium-maptypes │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 06141-hard-binary-to-decimal │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 06228-extreme-json-parser │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 07258-hard-object-key-paths │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 07544-medium-construct-tuple │ ├── README.md │ ├── README.zh-CN.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 07561-extreme-subtract │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 08640-medium-number-range │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 08767-medium-combination │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 08804-hard-two-sum │ ├── README.md │ ├── README.zh-CN.md │ ├── info.yml │ ├── info.zh-CN.yml │ ├── template.ts │ └── test-cases.ts ├── 08987-medium-subsequence │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 09142-medium-checkrepeatedchars │ ├── README.md │ ├── README.zh-CN.md │ ├── info.yml │ ├── info.zh-CN.yml │ ├── template.ts │ └── test-cases.ts ├── 09155-hard-validdate │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 09160-hard-assign │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 09286-medium-firstuniquecharindex │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 09384-hard-maximum │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 09616-medium-parse-url-params │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 09775-hard-capitalize-nest-object-keys │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 09896-medium-get-middle-element │ ├── README.md │ ├── README.zh-CN.md │ ├── info.yml │ ├── info.zh-CN.yml │ ├── template.ts │ └── test-cases.ts ├── 09898-medium-zhao-chu-mu-biao-shu-zu-zhong-zhi-chu-xian-guo-yi-ci-de-yuan-su │ ├── README.md │ ├── README.zh-CN.md │ ├── info.yml │ ├── info.zh-CN.yml │ ├── template.ts │ └── test-cases.ts ├── 09989-medium-tong-ji-shu-zu-zhong-de-yuan-su-ge-shu │ ├── README.md │ ├── README.zh-CN.md │ ├── info.yml │ ├── info.zh-CN.yml │ ├── template.ts │ └── test-cases.ts ├── 10969-medium-integer │ ├── README.md │ ├── README.zh-CN.md │ ├── info.yml │ ├── info.zh-CN.yml │ ├── template.ts │ └── test-cases.ts ├── 13580-hard-replace-union │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 14080-hard-fizzbuzz │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 14188-hard-run-length-encoding │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 15260-hard-tree-path-array │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 16259-medium-to-primitive │ ├── README.md │ ├── README.zh-CN.md │ ├── info.yml │ ├── info.zh-CN.yml │ ├── template.ts │ └── test-cases.ts ├── 17973-medium-deepmutable │ ├── README.md │ ├── README.zh-CN.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 18142-medium-all │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 18220-medium-filter │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 19458-hard-snakecase │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 21104-medium-findall │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 21106-medium-zu-he-jian-lei-xing-combination-key-type │ ├── README.md │ ├── README.zh-CN.md │ ├── info.yml │ ├── info.zh-CN.yml │ ├── template.ts │ └── test-cases.ts ├── 21220-medium-permutations-of-tuple │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 25170-medium-replace-first │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 25270-medium-transpose │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 25747-hard-isnegativenumber │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 26401-medium-json-schema-to-typescript │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 27133-medium-square │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 27152-medium-triangular-number │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 27862-medium-cartesianproduct │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 27932-medium-mergeall │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 27958-medium-checkrepeatedtuple │ ├── README.md │ ├── README.zh-CN.md │ ├── info.yml │ ├── info.zh-CN.yml │ ├── template.ts │ └── test-cases.ts ├── 28143-hard-optionalundefined │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 28333-medium-public-type │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 29650-medium-extracttoobject │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 29785-medium-deep-omit │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 30301-medium-isodd │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 30430-medium-tower-of-hanoi │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 30575-hard-bitwisexor │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 30958-medium-pascals-triangle │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── 30970-medium-shitariteraru │ ├── README.ja.md │ ├── README.md │ ├── info.ja.yml │ ├── info.yml │ ├── template.ts │ └── test-cases.ts └── 31447-extreme-countreversepairs │ ├── README.md │ ├── info.yml │ ├── template.ts │ └── test-cases.ts ├── screenshots ├── logo-dark.png ├── logo-light.png ├── logo-mask.png └── logo.svg ├── scripts ├── actions │ ├── issue-pr.ts │ ├── labeling.ts │ ├── loader.ts │ ├── toggle-pr-with-issue.ts │ └── utils │ │ ├── formatToCode.ts │ │ ├── toCommentBlock.ts │ │ ├── toDivider.ts │ │ ├── toFooter.ts │ │ ├── toInfoHeader.ts │ │ └── toLinks.ts ├── build.ts ├── generate-play.ts ├── loader.ts ├── locales.ts ├── locales │ ├── en.json │ ├── ja.json │ ├── ko.json │ ├── pt-BR.json │ └── zh-CN.json ├── netlify.sh ├── netlify.toml ├── package.json ├── readme.ts ├── toUrl.ts ├── translate-cli.ts ├── translate.ts ├── tsconfig.json ├── types.ts └── utils │ └── resolve.ts ├── site ├── favicon.svg ├── index.html ├── logo.svg ├── netlify.svg ├── social.svg └── style.css ├── tsconfig.base.json ├── tsconfig.json └── utils ├── README.md ├── index.d.test.ts ├── index.d.ts ├── package.json └── tsconfig.json /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: antfu 4 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/0-answer.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Answers 3 | about: Share answers/solutions to a question 4 | title: "no - " 5 | labels: answer, en 6 | --- 7 | 8 | 19 | 20 | ```ts 21 | // your answers 22 | ``` 23 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/0-bug.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug 3 | about: I found some thing wrong! 4 | title: "" 5 | labels: bug 6 | --- 7 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/0-discussion.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Discussion 3 | about: General discussions. 4 | title: "" 5 | labels: discussion 6 | --- 7 | 8 | 15 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/0-help.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Help 3 | about: I have a question/demand, I would need some help. 4 | title: "" 5 | labels: help 6 | --- 7 | 8 | 19 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/1-answer.ja.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: 🇯🇵 解答 3 | about: 解答/質問への回答の共有。 4 | title: "no - " 5 | labels: answer, ja 6 | --- 7 | 8 | 17 | 18 | ```ts 19 | // 解答をここに記入 20 | ``` 21 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/1-answer.ko.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: 문제풀이 3 | about: 풀이 공유하기/문제의 풀이 4 | title: "no - " 5 | labels: answer, ko 6 | --- 7 | 8 | 22 | 23 | ```ts 24 | // 여기 풀이를 입력하세요 25 | ``` 26 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/1-answer.zh-CN.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: 🇨🇳 解法分享 3 | about: 分享你对于某题的解法/答案 4 | title: "no - " 5 | labels: answer, zh-CN 6 | --- 7 | 8 | 19 | 20 | 21 | ```ts 22 | // 你的答案 23 | ``` 24 | -------------------------------------------------------------------------------- /.github/workflows/index-update.yaml: -------------------------------------------------------------------------------- 1 | name: Index Update 2 | 3 | on: 4 | schedule: 5 | - cron: '0 0 * * *' 6 | workflow_dispatch: {} 7 | 8 | jobs: 9 | start: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: actions/checkout@v3 13 | - uses: pnpm/action-setup@v2 14 | - uses: actions/setup-node@v3 15 | with: 16 | node-version: 16.x 17 | cache: pnpm 18 | - run: pnpm i 19 | - run: npm run readme 20 | - run: npm run lint -- --fix 21 | - uses: EndBug/add-and-commit@v9 22 | with: 23 | message: 'chore: update index' 24 | -------------------------------------------------------------------------------- /.github/workflows/issue-pr.yaml: -------------------------------------------------------------------------------- 1 | name: Issue to Pull Request 2 | 3 | on: 4 | issues: 5 | types: [opened, edited] 6 | 7 | jobs: 8 | start: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/checkout@v3 12 | - uses: actions/setup-node@v3 13 | with: 14 | node-version: 16.x 15 | - run: cd scripts && npm i --only=production 16 | - run: cd scripts/actions && npx esno ./loader.ts ${{github.token}} issue-pr 17 | -------------------------------------------------------------------------------- /.github/workflows/labeling.yaml: -------------------------------------------------------------------------------- 1 | name: Labeling 2 | 3 | on: 4 | issues: 5 | types: [opened, labeled] 6 | 7 | jobs: 8 | start: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/checkout@v3 12 | - uses: actions/setup-node@v3 13 | with: 14 | node-version: 16.x 15 | - run: cd scripts && npm i --only=production 16 | - run: cd scripts/actions && npx esno ./loader.ts ${{github.token}} labeling 17 | -------------------------------------------------------------------------------- /.github/workflows/toggle-pr-with-issue.yaml: -------------------------------------------------------------------------------- 1 | name: Toggle PR With Issue 2 | 3 | on: 4 | issues: 5 | types: [closed, reopened] 6 | 7 | jobs: 8 | start: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/checkout@v3 12 | - uses: actions/setup-node@v3 13 | with: 14 | node-version: 16.x 15 | - run: cd scripts && npm i --only=production 16 | - run: cd scripts/actions && npx esno ./loader.ts ${{github.token}} toggle-pr-with-issue 17 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | .DS_Store 3 | .idea 4 | dist 5 | *.log 6 | *.local 7 | playground/ 8 | .playgroundcache -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | ignore-workspace-root-check = true -------------------------------------------------------------------------------- /TODOs.md: -------------------------------------------------------------------------------- 1 | ## TODOs 2 | 3 | A list of TODOs for this project, PR welcome! 4 | 5 | - [ ] Auto translate for Chinese -> English / English -> Chinese. With a checkbox to opt-in in the new challenge issues. 6 | 7 | - [ ] Local playground generator for devs 8 | 9 | - [ ] A plugin for TypeScript Playground that provides some hint and form functionality to boost the experiences on taking challenges 10 | 11 | - [ ] More learning resources 12 | 13 | - [ ] "Recent Challenges" section in the README 14 | 15 | -------------------------------------------------------------------------------- /eslint.config.js: -------------------------------------------------------------------------------- 1 | const antfu = require('@antfu/eslint-config').default 2 | 3 | module.exports = antfu( 4 | { 5 | markdown: false, 6 | }, 7 | { 8 | rules: { 9 | 'import/first': 'off', 10 | 'no-alert': 'off', 11 | 'no-unused-expressions': 'off', 12 | 'no-unused-vars': 'off', 13 | 'no-use-before-define': 'off', 14 | 'prefer-const': 'off', 15 | 'ts/ban-ts-comment': 'off', 16 | 'ts/ban-types': 'off', 17 | 'ts/consistent-type-definitions': 'off', 18 | 'ts/no-namespace': 'off', 19 | 'ts/no-require-imports': 'off', 20 | 'ts/no-unused-vars': 'off', 21 | 'unused-imports/no-unused-vars': 'off', 22 | }, 23 | }, 24 | ) 25 | -------------------------------------------------------------------------------- /guides/infer.md: -------------------------------------------------------------------------------- 1 | > TODO: -------------------------------------------------------------------------------- /guides/infer.zh-CN.md: -------------------------------------------------------------------------------- 1 | > TODO: -------------------------------------------------------------------------------- /guides/key-in.md: -------------------------------------------------------------------------------- 1 | > TODO: -------------------------------------------------------------------------------- /guides/key-in.zh-CN.md: -------------------------------------------------------------------------------- 1 | > TODO: -------------------------------------------------------------------------------- /guides/recursive.md: -------------------------------------------------------------------------------- 1 | > TODO: -------------------------------------------------------------------------------- /guides/recursive.zh-CN.md: -------------------------------------------------------------------------------- 1 | > TODO: -------------------------------------------------------------------------------- /pnpm-workspace.yaml: -------------------------------------------------------------------------------- 1 | packages: 2 | - utils 3 | - scripts 4 | -------------------------------------------------------------------------------- /questions/00002-medium-return-type/info.pt-BR.yml: -------------------------------------------------------------------------------- 1 | title: Obter Tipo de Retorno 2 | 3 | author: 4 | name: Anthony Fu 5 | email: hi@antfu.me 6 | github: antfu 7 | 8 | tags: infer, built-in 9 | 10 | tsconfig: null 11 | 12 | original_issues: null 13 | recommended_solutions: null 14 | 15 | difficulty: médio 16 | -------------------------------------------------------------------------------- /questions/00002-medium-return-type/info.yml: -------------------------------------------------------------------------------- 1 | title: Get Return Type 2 | 3 | author: 4 | name: Anthony Fu 5 | email: hi@antfu.me 6 | github: antfu 7 | 8 | tags: infer, built-in 9 | 10 | tsconfig: null 11 | 12 | original_issues: null 13 | recommended_solutions: null 14 | 15 | difficulty: medium 16 | -------------------------------------------------------------------------------- /questions/00002-medium-return-type/info.zh-CN.yml: -------------------------------------------------------------------------------- 1 | title: 获取函数返回类型 2 | -------------------------------------------------------------------------------- /questions/00002-medium-return-type/template.ts: -------------------------------------------------------------------------------- 1 | type MyReturnType = any 2 | -------------------------------------------------------------------------------- /questions/00002-medium-return-type/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect string>>>, 5 | Expect 123>>>, 6 | Expect ComplexObject>>>, 7 | Expect, MyReturnType<() => Promise>>>, 8 | Expect 'foo', MyReturnType<() => () => 'foo'>>>, 9 | Expect>>, 10 | Expect>>, 11 | ] 12 | 13 | type ComplexObject = { 14 | a: [12, 'foo'] 15 | bar: 'hello' 16 | prev(): number 17 | } 18 | 19 | const fn = (v: boolean) => v ? 1 : 2 20 | const fn1 = (v: boolean, w: any) => v ? 1 : 2 21 | -------------------------------------------------------------------------------- /questions/00003-medium-omit/info.yml: -------------------------------------------------------------------------------- 1 | title: Omit 2 | 3 | author: 4 | name: Anthony Fu 5 | email: hi@antfu.me 6 | github: antfu 7 | 8 | tags: union, built-in 9 | 10 | related: 4 11 | 12 | difficulty: medium 13 | -------------------------------------------------------------------------------- /questions/00003-medium-omit/info.zh-CN.yml: -------------------------------------------------------------------------------- 1 | title: 实现 Omit 2 | -------------------------------------------------------------------------------- /questions/00003-medium-omit/template.ts: -------------------------------------------------------------------------------- 1 | type MyOmit = any 2 | -------------------------------------------------------------------------------- /questions/00003-medium-omit/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect>>, 5 | Expect>>, 6 | ] 7 | 8 | // @ts-expect-error 9 | type error = MyOmit 10 | 11 | interface Todo { 12 | title: string 13 | description: string 14 | completed: boolean 15 | } 16 | 17 | interface Expected1 { 18 | title: string 19 | completed: boolean 20 | } 21 | 22 | interface Expected2 { 23 | title: string 24 | } 25 | -------------------------------------------------------------------------------- /questions/00004-easy-pick/info.yml: -------------------------------------------------------------------------------- 1 | title: Pick 2 | 3 | author: 4 | name: Anthony Fu 5 | email: hi@antfu.me 6 | github: antfu 7 | 8 | tags: union, built-in 9 | 10 | related: 3 11 | 12 | difficulty: easy 13 | -------------------------------------------------------------------------------- /questions/00004-easy-pick/info.zh-CN.yml: -------------------------------------------------------------------------------- 1 | title: 实现 Pick 2 | -------------------------------------------------------------------------------- /questions/00004-easy-pick/template.ts: -------------------------------------------------------------------------------- 1 | type MyPick = any 2 | -------------------------------------------------------------------------------- /questions/00004-easy-pick/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect>>, 5 | Expect>>, 6 | // @ts-expect-error 7 | MyPick, 8 | ] 9 | 10 | interface Todo { 11 | title: string 12 | description: string 13 | completed: boolean 14 | } 15 | 16 | interface Expected1 { 17 | title: string 18 | } 19 | 20 | interface Expected2 { 21 | title: string 22 | completed: boolean 23 | } 24 | -------------------------------------------------------------------------------- /questions/00005-extreme-readonly-keys/info.yml: -------------------------------------------------------------------------------- 1 | title: Get Readonly Keys 2 | 3 | author: 4 | name: Anthony Fu 5 | email: hi@antfu.me 6 | github: antfu 7 | 8 | tags: utils, object-keys 9 | 10 | difficulty: extreme 11 | -------------------------------------------------------------------------------- /questions/00005-extreme-readonly-keys/info.zh-CN.yml: -------------------------------------------------------------------------------- 1 | title: 获取只读属性 2 | -------------------------------------------------------------------------------- /questions/00005-extreme-readonly-keys/template.ts: -------------------------------------------------------------------------------- 1 | type GetReadonlyKeys = any 2 | -------------------------------------------------------------------------------- /questions/00005-extreme-readonly-keys/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect>>, 5 | Expect>>, 6 | ] 7 | 8 | interface Todo1 { 9 | readonly title: string 10 | description: string 11 | completed: boolean 12 | } 13 | 14 | interface Todo2 { 15 | readonly title: string 16 | readonly description: string 17 | completed?: boolean 18 | } 19 | -------------------------------------------------------------------------------- /questions/00006-hard-simple-vue/info.yml: -------------------------------------------------------------------------------- 1 | title: Simple Vue 2 | author: 3 | name: Anthony Fu 4 | github: antfu 5 | tags: this, application, vue 6 | related: 213 7 | difficulty: hard 8 | -------------------------------------------------------------------------------- /questions/00006-hard-simple-vue/info.zh-CN.yml: -------------------------------------------------------------------------------- 1 | title: 简单的 Vue 类型 2 | -------------------------------------------------------------------------------- /questions/00006-hard-simple-vue/template.ts: -------------------------------------------------------------------------------- 1 | declare function SimpleVue(options: any): any 2 | -------------------------------------------------------------------------------- /questions/00006-hard-simple-vue/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | SimpleVue({ 4 | data() { 5 | // @ts-expect-error 6 | this.firstname 7 | // @ts-expect-error 8 | this.getRandom() 9 | // @ts-expect-error 10 | this.data() 11 | 12 | return { 13 | firstname: 'Type', 14 | lastname: 'Challenges', 15 | amount: 10, 16 | } 17 | }, 18 | computed: { 19 | fullname() { 20 | return `${this.firstname} ${this.lastname}` 21 | }, 22 | }, 23 | methods: { 24 | getRandom() { 25 | return Math.random() 26 | }, 27 | hi() { 28 | alert(this.amount) 29 | alert(this.fullname.toLowerCase()) 30 | alert(this.getRandom()) 31 | }, 32 | test() { 33 | const fullname = this.fullname 34 | const cases: [Expect>] = [] as any 35 | }, 36 | }, 37 | }) 38 | -------------------------------------------------------------------------------- /questions/00007-easy-readonly/info.yml: -------------------------------------------------------------------------------- 1 | title: Readonly 2 | 3 | author: 4 | name: Anthony Fu 5 | email: hi@antfu.me 6 | github: antfu 7 | 8 | tags: built-in, readonly, object-keys 9 | 10 | related: 8, 9 11 | 12 | difficulty: easy 13 | -------------------------------------------------------------------------------- /questions/00007-easy-readonly/info.zh-CN.yml: -------------------------------------------------------------------------------- 1 | title: 对象属性只读 2 | -------------------------------------------------------------------------------- /questions/00007-easy-readonly/template.ts: -------------------------------------------------------------------------------- 1 | type MyReadonly = any 2 | -------------------------------------------------------------------------------- /questions/00007-easy-readonly/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, Readonly>>, 5 | ] 6 | 7 | interface Todo1 { 8 | title: string 9 | description: string 10 | completed: boolean 11 | meta: { 12 | author: string 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /questions/00008-medium-readonly-2/info.yml: -------------------------------------------------------------------------------- 1 | title: Readonly 2 2 | 3 | author: 4 | name: Anthony Fu 5 | email: hi@antfu.me 6 | github: antfu 7 | 8 | tags: readonly, object-keys 9 | 10 | related: 7, 9 11 | 12 | difficulty: medium 13 | -------------------------------------------------------------------------------- /questions/00008-medium-readonly-2/info.zh-CN.yml: -------------------------------------------------------------------------------- 1 | title: 对象部分属性只读 2 | -------------------------------------------------------------------------------- /questions/00008-medium-readonly-2/template.ts: -------------------------------------------------------------------------------- 1 | type MyReadonly2 = any 2 | -------------------------------------------------------------------------------- /questions/00008-medium-readonly-2/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Alike, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, Readonly>>, 5 | Expect, Expected>>, 6 | Expect, Expected>>, 7 | Expect, Expected>>, 8 | ] 9 | 10 | // @ts-expect-error 11 | type error = MyReadonly2 12 | 13 | interface Todo1 { 14 | title: string 15 | description?: string 16 | completed: boolean 17 | } 18 | 19 | interface Todo2 { 20 | readonly title: string 21 | description?: string 22 | completed: boolean 23 | } 24 | 25 | interface Expected { 26 | readonly title: string 27 | readonly description?: string 28 | completed: boolean 29 | } 30 | -------------------------------------------------------------------------------- /questions/00009-medium-deep-readonly/info.yml: -------------------------------------------------------------------------------- 1 | title: Deep Readonly 2 | 3 | author: 4 | name: Anthony Fu 5 | email: hi@antfu.me 6 | github: antfu 7 | 8 | tags: readonly, object-keys, deep 9 | 10 | related: 7, 8 11 | 12 | difficulty: medium 13 | -------------------------------------------------------------------------------- /questions/00009-medium-deep-readonly/info.zh-CN.yml: -------------------------------------------------------------------------------- 1 | title: 对象属性只读(递归) 2 | -------------------------------------------------------------------------------- /questions/00009-medium-deep-readonly/template.ts: -------------------------------------------------------------------------------- 1 | type DeepReadonly = any 2 | -------------------------------------------------------------------------------- /questions/00010-medium-tuple-to-union/info.yml: -------------------------------------------------------------------------------- 1 | title: Tuple to Union 2 | 3 | author: 4 | name: Anthony Fu 5 | email: hi@antfu.me 6 | github: antfu 7 | 8 | tags: infer, tuple, union 9 | 10 | related: 11, 472, 730, 3188 11 | 12 | difficulty: medium 13 | -------------------------------------------------------------------------------- /questions/00010-medium-tuple-to-union/info.zh-CN.yml: -------------------------------------------------------------------------------- 1 | title: 元组转合集 2 | -------------------------------------------------------------------------------- /questions/00010-medium-tuple-to-union/template.ts: -------------------------------------------------------------------------------- 1 | type TupleToUnion = any 2 | -------------------------------------------------------------------------------- /questions/00010-medium-tuple-to-union/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, 123 | '456' | true>>, 5 | Expect, 123>>, 6 | ] 7 | -------------------------------------------------------------------------------- /questions/00011-easy-tuple-to-object/info.pt-BR.yml: -------------------------------------------------------------------------------- 1 | title: Tupla para Objeto 2 | 3 | author: 4 | name: sinoon 5 | email: sinoon1218@gamil.com 6 | github: sinoon 7 | 8 | related: 10, 472, 730, 3188 9 | 10 | tags: object-keys 11 | 12 | difficulty: fácil 13 | -------------------------------------------------------------------------------- /questions/00011-easy-tuple-to-object/info.yml: -------------------------------------------------------------------------------- 1 | title: Tuple to Object 2 | 3 | author: 4 | name: sinoon 5 | email: sinoon1218@gamil.com 6 | github: sinoon 7 | 8 | related: 10, 472, 730, 3188 9 | 10 | tags: object-keys 11 | 12 | difficulty: easy 13 | -------------------------------------------------------------------------------- /questions/00011-easy-tuple-to-object/info.zh-CN.yml: -------------------------------------------------------------------------------- 1 | title: 元组转换为对象 2 | -------------------------------------------------------------------------------- /questions/00011-easy-tuple-to-object/template.ts: -------------------------------------------------------------------------------- 1 | type TupleToObject = any 2 | -------------------------------------------------------------------------------- /questions/00011-easy-tuple-to-object/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | const tuple = ['tesla', 'model 3', 'model X', 'model Y'] as const 4 | const tupleNumber = [1, 2, 3, 4] as const 5 | const sym1 = Symbol(1) 6 | const sym2 = Symbol(2) 7 | const tupleSymbol = [sym1, sym2] as const 8 | const tupleMix = [1, '2', 3, '4', sym1] as const 9 | 10 | type cases = [ 11 | Expect, { 'tesla': 'tesla', 'model 3': 'model 3', 'model X': 'model X', 'model Y': 'model Y' }>>, 12 | Expect, { 1: 1, 2: 2, 3: 3, 4: 4 }>>, 13 | Expect, { [sym1]: typeof sym1, [sym2]: typeof sym2 }>>, 14 | Expect, { 1: 1, '2': '2', 3: 3, '4': '4', [sym1]: typeof sym1 }>>, 15 | ] 16 | 17 | // @ts-expect-error 18 | type error = TupleToObject<[[1, 2], {}]> 19 | -------------------------------------------------------------------------------- /questions/00012-medium-chainable-options/info.pt-BR.yml: -------------------------------------------------------------------------------- 1 | title: Opções Encadeadas 2 | 3 | author: 4 | name: Anthony Fu 5 | email: hi@antfu.me 6 | github: antfu 7 | 8 | tags: application 9 | 10 | difficulty: médio 11 | -------------------------------------------------------------------------------- /questions/00012-medium-chainable-options/info.yml: -------------------------------------------------------------------------------- 1 | title: Chainable Options 2 | 3 | author: 4 | name: Anthony Fu 5 | email: hi@antfu.me 6 | github: antfu 7 | 8 | tags: application 9 | 10 | difficulty: medium 11 | -------------------------------------------------------------------------------- /questions/00012-medium-chainable-options/info.zh-CN.yml: -------------------------------------------------------------------------------- 1 | title: 可串联构造器 2 | -------------------------------------------------------------------------------- /questions/00012-medium-chainable-options/template.ts: -------------------------------------------------------------------------------- 1 | type Chainable = { 2 | option(key: string, value: any): any 3 | get(): any 4 | } 5 | -------------------------------------------------------------------------------- /questions/00013-warm-hello-world/info.pt-BR.yml: -------------------------------------------------------------------------------- 1 | title: Olá Mundo 2 | 3 | author: 4 | name: Anthony Fu 5 | email: hi@antfu.me 6 | github: antfu 7 | 8 | difficulty: aquecimento 9 | -------------------------------------------------------------------------------- /questions/00013-warm-hello-world/info.yml: -------------------------------------------------------------------------------- 1 | title: Hello World 2 | 3 | author: 4 | name: Anthony Fu 5 | email: hi@antfu.me 6 | github: antfu 7 | 8 | difficulty: warm 9 | -------------------------------------------------------------------------------- /questions/00013-warm-hello-world/template.ts: -------------------------------------------------------------------------------- 1 | type HelloWorld = any // expected to be a string 2 | -------------------------------------------------------------------------------- /questions/00013-warm-hello-world/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect, NotAny } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect>, 5 | Expect>, 6 | ] 7 | -------------------------------------------------------------------------------- /questions/00014-easy-first/info.pt-BR.yml: -------------------------------------------------------------------------------- 1 | title: Primeiro do Array 2 | 3 | author: 4 | name: Anthony Fu 5 | email: hi@antfu.me 6 | github: antfu 7 | 8 | tags: array 9 | 10 | related: 15 11 | 12 | difficulty: fácil 13 | -------------------------------------------------------------------------------- /questions/00014-easy-first/info.yml: -------------------------------------------------------------------------------- 1 | title: First of Array 2 | 3 | author: 4 | name: Anthony Fu 5 | email: hi@antfu.me 6 | github: antfu 7 | 8 | tags: array 9 | 10 | related: 15 11 | 12 | difficulty: easy 13 | -------------------------------------------------------------------------------- /questions/00014-easy-first/info.zh-CN.yml: -------------------------------------------------------------------------------- 1 | title: 第一个元素 2 | -------------------------------------------------------------------------------- /questions/00014-easy-first/template.ts: -------------------------------------------------------------------------------- 1 | type First = any 2 | -------------------------------------------------------------------------------- /questions/00014-easy-first/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, 3>>, 5 | Expect 123, { a: string }]>, () => 123>>, 6 | Expect, never>>, 7 | Expect, undefined>>, 8 | ] 9 | 10 | type errors = [ 11 | // @ts-expect-error 12 | First<'notArray'>, 13 | // @ts-expect-error 14 | First<{ 0: 'arrayLike' }>, 15 | ] 16 | -------------------------------------------------------------------------------- /questions/00015-medium-last/info.pt-BR.yml: -------------------------------------------------------------------------------- 1 | title: Último do Array 2 | 3 | author: 4 | name: Anthony Fu 5 | email: hi@antfu.me 6 | github: antfu 7 | 8 | tags: array 9 | 10 | related: 14, 16 11 | 12 | difficulty: médio 13 | -------------------------------------------------------------------------------- /questions/00015-medium-last/info.yml: -------------------------------------------------------------------------------- 1 | title: Last of Array 2 | 3 | author: 4 | name: Anthony Fu 5 | email: hi@antfu.me 6 | github: antfu 7 | 8 | tags: array 9 | 10 | related: 14, 16 11 | 12 | difficulty: medium 13 | -------------------------------------------------------------------------------- /questions/00015-medium-last/info.zh-CN.yml: -------------------------------------------------------------------------------- 1 | title: 最后一个元素 2 | -------------------------------------------------------------------------------- /questions/00015-medium-last/template.ts: -------------------------------------------------------------------------------- 1 | type Last = any 2 | -------------------------------------------------------------------------------- /questions/00015-medium-last/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, 2>>, 5 | Expect, 1>>, 6 | Expect 123, { a: string }]>, { a: string }>>, 7 | ] 8 | -------------------------------------------------------------------------------- /questions/00016-medium-pop/info.pt-BR.yml: -------------------------------------------------------------------------------- 1 | title: Pop 2 | 3 | author: 4 | name: Anthony Fu 5 | email: hi@antfu.me 6 | github: antfu 7 | 8 | tags: array 9 | 10 | related: 14, 15 11 | 12 | difficulty: médio 13 | -------------------------------------------------------------------------------- /questions/00016-medium-pop/info.yml: -------------------------------------------------------------------------------- 1 | title: Pop 2 | 3 | author: 4 | name: Anthony Fu 5 | email: hi@antfu.me 6 | github: antfu 7 | 8 | tags: array 9 | 10 | related: 14, 15 11 | 12 | difficulty: medium 13 | -------------------------------------------------------------------------------- /questions/00016-medium-pop/info.zh-CN.yml: -------------------------------------------------------------------------------- 1 | title: 排除最后一项 2 | -------------------------------------------------------------------------------- /questions/00016-medium-pop/template.ts: -------------------------------------------------------------------------------- 1 | type Pop = any 2 | -------------------------------------------------------------------------------- /questions/00016-medium-pop/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, [3, 2]>>, 5 | Expect, ['a', 'b', 'c']>>, 6 | Expect, []>>, 7 | ] 8 | -------------------------------------------------------------------------------- /questions/00017-hard-currying-1/info.pt-BR.yml: -------------------------------------------------------------------------------- 1 | title: Currying 1 2 | 3 | author: 4 | name: Anthony Fu 5 | email: hi@antfu.me 6 | github: antfu 7 | 8 | tags: array 9 | 10 | related: 14, 16, 462 11 | 12 | difficulty: difícil 13 | -------------------------------------------------------------------------------- /questions/00017-hard-currying-1/info.yml: -------------------------------------------------------------------------------- 1 | title: Currying 1 2 | 3 | author: 4 | name: Anthony Fu 5 | email: hi@antfu.me 6 | github: antfu 7 | 8 | tags: array 9 | 10 | related: 14, 16, 462 11 | 12 | difficulty: hard 13 | -------------------------------------------------------------------------------- /questions/00017-hard-currying-1/info.zh-CN.yml: -------------------------------------------------------------------------------- 1 | title: 柯里化 1 2 | -------------------------------------------------------------------------------- /questions/00017-hard-currying-1/template.ts: -------------------------------------------------------------------------------- 1 | declare function Currying(fn: any): any 2 | -------------------------------------------------------------------------------- /questions/00017-hard-currying-1/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | const curried1 = Currying((a: string, b: number, c: boolean) => true) 4 | const curried2 = Currying((a: string, b: number, c: boolean, d: boolean, e: boolean, f: string, g: boolean) => true) 5 | const curried3 = Currying(() => true) 6 | 7 | type cases = [ 8 | Expect (b: number) => (c: boolean) => true 11 | >>, 12 | Expect (b: number) => (c: boolean) => (d: boolean) => (e: boolean) => (f: string) => (g: boolean) => true 15 | >>, 16 | Expect true>>, 17 | ] 18 | -------------------------------------------------------------------------------- /questions/00018-easy-tuple-length/info.pt-BR.yml: -------------------------------------------------------------------------------- 1 | title: Comprimento de Tupla 2 | 3 | author: 4 | name: sinoon 5 | email: sinoon1218@gamil.com 6 | github: sinoon 7 | 8 | tags: tuple 9 | 10 | difficulty: fácil 11 | -------------------------------------------------------------------------------- /questions/00018-easy-tuple-length/info.yml: -------------------------------------------------------------------------------- 1 | title: Length of Tuple 2 | 3 | author: 4 | name: sinoon 5 | email: sinoon1218@gamil.com 6 | github: sinoon 7 | 8 | tags: tuple 9 | 10 | difficulty: easy 11 | -------------------------------------------------------------------------------- /questions/00018-easy-tuple-length/info.zh-CN.yml: -------------------------------------------------------------------------------- 1 | title: 获取元组长度 2 | -------------------------------------------------------------------------------- /questions/00018-easy-tuple-length/template.ts: -------------------------------------------------------------------------------- 1 | type Length = any 2 | -------------------------------------------------------------------------------- /questions/00018-easy-tuple-length/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | const tesla = ['tesla', 'model 3', 'model X', 'model Y'] as const 4 | const spaceX = ['FALCON 9', 'FALCON HEAVY', 'DRAGON', 'STARSHIP', 'HUMAN SPACEFLIGHT'] as const 5 | 6 | type cases = [ 7 | Expect, 4>>, 8 | Expect, 5>>, 9 | // @ts-expect-error 10 | Length<5>, 11 | // @ts-expect-error 12 | Length<'hello world'>, 13 | ] 14 | -------------------------------------------------------------------------------- /questions/00020-medium-promise-all/info.pt-BR.yml: -------------------------------------------------------------------------------- 1 | difficulty: médio 2 | 3 | title: Promise.all 4 | 5 | tags: array, promise 6 | 7 | author: 8 | github: antfu 9 | name: Anthony Fu 10 | -------------------------------------------------------------------------------- /questions/00020-medium-promise-all/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: Promise.all 3 | tags: array, promise 4 | author: 5 | github: antfu 6 | name: Anthony Fu 7 | -------------------------------------------------------------------------------- /questions/00020-medium-promise-all/template.ts: -------------------------------------------------------------------------------- 1 | declare function PromiseAll(values: any): any 2 | -------------------------------------------------------------------------------- /questions/00020-medium-promise-all/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | const promiseAllTest1 = PromiseAll([1, 2, 3] as const) 4 | const promiseAllTest2 = PromiseAll([1, 2, Promise.resolve(3)] as const) 5 | const promiseAllTest3 = PromiseAll([1, 2, Promise.resolve(3)]) 6 | const promiseAllTest4 = PromiseAll>>([1, 2, 3]) 7 | 8 | type cases = [ 9 | Expect>>, 10 | Expect>>, 11 | Expect>>, 12 | Expect>>, 13 | ] 14 | -------------------------------------------------------------------------------- /questions/00043-easy-exclude/info.pt-BR.yml: -------------------------------------------------------------------------------- 1 | difficulty: fácil 2 | title: Exclude 3 | author: 4 | github: zheeeng 5 | name: Zheeeng 6 | tags: built-in, union 7 | -------------------------------------------------------------------------------- /questions/00043-easy-exclude/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: easy 2 | title: Exclude 3 | author: 4 | github: zheeeng 5 | name: Zheeeng 6 | tags: built-in, union 7 | -------------------------------------------------------------------------------- /questions/00043-easy-exclude/info.zh-CN.yml: -------------------------------------------------------------------------------- 1 | title: 实现 Exclude 2 | -------------------------------------------------------------------------------- /questions/00043-easy-exclude/template.ts: -------------------------------------------------------------------------------- 1 | type MyExclude = any 2 | -------------------------------------------------------------------------------- /questions/00043-easy-exclude/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, 'b' | 'c'>>, 5 | Expect, 'c'>>, 6 | Expect void), Function>, string | number>>, 7 | ] 8 | -------------------------------------------------------------------------------- /questions/00055-hard-union-to-intersection/info.pt-BR.yml: -------------------------------------------------------------------------------- 1 | difficulty: difícil 2 | title: União para Interseção 3 | tags: 'utils, infer' 4 | author: 5 | github: zheeeng 6 | name: Zheeeng 7 | -------------------------------------------------------------------------------- /questions/00055-hard-union-to-intersection/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: hard 2 | title: Union to Intersection 3 | tags: 'utils, infer' 4 | author: 5 | github: zheeeng 6 | name: Zheeeng 7 | -------------------------------------------------------------------------------- /questions/00055-hard-union-to-intersection/info.zh-CN.yml: -------------------------------------------------------------------------------- 1 | title: 联合类型转化为交叉类型 2 | -------------------------------------------------------------------------------- /questions/00055-hard-union-to-intersection/template.ts: -------------------------------------------------------------------------------- 1 | type UnionToIntersection = any 2 | -------------------------------------------------------------------------------- /questions/00055-hard-union-to-intersection/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, 'foo' & 42 & true>>, 5 | Expect 'foo') | ((i: 42) => true)>, (() => 'foo') & ((i: 42) => true)>>, 6 | ] 7 | -------------------------------------------------------------------------------- /questions/00057-hard-get-required/info.pt-BR.yml: -------------------------------------------------------------------------------- 1 | difficulty: difícil 2 | title: Obter Obrigatório 3 | tags: utils, infer 4 | author: 5 | github: zheeeng 6 | name: Zheeeng 7 | 8 | related: 59 9 | -------------------------------------------------------------------------------- /questions/00057-hard-get-required/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: hard 2 | title: Get Required 3 | tags: utils, infer 4 | author: 5 | github: zheeeng 6 | name: Zheeeng 7 | 8 | related: 59 9 | -------------------------------------------------------------------------------- /questions/00057-hard-get-required/info.zh-CN.yml: -------------------------------------------------------------------------------- 1 | title: 获得必需的属性 2 | -------------------------------------------------------------------------------- /questions/00057-hard-get-required/template.ts: -------------------------------------------------------------------------------- 1 | type GetRequired = any 2 | -------------------------------------------------------------------------------- /questions/00057-hard-get-required/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, { foo: number }>>, 5 | Expect, { foo: undefined }>>, 6 | ] 7 | -------------------------------------------------------------------------------- /questions/00059-hard-get-optional/info.pt-BR.yml: -------------------------------------------------------------------------------- 1 | difficulty: difícil 2 | title: Obter Opcional 3 | tags: utils, infer 4 | author: 5 | github: zheeeng 6 | name: Zheeeng 7 | 8 | related: 57 9 | -------------------------------------------------------------------------------- /questions/00059-hard-get-optional/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: hard 2 | title: Get Optional 3 | tags: utils, infer 4 | author: 5 | github: zheeeng 6 | name: Zheeeng 7 | 8 | related: 57 9 | -------------------------------------------------------------------------------- /questions/00059-hard-get-optional/info.zh-CN.yml: -------------------------------------------------------------------------------- 1 | title: 获得可选属性 2 | -------------------------------------------------------------------------------- /questions/00059-hard-get-optional/template.ts: -------------------------------------------------------------------------------- 1 | type GetOptional = any 2 | -------------------------------------------------------------------------------- /questions/00059-hard-get-optional/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, { bar?: string }>>, 5 | Expect, { bar?: undefined }>>, 6 | ] 7 | -------------------------------------------------------------------------------- /questions/00062-medium-type-lookup/info.pt-BR.yml: -------------------------------------------------------------------------------- 1 | difficulty: médio 2 | title: Tipo Lookup 3 | tags: 'union, map' 4 | author: 5 | github: antfu 6 | name: Anthony Fu 7 | -------------------------------------------------------------------------------- /questions/00062-medium-type-lookup/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: Type Lookup 3 | tags: 'union, map' 4 | author: 5 | github: antfu 6 | name: Anthony Fu 7 | -------------------------------------------------------------------------------- /questions/00062-medium-type-lookup/info.zh-CN.yml: -------------------------------------------------------------------------------- 1 | title: 查找类型 2 | -------------------------------------------------------------------------------- /questions/00062-medium-type-lookup/template.ts: -------------------------------------------------------------------------------- 1 | type LookUp = any 2 | -------------------------------------------------------------------------------- /questions/00062-medium-type-lookup/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | interface Cat { 4 | type: 'cat' 5 | breeds: 'Abyssinian' | 'Shorthair' | 'Curl' | 'Bengal' 6 | } 7 | 8 | interface Dog { 9 | type: 'dog' 10 | breeds: 'Hound' | 'Brittany' | 'Bulldog' | 'Boxer' 11 | color: 'brown' | 'white' | 'black' 12 | } 13 | 14 | type Animal = Cat | Dog 15 | 16 | type cases = [ 17 | Expect, Dog>>, 18 | Expect, Cat>>, 19 | ] 20 | -------------------------------------------------------------------------------- /questions/00089-hard-required-keys/info.pt-BR.yml: -------------------------------------------------------------------------------- 1 | difficulty: difícil 2 | title: Chaves Obrigatórias 3 | tags: utils 4 | related: 5 5 | author: 6 | github: yi-tuan 7 | name: yituan 8 | -------------------------------------------------------------------------------- /questions/00089-hard-required-keys/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: hard 2 | title: Required Keys 3 | tags: utils 4 | related: 5 5 | author: 6 | github: yi-tuan 7 | name: yituan 8 | -------------------------------------------------------------------------------- /questions/00089-hard-required-keys/info.zh-CN.yml: -------------------------------------------------------------------------------- 1 | title: 必需的键 2 | -------------------------------------------------------------------------------- /questions/00089-hard-required-keys/template.ts: -------------------------------------------------------------------------------- 1 | type RequiredKeys = any 2 | -------------------------------------------------------------------------------- /questions/00089-hard-required-keys/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, 'a'>>, 5 | Expect, 'a'>>, 6 | Expect, 'a' | 'c' | 'd'>>, 7 | Expect, never>>, 8 | ] 9 | -------------------------------------------------------------------------------- /questions/00090-hard-optional-keys/info.pt-BR.yml: -------------------------------------------------------------------------------- 1 | difficulty: difícil 2 | title: Chaves Opcionais 3 | tags: utils 4 | related: '89, 5' 5 | author: 6 | github: yi-tuan 7 | name: yituan 8 | -------------------------------------------------------------------------------- /questions/00090-hard-optional-keys/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: hard 2 | title: Optional Keys 3 | tags: utils 4 | related: '89, 5' 5 | author: 6 | github: yi-tuan 7 | name: yituan 8 | -------------------------------------------------------------------------------- /questions/00090-hard-optional-keys/info.zh-CN.yml: -------------------------------------------------------------------------------- 1 | title: 可选类型的键 2 | -------------------------------------------------------------------------------- /questions/00090-hard-optional-keys/template.ts: -------------------------------------------------------------------------------- 1 | type OptionalKeys = any 2 | -------------------------------------------------------------------------------- /questions/00090-hard-optional-keys/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, 'b'>>, 5 | Expect, 'b'>>, 6 | Expect, 'b' | 'c' | 'd'>>, 7 | Expect, never>>, 8 | ] 9 | -------------------------------------------------------------------------------- /questions/00106-medium-trimleft/info.pt-BR.yml: -------------------------------------------------------------------------------- 1 | difficulty: médio 2 | title: Remover margem esquerda 3 | tags: template-literal 4 | author: 5 | github: antfu 6 | name: Anthony Fu 7 | 8 | related: 108, 4803 9 | -------------------------------------------------------------------------------- /questions/00106-medium-trimleft/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: Trim Left 3 | tags: template-literal 4 | author: 5 | github: antfu 6 | name: Anthony Fu 7 | 8 | related: 108, 4803 9 | -------------------------------------------------------------------------------- /questions/00106-medium-trimleft/info.zh-CN.yml: -------------------------------------------------------------------------------- 1 | title: 去除左侧空白 2 | -------------------------------------------------------------------------------- /questions/00106-medium-trimleft/template.ts: -------------------------------------------------------------------------------- 1 | type TrimLeft = any 2 | -------------------------------------------------------------------------------- /questions/00106-medium-trimleft/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, 'str'>>, 5 | Expect, 'str'>>, 6 | Expect, 'str'>>, 7 | Expect, 'str '>>, 8 | Expect, 'foo bar '>>, 9 | Expect, ''>>, 10 | Expect, ''>>, 11 | ] 12 | -------------------------------------------------------------------------------- /questions/00108-medium-trim/info.pt-BR.yml: -------------------------------------------------------------------------------- 1 | difficulty: mério 2 | title: Remover espaços em branco nas extremidades 3 | tags: template-literal 4 | author: 5 | github: antfu 6 | name: Anthony Fu 7 | 8 | related: 106, 4803 9 | -------------------------------------------------------------------------------- /questions/00108-medium-trim/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: Trim 3 | tags: template-literal 4 | author: 5 | github: antfu 6 | name: Anthony Fu 7 | 8 | related: 106, 4803 9 | -------------------------------------------------------------------------------- /questions/00108-medium-trim/info.zh-CN.yml: -------------------------------------------------------------------------------- 1 | title: 去除两端空白字符 2 | -------------------------------------------------------------------------------- /questions/00108-medium-trim/template.ts: -------------------------------------------------------------------------------- 1 | type Trim = any 2 | -------------------------------------------------------------------------------- /questions/00108-medium-trim/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, 'str'>>, 5 | Expect, 'str'>>, 6 | Expect, 'str'>>, 7 | Expect, 'str'>>, 8 | Expect, 'str'>>, 9 | Expect, 'foo bar'>>, 10 | Expect, ''>>, 11 | Expect, ''>>, 12 | ] 13 | -------------------------------------------------------------------------------- /questions/00110-medium-capitalize/info.pt-BR.yml: -------------------------------------------------------------------------------- 1 | difficulty: médio 2 | title: Capitalizar 3 | tags: template-literal 4 | author: 5 | github: antfu 6 | name: Anthony Fu 7 | -------------------------------------------------------------------------------- /questions/00110-medium-capitalize/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: Capitalize 3 | tags: template-literal 4 | author: 5 | github: antfu 6 | name: Anthony Fu 7 | -------------------------------------------------------------------------------- /questions/00110-medium-capitalize/template.ts: -------------------------------------------------------------------------------- 1 | type MyCapitalize = any 2 | -------------------------------------------------------------------------------- /questions/00112-hard-capitalizewords/info.pt-BR.yml: -------------------------------------------------------------------------------- 1 | difficulty: difícil 2 | title: Capitalizar Palavras 3 | tags: template-literal 4 | author: 5 | github: antfu 6 | name: Anthony Fu 7 | -------------------------------------------------------------------------------- /questions/00112-hard-capitalizewords/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: hard 2 | title: Capitalize Words 3 | tags: template-literal 4 | author: 5 | github: antfu 6 | name: Anthony Fu 7 | -------------------------------------------------------------------------------- /questions/00112-hard-capitalizewords/template.ts: -------------------------------------------------------------------------------- 1 | type CapitalizeWords = any 2 | -------------------------------------------------------------------------------- /questions/00112-hard-capitalizewords/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, 'Foobar'>>, 5 | Expect, 'FOOBAR'>>, 6 | Expect, 'Foo Bar'>>, 7 | Expect, 'Foo Bar Hello World'>>, 8 | Expect, 'Foo Bar.Hello,World'>>, 9 | Expect, 'Aa!Bb@Cc#Dd$Ee%Ff^Gg&Hh*Ii(Jj)Kk_Ll+Mm{Nn}Oo|Pp🤣Qq'>>, 10 | Expect, ''>>, 11 | ] 12 | -------------------------------------------------------------------------------- /questions/00114-hard-camelcase/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: hard 2 | title: CamelCase 3 | tags: template-literal 4 | author: 5 | github: antfu 6 | name: Anthony Fu 7 | 8 | related: 612 9 | -------------------------------------------------------------------------------- /questions/00114-hard-camelcase/template.ts: -------------------------------------------------------------------------------- 1 | type CamelCase = any 2 | -------------------------------------------------------------------------------- /questions/00114-hard-camelcase/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, 'foobar'>>, 5 | Expect, 'foobar'>>, 6 | Expect, 'fooBar'>>, 7 | Expect, 'foo_Bar'>>, 8 | Expect, 'foo_$bar'>>, 9 | Expect, 'fooBar_'>>, 10 | Expect, 'fooBar__'>>, 11 | Expect, 'fooBar_$'>>, 12 | Expect, 'fooBarHelloWorld'>>, 13 | Expect, 'helloWorldWithTypes'>>, 14 | Expect, '-'>>, 15 | Expect, ''>>, 16 | Expect, '😎'>>, 17 | ] 18 | -------------------------------------------------------------------------------- /questions/00116-medium-replace/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: Replace 3 | tags: template-literal 4 | author: 5 | github: antfu 6 | name: Anthony Fu 7 | -------------------------------------------------------------------------------- /questions/00116-medium-replace/template.ts: -------------------------------------------------------------------------------- 1 | type Replace = any 2 | -------------------------------------------------------------------------------- /questions/00116-medium-replace/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, 'foofoo'>>, 5 | Expect, 'foofoobar'>>, 6 | Expect, 'foobarbar'>>, 7 | Expect, 'foobar'>>, 8 | Expect, 'foobarbar'>>, 9 | Expect, ''>>, 10 | ] 11 | -------------------------------------------------------------------------------- /questions/00119-medium-replaceall/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: ReplaceAll 3 | tags: template-literal 4 | author: 5 | github: antfu 6 | name: Anthony Fu 7 | -------------------------------------------------------------------------------- /questions/00119-medium-replaceall/template.ts: -------------------------------------------------------------------------------- 1 | type ReplaceAll = any 2 | -------------------------------------------------------------------------------- /questions/00119-medium-replaceall/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, 'foofoo'>>, 5 | Expect, 'foobar'>>, 6 | Expect, 'foofoofoo'>>, 7 | Expect, 'types'>>, 8 | Expect, 'foobarbar'>>, 9 | Expect, 'foofoo'>>, 10 | Expect, 'fobarfobar'>>, 11 | Expect, 'foborfobar'>>, 12 | Expect, ''>>, 13 | ] 14 | -------------------------------------------------------------------------------- /questions/00147-hard-c-printf-parser/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: hard 2 | title: C-printf Parser 3 | tags: template-literal 4 | author: 5 | github: g-plane 6 | name: Pig Fang 7 | -------------------------------------------------------------------------------- /questions/00147-hard-c-printf-parser/template.ts: -------------------------------------------------------------------------------- 1 | type ControlsMap = { 2 | c: 'char' 3 | s: 'string' 4 | d: 'dec' 5 | o: 'oct' 6 | h: 'hex' 7 | f: 'float' 8 | p: 'pointer' 9 | } 10 | 11 | type ParsePrintFormat = any 12 | -------------------------------------------------------------------------------- /questions/00147-hard-c-printf-parser/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, []>>, 5 | Expect, []>>, 6 | Expect, ['dec']>>, 7 | Expect, []>>, 8 | Expect, ['dec']>>, 9 | Expect, ['float']>>, 10 | Expect, ['hex']>>, 11 | Expect, []>>, 12 | Expect, ['string', 'dec']>>, 13 | Expect, []>>, 14 | ] 15 | -------------------------------------------------------------------------------- /questions/00151-extreme-query-string-parser/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: extreme 2 | title: Query String Parser 3 | tags: template-literal 4 | author: 5 | github: g-plane 6 | name: Pig Fang 7 | -------------------------------------------------------------------------------- /questions/00151-extreme-query-string-parser/template.ts: -------------------------------------------------------------------------------- 1 | type ParseQueryString = any 2 | -------------------------------------------------------------------------------- /questions/00189-easy-awaited/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: easy 2 | title: Awaited 3 | tags: promise, built-in 4 | editor: 5 | github: sinoon 6 | name: sinoon 7 | author: 8 | github: maciejsikora 9 | name: Maciej Sikora 10 | -------------------------------------------------------------------------------- /questions/00189-easy-awaited/template.ts: -------------------------------------------------------------------------------- 1 | type MyAwaited = any 2 | -------------------------------------------------------------------------------- /questions/00189-easy-awaited/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type X = Promise 4 | type Y = Promise<{ field: number }> 5 | type Z = Promise> 6 | type Z1 = Promise>> 7 | type T = { then: (onfulfilled: (arg: number) => any) => any } 8 | 9 | type cases = [ 10 | Expect, string>>, 11 | Expect, { field: number }>>, 12 | Expect, string | number>>, 13 | Expect, string | boolean>>, 14 | Expect, number>>, 15 | ] 16 | 17 | // @ts-expect-error 18 | type error = MyAwaited 19 | -------------------------------------------------------------------------------- /questions/00191-medium-append-argument/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: Append Argument 3 | editor: 4 | github: sinoon 5 | name: sinoon 6 | author: 7 | github: maciejsikora 8 | name: Maciej Sikora 9 | tags: arguments 10 | -------------------------------------------------------------------------------- /questions/00191-medium-append-argument/info.zh-CN.yml: -------------------------------------------------------------------------------- 1 | title: 追加参数 2 | -------------------------------------------------------------------------------- /questions/00191-medium-append-argument/template.ts: -------------------------------------------------------------------------------- 1 | type AppendArgument = any 2 | -------------------------------------------------------------------------------- /questions/00191-medium-append-argument/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type Case1 = AppendArgument<(a: number, b: string) => number, boolean> 4 | type Result1 = (a: number, b: string, x: boolean) => number 5 | 6 | type Case2 = AppendArgument<() => void, undefined> 7 | type Result2 = (x: undefined) => void 8 | 9 | type cases = [ 10 | Expect>, 11 | Expect>, 12 | // @ts-expect-error 13 | AppendArgument, 14 | ] 15 | -------------------------------------------------------------------------------- /questions/00213-hard-vue-basic-props/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: hard 2 | title: Vue Basic Props 3 | tags: 'vue, application' 4 | related: 6 5 | author: 6 | github: antfu 7 | name: Anthony Fu 8 | -------------------------------------------------------------------------------- /questions/00213-hard-vue-basic-props/template.ts: -------------------------------------------------------------------------------- 1 | declare function VueBasicProps(options: any): any 2 | -------------------------------------------------------------------------------- /questions/00216-extreme-slice/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: extreme 2 | title: Slice 3 | tags: array 4 | author: 5 | github: antfu 6 | name: Anthony Fu 7 | -------------------------------------------------------------------------------- /questions/00216-extreme-slice/template.ts: -------------------------------------------------------------------------------- 1 | type Slice = any 2 | -------------------------------------------------------------------------------- /questions/00216-extreme-slice/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type Arr = [1, 2, 3, 4, 5] 4 | 5 | type cases = [ 6 | // basic 7 | Expect, [1]>>, 8 | Expect, []>>, 9 | Expect, [3, 4]>>, 10 | 11 | // optional args 12 | Expect, []>>, 13 | Expect, Arr>>, 14 | Expect, Arr>>, 15 | Expect, [3, 4, 5]>>, 16 | 17 | // negative index 18 | Expect, [1, 2, 3, 4]>>, 19 | Expect, [3, 4]>>, 20 | 21 | // invalid 22 | Expect, []>>, 23 | Expect, []>>, 24 | Expect, []>>, 25 | ] 26 | -------------------------------------------------------------------------------- /questions/00223-hard-isany/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: hard 2 | title: IsAny 3 | tags: utils 4 | author: 5 | github: pashutk 6 | name: Pavel Glushkov 7 | 8 | related: 1042, 1097, 4484 9 | -------------------------------------------------------------------------------- /questions/00223-hard-isany/template.ts: -------------------------------------------------------------------------------- 1 | type IsAny = any 2 | -------------------------------------------------------------------------------- /questions/00223-hard-isany/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, true>>, 5 | 6 | Expect, false>>, 7 | Expect, false>>, 8 | Expect, false>>, 9 | Expect, false>>, 10 | ] 11 | -------------------------------------------------------------------------------- /questions/00268-easy-if/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: easy 2 | title: If 3 | tags: utils 4 | author: 5 | github: pashutk 6 | name: Pavel Glushkov 7 | -------------------------------------------------------------------------------- /questions/00268-easy-if/template.ts: -------------------------------------------------------------------------------- 1 | type If = any 2 | -------------------------------------------------------------------------------- /questions/00268-easy-if/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, 'a'>>, 5 | Expect, 2>>, 6 | ] 7 | 8 | // @ts-expect-error 9 | type error = If 10 | -------------------------------------------------------------------------------- /questions/00270-hard-typed-get/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: hard 2 | title: Typed Get 3 | tags: 'utils, template-literal' 4 | author: 5 | github: antfu 6 | name: Anthony Fu 7 | -------------------------------------------------------------------------------- /questions/00270-hard-typed-get/template.ts: -------------------------------------------------------------------------------- 1 | type Get = string 2 | -------------------------------------------------------------------------------- /questions/00270-hard-typed-get/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, 'world'>>, 5 | Expect, 6>>, 6 | Expect, { value: 'foobar', count: 6 }>>, 7 | Expect, false>>, 8 | 9 | Expect, never>>, 10 | ] 11 | 12 | type Data = { 13 | foo: { 14 | bar: { 15 | value: 'foobar' 16 | count: 6 17 | } 18 | included: true 19 | } 20 | 'foo.baz': false 21 | hello: 'world' 22 | } 23 | -------------------------------------------------------------------------------- /questions/00274-extreme-integers-comparator/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: extreme 2 | title: Integers Comparator 3 | tags: template-literal, math 4 | author: 5 | github: g-plane 6 | name: Pig Fang 7 | -------------------------------------------------------------------------------- /questions/00274-extreme-integers-comparator/template.ts: -------------------------------------------------------------------------------- 1 | enum Comparison { 2 | Greater, 3 | Equal, 4 | Lower, 5 | } 6 | 7 | type Comparator = any 8 | -------------------------------------------------------------------------------- /questions/00296-medium-permutation/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: Permutation 3 | tags: union 4 | author: 5 | github: pandanoir 6 | name: Naoto Ikuno 7 | -------------------------------------------------------------------------------- /questions/00296-medium-permutation/template.ts: -------------------------------------------------------------------------------- 1 | type Permutation = any 2 | -------------------------------------------------------------------------------- /questions/00296-medium-permutation/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, ['A']>>, 5 | Expect, ['A', 'B', 'C'] | ['A', 'C', 'B'] | ['B', 'A', 'C'] | ['B', 'C', 'A'] | ['C', 'A', 'B'] | ['C', 'B', 'A']>>, 6 | Expect, ['A', 'B', 'C'] | ['A', 'C', 'B'] | ['B', 'A', 'C'] | ['B', 'C', 'A'] | ['C', 'A', 'B'] | ['C', 'B', 'A']>>, 7 | Expect, [false, true] | [true, false]>>, 8 | Expect, []>>, 9 | ] 10 | -------------------------------------------------------------------------------- /questions/00298-medium-length-of-string/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: Length of String 3 | tags: template-literal 4 | author: 5 | github: g-plane 6 | name: Pig Fang 7 | -------------------------------------------------------------------------------- /questions/00298-medium-length-of-string/template.ts: -------------------------------------------------------------------------------- 1 | type LengthOfString = any 2 | -------------------------------------------------------------------------------- /questions/00298-medium-length-of-string/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, 0>>, 5 | Expect, 6>>, 6 | Expect, 5>>, 7 | Expect, 16>>, 8 | ] 9 | -------------------------------------------------------------------------------- /questions/00300-hard-string-to-number/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: hard 2 | title: String to Number 3 | tags: template-literal 4 | author: 5 | github: g-plane 6 | name: Pig Fang 7 | -------------------------------------------------------------------------------- /questions/00300-hard-string-to-number/template.ts: -------------------------------------------------------------------------------- 1 | type ToNumber = any 2 | -------------------------------------------------------------------------------- /questions/00300-hard-string-to-number/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, 0>>, 5 | Expect, 5>>, 6 | Expect, 12>>, 7 | Expect, 27>>, 8 | Expect, never>>, 9 | ] 10 | -------------------------------------------------------------------------------- /questions/00399-hard-tuple-filter/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: hard 2 | title: Tuple Filter 3 | tags: 'tuple, infer' 4 | author: 5 | github: softoika 6 | name: Ryo Hanafusa 7 | -------------------------------------------------------------------------------- /questions/00399-hard-tuple-filter/template.ts: -------------------------------------------------------------------------------- 1 | type FilterOut = any 2 | -------------------------------------------------------------------------------- /questions/00399-hard-tuple-filter/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, []>>, 5 | Expect, []>>, 6 | Expect, ['a']>>, 7 | Expect, [1, 'a']>>, 8 | Expect, [1, 'a', false]>>, 9 | Expect, [number | null | undefined]>>, 10 | ] 11 | -------------------------------------------------------------------------------- /questions/00459-medium-flatten/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: Flatten 3 | tags: array 4 | author: 5 | github: chbro 6 | name: zhouyiming 7 | -------------------------------------------------------------------------------- /questions/00459-medium-flatten/template.ts: -------------------------------------------------------------------------------- 1 | type Flatten = any 2 | -------------------------------------------------------------------------------- /questions/00459-medium-flatten/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, []>>, 5 | Expect, [1, 2, 3, 4]>>, 6 | Expect, [1, 2]>>, 7 | Expect, [1, 2, 3, 4, 5]>>, 8 | Expect, [{ foo: 'bar', 2: 10 }, 'foobar']>>, 9 | ] 10 | 11 | // @ts-expect-error 12 | type error = Flatten<'1'> 13 | -------------------------------------------------------------------------------- /questions/00462-extreme-currying-2/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: extreme 2 | title: Currying 2 3 | author: 4 | github: hubvue 5 | name: Kim 6 | related: 17 7 | -------------------------------------------------------------------------------- /questions/00462-extreme-currying-2/info.zh-CN.yml: -------------------------------------------------------------------------------- 1 | title: 柯里化 2 2 | -------------------------------------------------------------------------------- /questions/00462-extreme-currying-2/template.ts: -------------------------------------------------------------------------------- 1 | declare function DynamicParamsCurrying(fn: any): any 2 | -------------------------------------------------------------------------------- /questions/00472-hard-tuple-to-enum-object/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: hard 2 | title: Tuple to Enum Object 3 | tags: 'tuple, template-literal' 4 | author: 5 | github: softoika 6 | name: Ryo Hanafusa 7 | 8 | related: 10, 11, 730, 3188 9 | -------------------------------------------------------------------------------- /questions/00472-hard-tuple-to-enum-object/template.ts: -------------------------------------------------------------------------------- 1 | type Enum = any 2 | -------------------------------------------------------------------------------- /questions/00476-extreme-sum/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: extreme 2 | title: Sum 3 | tags: 'math, template-literal' 4 | author: 5 | github: uid11 6 | name: null 7 | -------------------------------------------------------------------------------- /questions/00476-extreme-sum/template.ts: -------------------------------------------------------------------------------- 1 | type Sum = string 2 | -------------------------------------------------------------------------------- /questions/00476-extreme-sum/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, '5'>>, 5 | Expect, '34'>>, 6 | Expect, '335'>>, 7 | Expect, '1000000000123'>>, 8 | Expect, '10000'>>, 9 | Expect, '4364766'>>, 10 | Expect, '728'>>, 11 | Expect, '213'>>, 12 | Expect, '0'>>, 13 | ] 14 | -------------------------------------------------------------------------------- /questions/00517-extreme-multiply/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: extreme 2 | title: Multiply 3 | tags: 'math, template-literal' 4 | related: 476 5 | author: 6 | github: uid11 7 | name: null 8 | -------------------------------------------------------------------------------- /questions/00517-extreme-multiply/template.ts: -------------------------------------------------------------------------------- 1 | type Multiply = string 2 | -------------------------------------------------------------------------------- /questions/00517-extreme-multiply/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, '6'>>, 5 | Expect, '15'>>, 6 | Expect, '40'>>, 7 | Expect, '0'>>, 8 | Expect, '273'>>, 9 | Expect, '13962361689'>>, 10 | Expect, '9999'>>, 11 | Expect, '170985150488'>>, 12 | Expect, '100000'>>, 13 | Expect, '2363474715'>>, 14 | Expect, '891'>>, 15 | Expect, '31500'>>, 16 | Expect, '143'>>, 17 | Expect, '0'>>, 18 | Expect, '0'>>, 19 | Expect, '0'>>, 20 | ] 21 | -------------------------------------------------------------------------------- /questions/00527-medium-append-to-object/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: Append to object 3 | tags: object-keys 4 | author: 5 | github: bre30kra69cs 6 | name: Andrey Krasovsky 7 | -------------------------------------------------------------------------------- /questions/00527-medium-append-to-object/template.ts: -------------------------------------------------------------------------------- 1 | type AppendToObject = any 2 | -------------------------------------------------------------------------------- /questions/00529-medium-absolute/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: Absolute 3 | tags: 'math, template-literal' 4 | author: 5 | github: bre30kra69cs 6 | name: Andrey Krasovsky 7 | -------------------------------------------------------------------------------- /questions/00529-medium-absolute/template.ts: -------------------------------------------------------------------------------- 1 | type Absolute = any 2 | -------------------------------------------------------------------------------- /questions/00529-medium-absolute/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, '0'>>, 5 | Expect, '0'>>, 6 | Expect, '10'>>, 7 | Expect, '5'>>, 8 | Expect, '0'>>, 9 | Expect, '0'>>, 10 | Expect, '10'>>, 11 | Expect, '5'>>, 12 | Expect, '1000000'>>, 13 | Expect, '9999'>>, 14 | ] 15 | -------------------------------------------------------------------------------- /questions/00531-medium-string-to-union/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: String to Union 3 | tags: 'union, string' 4 | author: 5 | github: bre30kra69cs 6 | name: Andrey Krasovsky 7 | -------------------------------------------------------------------------------- /questions/00531-medium-string-to-union/template.ts: -------------------------------------------------------------------------------- 1 | type StringToUnion = any 2 | -------------------------------------------------------------------------------- /questions/00531-medium-string-to-union/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, never>>, 5 | Expect, 't'>>, 6 | Expect, 'h' | 'e' | 'l' | 'l' | 'o'>>, 7 | Expect, 'c' | 'o' | 'r' | 'o' | 'n' | 'a' | 'v' | 'i' | 'r' | 'u' | 's'>>, 8 | ] 9 | -------------------------------------------------------------------------------- /questions/00533-easy-concat/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: easy 2 | title: Concat 3 | tags: array 4 | author: 5 | github: bre30kra69cs 6 | name: Andrey Krasovsky 7 | 8 | related: 3057, 3060 9 | -------------------------------------------------------------------------------- /questions/00533-easy-concat/template.ts: -------------------------------------------------------------------------------- 1 | type Concat = any 2 | -------------------------------------------------------------------------------- /questions/00533-easy-concat/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | const tuple = [1] as const 4 | 5 | type cases = [ 6 | Expect, []>>, 7 | Expect, [1]>>, 8 | Expect, [1, 1]>>, 9 | Expect, [1, 2, 3, 4]>>, 10 | Expect, ['1', 2, '3', false, boolean, '4']>>, 11 | ] 12 | 13 | // @ts-expect-error 14 | type error = Concat 15 | -------------------------------------------------------------------------------- /questions/00545-hard-printf/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: hard 2 | title: printf 3 | tags: template-literal 4 | author: 5 | github: Bestmain-YS 6 | name: null 7 | -------------------------------------------------------------------------------- /questions/00545-hard-printf/template.ts: -------------------------------------------------------------------------------- 1 | type Format = any 2 | -------------------------------------------------------------------------------- /questions/00545-hard-printf/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, string>>, 5 | Expect, (s1: string) => string>>, 6 | Expect, (d1: number) => string>>, 7 | Expect, string>>, 8 | Expect, (d1: number) => string>>, 9 | Expect, (d1: number) => (s1: string) => string>>, 10 | ] 11 | -------------------------------------------------------------------------------- /questions/00553-hard-deep-object-to-unique/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: hard 2 | title: Deep object to unique 3 | tags: deep 4 | author: 5 | github: uid11 6 | name: null 7 | -------------------------------------------------------------------------------- /questions/00553-hard-deep-object-to-unique/template.ts: -------------------------------------------------------------------------------- 1 | type DeepObjectToUniq = any 2 | -------------------------------------------------------------------------------- /questions/00599-medium-merge/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: Merge 3 | tags: object 4 | author: 5 | github: ZYSzys 6 | name: ZYSzys 7 | -------------------------------------------------------------------------------- /questions/00599-medium-merge/template.ts: -------------------------------------------------------------------------------- 1 | type Merge = any 2 | -------------------------------------------------------------------------------- /questions/00599-medium-merge/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type Foo = { 4 | a: number 5 | b: string 6 | } 7 | type Bar = { 8 | b: number 9 | c: boolean 10 | } 11 | 12 | type cases = [ 13 | Expect, { 14 | a: number 15 | b: number 16 | c: boolean 17 | }>>, 18 | ] 19 | -------------------------------------------------------------------------------- /questions/00612-medium-kebabcase/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: KebabCase 3 | tags: template-literal 4 | author: 5 | github: johnsoncodehk 6 | name: Johnson Chu 7 | 8 | related: 114 9 | -------------------------------------------------------------------------------- /questions/00612-medium-kebabcase/template.ts: -------------------------------------------------------------------------------- 1 | type KebabCase = any 2 | -------------------------------------------------------------------------------- /questions/00612-medium-kebabcase/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, 'foo-bar-baz'>>, 5 | Expect, 'foo-bar-baz'>>, 6 | Expect, 'foo-bar'>>, 7 | Expect, 'foo_bar'>>, 8 | Expect, 'foo--bar'>>, 9 | Expect, 'a-b-c'>>, 10 | Expect, '-'>>, 11 | Expect, ''>>, 12 | Expect, '😎'>>, 13 | ] 14 | -------------------------------------------------------------------------------- /questions/00645-medium-diff/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: Diff 3 | tags: object 4 | author: 5 | github: ZYSzys 6 | name: ZYSzys 7 | -------------------------------------------------------------------------------- /questions/00645-medium-diff/template.ts: -------------------------------------------------------------------------------- 1 | type Diff = any 2 | -------------------------------------------------------------------------------- /questions/00645-medium-diff/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type Foo = { 4 | name: string 5 | age: string 6 | } 7 | type Bar = { 8 | name: string 9 | age: string 10 | gender: number 11 | } 12 | type Coo = { 13 | name: string 14 | gender: number 15 | } 16 | 17 | type cases = [ 18 | Expect, { gender: number }>>, 19 | Expect, { gender: number }>>, 20 | Expect, { age: string, gender: number }>>, 21 | Expect, { age: string, gender: number }>>, 22 | ] 23 | -------------------------------------------------------------------------------- /questions/00651-hard-length-of-string-2/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: hard 2 | title: Length of String 2 3 | tags: template-literal 4 | related: 298 5 | author: 6 | github: uid11 7 | name: null 8 | -------------------------------------------------------------------------------- /questions/00651-hard-length-of-string-2/template.ts: -------------------------------------------------------------------------------- 1 | type LengthOfString = number 2 | -------------------------------------------------------------------------------- /questions/00697-extreme-tag/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: extreme 2 | title: Tag 3 | author: 4 | github: uid11 5 | name: null 6 | -------------------------------------------------------------------------------- /questions/00697-extreme-tag/template.ts: -------------------------------------------------------------------------------- 1 | type GetTags = any 2 | 3 | type Tag = any 4 | 5 | type UnTag = any 6 | 7 | type HasTag = any 8 | type HasTags = any 9 | type HasExactTags = any 10 | -------------------------------------------------------------------------------- /questions/00730-hard-union-to-tuple/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: hard 2 | title: Union to Tuple 3 | tags: union, tuple, infer 4 | author: 5 | github: suica 6 | name: Sg 7 | 8 | related: 10, 11, 55, 472, 3188 9 | -------------------------------------------------------------------------------- /questions/00730-hard-union-to-tuple/template.ts: -------------------------------------------------------------------------------- 1 | type UnionToTuple = any 2 | -------------------------------------------------------------------------------- /questions/00734-extreme-inclusive-range/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: extreme 2 | title: Inclusive Range 3 | tags: infer, array 4 | author: 5 | github: suica 6 | name: Sg 7 | -------------------------------------------------------------------------------- /questions/00734-extreme-inclusive-range/template.ts: -------------------------------------------------------------------------------- 1 | type InclusiveRange = any 2 | -------------------------------------------------------------------------------- /questions/00741-extreme-sort/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: extreme 2 | title: Sort 3 | tags: infer, array 4 | author: 5 | github: suica 6 | name: Sg 7 | -------------------------------------------------------------------------------- /questions/00741-extreme-sort/template.ts: -------------------------------------------------------------------------------- 1 | type Sort = any 2 | -------------------------------------------------------------------------------- /questions/00847-hard-string-join/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: hard 2 | title: String Join 3 | author: 4 | github: tl-matt-davis 5 | name: Matt Davis 6 | -------------------------------------------------------------------------------- /questions/00847-hard-string-join/template.ts: -------------------------------------------------------------------------------- 1 | declare function join(delimiter: any): (...parts: any[]) => any 2 | -------------------------------------------------------------------------------- /questions/00847-hard-string-join/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | // Edge cases 4 | const noCharsOutput = join('-')() 5 | const oneCharOutput = join('-')('a') 6 | const noDelimiterOutput = join('')('a', 'b', 'c') 7 | 8 | // Regular cases 9 | const hyphenOutput = join('-')('a', 'b', 'c') 10 | const hashOutput = join('#')('a', 'b', 'c') 11 | const twoCharOutput = join('-')('a', 'b') 12 | const longOutput = join('-')('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h') 13 | 14 | type cases = [ 15 | Expect>, 16 | Expect>, 17 | Expect>, 18 | Expect>, 19 | Expect>, 20 | Expect>, 21 | Expect>, 22 | ] 23 | -------------------------------------------------------------------------------- /questions/00869-extreme-distributeunions/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: extreme 2 | title: DistributeUnions 3 | author: 4 | github: gvergnaud 5 | name: Gabriel Vergnaud 6 | -------------------------------------------------------------------------------- /questions/00869-extreme-distributeunions/template.ts: -------------------------------------------------------------------------------- 1 | type DistributeUnions = any 2 | -------------------------------------------------------------------------------- /questions/00898-easy-includes/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: easy 2 | title: Includes 3 | tags: array 4 | author: 5 | github: kynefuk 6 | name: null 7 | -------------------------------------------------------------------------------- /questions/00898-easy-includes/template.ts: -------------------------------------------------------------------------------- 1 | type Includes = any 2 | -------------------------------------------------------------------------------- /questions/00925-extreme-assert-array-index/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: extreme 2 | title: Assert Array Index 3 | tags: array 4 | tsconfig: 5 | noUncheckedIndexedAccess: true 6 | author: 7 | github: uid11 8 | name: null 9 | -------------------------------------------------------------------------------- /questions/00925-extreme-assert-array-index/template.ts: -------------------------------------------------------------------------------- 1 | function assertArrayIndex(array: readonly unknown[], key: string) {} 2 | 3 | type Index = any 4 | -------------------------------------------------------------------------------- /questions/00949-medium-anyof/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: AnyOf 3 | tags: array 4 | author: 5 | github: kynefuk 6 | name: null 7 | -------------------------------------------------------------------------------- /questions/00949-medium-anyof/template.ts: -------------------------------------------------------------------------------- 1 | type AnyOf = any 2 | -------------------------------------------------------------------------------- /questions/00949-medium-anyof/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, true>>, 5 | Expect, true>>, 6 | Expect, true>>, 7 | Expect, true>>, 8 | Expect, true>>, 9 | Expect, true>>, 10 | Expect, true>>, 11 | Expect, true>>, 12 | Expect, false>>, 13 | Expect, false>>, 14 | ] 15 | -------------------------------------------------------------------------------- /questions/00956-hard-deeppick/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: hard 2 | title: DeepPick 3 | tags: deep 4 | author: 5 | github: hiroyaiizuka 6 | name: hiroya iizuka 7 | -------------------------------------------------------------------------------- /questions/00956-hard-deeppick/template.ts: -------------------------------------------------------------------------------- 1 | type DeepPick = any 2 | -------------------------------------------------------------------------------- /questions/00956-hard-deeppick/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type Obj = { 4 | a: number 5 | b: string 6 | c: boolean 7 | obj: { 8 | d: number 9 | e: string 10 | f: boolean 11 | obj2: { 12 | g: number 13 | h: string 14 | i: boolean 15 | } 16 | } 17 | obj3: { 18 | j: number 19 | k: string 20 | l: boolean 21 | } 22 | } 23 | 24 | type cases = [ 25 | Expect, unknown>>, 26 | Expect, { a: number }>>, 27 | Expect, { a: number } & unknown>>, 28 | Expect, { a: number } & { obj: { e: string } }>>, 29 | Expect, { a: number } & { obj: { e: string } } & { obj: { obj2: { i: boolean } } }>>, 30 | ] 31 | -------------------------------------------------------------------------------- /questions/01042-medium-isnever/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: IsNever 3 | tags: union, utils 4 | author: 5 | github: hiroyaiizuka 6 | name: hiroya iizuka 7 | 8 | related: 1097, 223, 4484 9 | -------------------------------------------------------------------------------- /questions/01042-medium-isnever/template.ts: -------------------------------------------------------------------------------- 1 | type IsNever = any 2 | -------------------------------------------------------------------------------- /questions/01042-medium-isnever/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, true>>, 5 | Expect, false>>, 6 | Expect, false>>, 7 | Expect, false>>, 8 | Expect, false>>, 9 | Expect, false>>, 10 | Expect, false>>, 11 | ] 12 | -------------------------------------------------------------------------------- /questions/01097-medium-isunion/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: IsUnion 3 | author: 4 | github: bencor 5 | name: null 6 | 7 | related: 1042, 223, 4484 8 | tags: union 9 | -------------------------------------------------------------------------------- /questions/01097-medium-isunion/template.ts: -------------------------------------------------------------------------------- 1 | type IsUnion = any 2 | -------------------------------------------------------------------------------- /questions/01097-medium-isunion/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, false>>, 5 | Expect, true>>, 6 | Expect, true>>, 7 | Expect, true>>, 8 | Expect, true>>, 9 | Expect, false>>, 10 | Expect, false>>, 11 | // Cases where T resolves to a non-union type. 12 | Expect, false>>, 13 | Expect, false>>, 14 | Expect, false>>, 15 | Expect, false>>, 16 | Expect, false>>, 17 | ] 18 | -------------------------------------------------------------------------------- /questions/01130-medium-replacekeys/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: ReplaceKeys 3 | author: 4 | github: lullabyjune 5 | name: 贱贱 6 | tags: object-keys 7 | -------------------------------------------------------------------------------- /questions/01130-medium-replacekeys/template.ts: -------------------------------------------------------------------------------- 1 | type ReplaceKeys = any 2 | -------------------------------------------------------------------------------- /questions/01290-hard-pinia/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: hard 2 | title: Pinia 3 | tags: this, vue 4 | author: 5 | github: g-plane 6 | name: Pig Fang 7 | -------------------------------------------------------------------------------- /questions/01290-hard-pinia/template.ts: -------------------------------------------------------------------------------- 1 | declare function defineStore(store: unknown): unknown 2 | -------------------------------------------------------------------------------- /questions/01367-medium-remove-index-signature/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: Remove Index Signature 3 | author: 4 | github: hiroyaiizuka 5 | name: hiroya iizuka 6 | tags: object-keys 7 | -------------------------------------------------------------------------------- /questions/01367-medium-remove-index-signature/template.ts: -------------------------------------------------------------------------------- 1 | type RemoveIndexSignature = any 2 | -------------------------------------------------------------------------------- /questions/01367-medium-remove-index-signature/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type Foo = { 4 | [key: string]: any 5 | foo(): void 6 | } 7 | 8 | type Bar = { 9 | [key: number]: any 10 | bar(): void 11 | 0: string 12 | } 13 | 14 | const foobar = Symbol('foobar') 15 | type FooBar = { 16 | [key: symbol]: any 17 | [foobar](): void 18 | } 19 | 20 | type Baz = { 21 | bar(): void 22 | baz: string 23 | } 24 | 25 | type cases = [ 26 | Expect, { foo(): void }>>, 27 | Expect, { bar(): void, 0: string }>>, 28 | Expect, { [foobar](): void }>>, 29 | Expect, { bar(): void, baz: string }>>, 30 | ] 31 | -------------------------------------------------------------------------------- /questions/01383-hard-camelize/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: hard 2 | title: Camelize 3 | tags: union, recursion 4 | author: 5 | github: denchiklut 6 | name: Denis 7 | -------------------------------------------------------------------------------- /questions/01383-hard-camelize/template.ts: -------------------------------------------------------------------------------- 1 | type Camelize = any 2 | -------------------------------------------------------------------------------- /questions/01383-hard-camelize/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, 14 | { 15 | someProp: string 16 | prop: { anotherProp: string } 17 | array: [ 18 | { snakeCase: string }, 19 | { anotherElement: { yetAnotherProp: string } }, 20 | { yetAnotherElement: string }, 21 | ] 22 | } 23 | >>, 24 | ] 25 | -------------------------------------------------------------------------------- /questions/01978-medium-percentage-parser/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: Percentage Parser 3 | author: 4 | github: SSShuai1999 5 | name: SSShuai1999 6 | tags: template-literal 7 | -------------------------------------------------------------------------------- /questions/01978-medium-percentage-parser/template.ts: -------------------------------------------------------------------------------- 1 | type PercentageParser = any 2 | -------------------------------------------------------------------------------- /questions/02059-hard-drop-string/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: hard 2 | title: Drop String 3 | tags: template-literal, infer 4 | author: 5 | github: CaptainOfPhB 6 | name: CaptainOfPhB 7 | 8 | related: 2070 9 | -------------------------------------------------------------------------------- /questions/02059-hard-drop-string/template.ts: -------------------------------------------------------------------------------- 1 | type DropString = any 2 | -------------------------------------------------------------------------------- /questions/02059-hard-drop-string/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, 'butter fly!'>>, 5 | Expect, 'butterfly!'>>, 6 | Expect, 'er fly!'>>, 7 | Expect, ' e r f l y ! '>>, 8 | Expect, 'butterfly!'>>, 9 | Expect, 'butterfly!'>>, 10 | Expect, ' e r f l y ! '>>, 11 | Expect, ' e r f l y ! '>>, 12 | Expect, ' u t t e r f l y ! '>>, 13 | Expect, ' b u e r f l y ! '>>, 14 | ] 15 | -------------------------------------------------------------------------------- /questions/02070-medium-drop-char/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: Drop Char 3 | tags: template-literal, infer 4 | author: 5 | github: CaptainOfPhB 6 | name: CaptainOfPhB 7 | 8 | related: 2059 9 | -------------------------------------------------------------------------------- /questions/02070-medium-drop-char/template.ts: -------------------------------------------------------------------------------- 1 | type DropChar = any 2 | -------------------------------------------------------------------------------- /questions/02070-medium-drop-char/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | // @ts-expect-error 5 | Expect, 'butterfly!'>>, 6 | Expect, 'butterfly!'>>, 7 | Expect, 'butter fly'>>, 8 | Expect, 'butterfly!'>>, 9 | Expect, 'butterfly!'>>, 10 | Expect, ' u t t e r f l y ! '>>, 11 | Expect, ' b u e r f l y ! '>>, 12 | ] 13 | -------------------------------------------------------------------------------- /questions/02257-medium-minusone/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: MinusOne 3 | tags: math 4 | author: 5 | github: fayzzzm 6 | name: Mustafo Faiz 7 | -------------------------------------------------------------------------------- /questions/02257-medium-minusone/template.ts: -------------------------------------------------------------------------------- 1 | type MinusOne = any 2 | -------------------------------------------------------------------------------- /questions/02257-medium-minusone/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, 0>>, 5 | Expect, 54>>, 6 | Expect, 2>>, 7 | Expect, 99>>, 8 | Expect, 1100>>, 9 | Expect, -1>>, 10 | Expect, 9_007_199_254_740_991>>, 11 | ] 12 | -------------------------------------------------------------------------------- /questions/02595-medium-pickbytype/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: PickByType 3 | tags: object 4 | author: 5 | github: jiangshanmeta 6 | name: jiangshan 7 | 8 | related: 2852 9 | -------------------------------------------------------------------------------- /questions/02595-medium-pickbytype/template.ts: -------------------------------------------------------------------------------- 1 | type PickByType = any 2 | -------------------------------------------------------------------------------- /questions/02595-medium-pickbytype/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | interface Model { 4 | name: string 5 | count: number 6 | isReadonly: boolean 7 | isEnable: boolean 8 | } 9 | 10 | type cases = [ 11 | Expect, { isReadonly: boolean, isEnable: boolean }>>, 12 | Expect, { name: string }>>, 13 | Expect, { count: number }>>, 14 | ] 15 | -------------------------------------------------------------------------------- /questions/02688-medium-startswith/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: StartsWith 3 | tags: template-literal 4 | author: 5 | github: jiangshanmeta 6 | name: jiangshan 7 | 8 | related: 2693 9 | -------------------------------------------------------------------------------- /questions/02688-medium-startswith/template.ts: -------------------------------------------------------------------------------- 1 | type StartsWith = any 2 | -------------------------------------------------------------------------------- /questions/02688-medium-startswith/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, false>>, 5 | Expect, true>>, 6 | Expect, true>>, 7 | Expect, false>>, 8 | Expect, true>>, 9 | Expect, false>>, 10 | Expect, true>>, 11 | ] 12 | -------------------------------------------------------------------------------- /questions/02693-medium-endswith/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: EndsWith 3 | tags: template-literal 4 | author: 5 | github: jiangshanmeta 6 | name: jiangshan 7 | 8 | related: 2688 9 | -------------------------------------------------------------------------------- /questions/02693-medium-endswith/template.ts: -------------------------------------------------------------------------------- 1 | type EndsWith = any 2 | -------------------------------------------------------------------------------- /questions/02693-medium-endswith/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, true>>, 5 | Expect, true>>, 6 | Expect, false>>, 7 | Expect, false>>, 8 | Expect, true>>, 9 | Expect, false>>, 10 | ] 11 | -------------------------------------------------------------------------------- /questions/02757-medium-partialbykeys/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: PartialByKeys 3 | tags: object 4 | author: 5 | github: jiangshanmeta 6 | name: jiangshan 7 | -------------------------------------------------------------------------------- /questions/02757-medium-partialbykeys/template.ts: -------------------------------------------------------------------------------- 1 | type PartialByKeys = any 2 | -------------------------------------------------------------------------------- /questions/02757-medium-partialbykeys/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | interface User { 4 | name: string 5 | age: number 6 | address: string 7 | } 8 | 9 | interface UserPartialName { 10 | name?: string 11 | age: number 12 | address: string 13 | } 14 | 15 | interface UserPartialNameAndAge { 16 | name?: string 17 | age?: number 18 | address: string 19 | } 20 | 21 | type cases = [ 22 | Expect, UserPartialName>>, 23 | Expect, UserPartialNameAndAge>>, 24 | Expect, Partial>>, 25 | // @ts-expect-error 26 | Expect, UserPartialName>>, 27 | ] 28 | -------------------------------------------------------------------------------- /questions/02759-medium-requiredbykeys/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: RequiredByKeys 3 | tags: object 4 | author: 5 | github: jiangshanmeta 6 | name: jiangshan 7 | -------------------------------------------------------------------------------- /questions/02759-medium-requiredbykeys/template.ts: -------------------------------------------------------------------------------- 1 | type RequiredByKeys = any 2 | -------------------------------------------------------------------------------- /questions/02759-medium-requiredbykeys/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | interface User { 4 | name?: string 5 | age?: number 6 | address?: string 7 | } 8 | 9 | interface UserRequiredName { 10 | name: string 11 | age?: number 12 | address?: string 13 | } 14 | 15 | interface UserRequiredNameAndAge { 16 | name: string 17 | age: number 18 | address?: string 19 | } 20 | 21 | type cases = [ 22 | Expect, UserRequiredName>>, 23 | Expect, UserRequiredNameAndAge>>, 24 | Expect, Required>>, 25 | // @ts-expect-error 26 | Expect, UserRequiredName>>, 27 | ] 28 | -------------------------------------------------------------------------------- /questions/02793-medium-mutable/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: Mutable 3 | tags: readonly, object-keys 4 | author: 5 | github: jiangshanmeta 6 | name: jiangshan 7 | -------------------------------------------------------------------------------- /questions/02793-medium-mutable/template.ts: -------------------------------------------------------------------------------- 1 | type Mutable = any 2 | -------------------------------------------------------------------------------- /questions/02793-medium-mutable/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | interface Todo1 { 4 | title: string 5 | description: string 6 | completed: boolean 7 | meta: { 8 | author: string 9 | } 10 | } 11 | 12 | type List = [1, 2, 3] 13 | 14 | type cases = [ 15 | Expect>, Todo1>>, 16 | Expect>, List>>, 17 | ] 18 | 19 | type errors = [ 20 | // @ts-expect-error 21 | Mutable<'string'>, 22 | // @ts-expect-error 23 | Mutable<0>, 24 | ] 25 | -------------------------------------------------------------------------------- /questions/02822-hard-split/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: hard 2 | title: Split 3 | tags: string,split,array,tuple 4 | author: 5 | github: jfet97 6 | name: Andrea Simone Costa 7 | -------------------------------------------------------------------------------- /questions/02822-hard-split/template.ts: -------------------------------------------------------------------------------- 1 | type Split = any 2 | -------------------------------------------------------------------------------- /questions/02822-hard-split/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, ['Hi! How are you?']>>, 5 | Expect, ['Hi! How are you?']>>, 6 | Expect, ['Hi!', 'How', 'are', 'you?']>>, 7 | Expect, ['H', 'i', '!', ' ', 'H', 'o', 'w', ' ', 'a', 'r', 'e', ' ', 'y', 'o', 'u', '?']>>, 8 | Expect, []>>, 9 | Expect, ['The s', 'e ', ' cos', 'e']>>, 10 | Expect, ['Ne', ' say ne', ', fore', ' and e', '.']>>, 11 | Expect, ['']>>, 12 | Expect, ['']>>, 13 | Expect, string[]>>, 14 | ] 15 | -------------------------------------------------------------------------------- /questions/02828-hard-classpublickeys/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: hard 2 | title: ClassPublicKeys 3 | tags: utils 4 | author: 5 | github: jiangshanmeta 6 | name: jiangshan 7 | -------------------------------------------------------------------------------- /questions/02828-hard-classpublickeys/template.ts: -------------------------------------------------------------------------------- 1 | type ClassPublicKeys = any 2 | -------------------------------------------------------------------------------- /questions/02828-hard-classpublickeys/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | class A { 4 | public str: string 5 | protected num: number 6 | private bool: boolean 7 | constructor() { 8 | this.str = 'naive' 9 | this.num = 19260917 10 | this.bool = true 11 | } 12 | 13 | getNum() { 14 | return Math.random() 15 | } 16 | } 17 | 18 | type cases = [ 19 | Expect, 'str' | 'getNum'>>, 20 | ] 21 | -------------------------------------------------------------------------------- /questions/02852-medium-omitbytype/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: OmitByType 3 | tags: object 4 | author: 5 | github: jiangshanmeta 6 | name: jiangshan 7 | 8 | related: 2595 9 | -------------------------------------------------------------------------------- /questions/02852-medium-omitbytype/template.ts: -------------------------------------------------------------------------------- 1 | type OmitByType = any 2 | -------------------------------------------------------------------------------- /questions/02852-medium-omitbytype/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | interface Model { 4 | name: string 5 | count: number 6 | isReadonly: boolean 7 | isEnable: boolean 8 | } 9 | 10 | type cases = [ 11 | Expect, { name: string, count: number }>>, 12 | Expect, { count: number, isReadonly: boolean, isEnable: boolean }>>, 13 | Expect, { name: string, isReadonly: boolean, isEnable: boolean }>>, 14 | ] 15 | -------------------------------------------------------------------------------- /questions/02857-hard-isrequiredkey/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: hard 2 | title: IsRequiredKey 3 | tags: utils 4 | author: 5 | github: jiangshanmeta 6 | name: jiangshan 7 | -------------------------------------------------------------------------------- /questions/02857-hard-isrequiredkey/template.ts: -------------------------------------------------------------------------------- 1 | type IsRequiredKey = any 2 | -------------------------------------------------------------------------------- /questions/02857-hard-isrequiredkey/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, true>>, 5 | Expect, true>>, 6 | Expect, false>>, 7 | Expect, false>>, 8 | Expect, true>>, 9 | ] 10 | -------------------------------------------------------------------------------- /questions/02946-medium-objectentries/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: ObjectEntries 3 | tags: object 4 | author: 5 | github: jiangshanmeta 6 | name: jiangshan 7 | -------------------------------------------------------------------------------- /questions/02946-medium-objectentries/template.ts: -------------------------------------------------------------------------------- 1 | type ObjectEntries = any 2 | -------------------------------------------------------------------------------- /questions/02946-medium-objectentries/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | interface Model { 4 | name: string 5 | age: number 6 | locations: string[] | null 7 | } 8 | 9 | type ModelEntries = ['name', string] | ['age', number] | ['locations', string[] | null] 10 | 11 | type cases = [ 12 | Expect, ModelEntries>>, 13 | Expect>, ModelEntries>>, 14 | Expect, ['key', undefined]>>, 15 | Expect, ['key', undefined]>>, 16 | Expect, ['key', string | undefined]>>, 17 | ] 18 | -------------------------------------------------------------------------------- /questions/02949-hard-objectfromentries/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: hard 2 | title: ObjectFromEntries 3 | tags: object 4 | author: 5 | github: jiangshanmeta 6 | name: jiangshan 7 | 8 | related: 55 9 | -------------------------------------------------------------------------------- /questions/02949-hard-objectfromentries/template.ts: -------------------------------------------------------------------------------- 1 | type ObjectFromEntries = any 2 | -------------------------------------------------------------------------------- /questions/02949-hard-objectfromentries/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | interface Model { 4 | name: string 5 | age: number 6 | locations: string[] | null 7 | } 8 | 9 | type ModelEntries = ['name', string] | ['age', number] | ['locations', string[] | null] 10 | 11 | type cases = [ 12 | Expect, Model>>, 13 | ] 14 | -------------------------------------------------------------------------------- /questions/03057-easy-push/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: easy 2 | title: Push 3 | tags: array 4 | author: 5 | github: jiangshanmeta 6 | name: jiangshan 7 | 8 | related: 533, 3060 9 | -------------------------------------------------------------------------------- /questions/03057-easy-push/template.ts: -------------------------------------------------------------------------------- 1 | type Push = any 2 | -------------------------------------------------------------------------------- /questions/03057-easy-push/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, [1]>>, 5 | Expect, [1, 2, '3']>>, 6 | Expect, ['1', 2, '3', boolean]>>, 7 | ] 8 | -------------------------------------------------------------------------------- /questions/03060-easy-unshift/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: easy 2 | title: Unshift 3 | tags: array 4 | author: 5 | github: jiangshanmeta 6 | name: jiangshan 7 | 8 | related: 533, 3057 9 | -------------------------------------------------------------------------------- /questions/03060-easy-unshift/template.ts: -------------------------------------------------------------------------------- 1 | type Unshift = any 2 | -------------------------------------------------------------------------------- /questions/03060-easy-unshift/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, [1]>>, 5 | Expect, [0, 1, 2]>>, 6 | Expect, [boolean, '1', 2, '3']>>, 7 | ] 8 | -------------------------------------------------------------------------------- /questions/03062-medium-shift/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: Shift 3 | tags: array 4 | author: 5 | github: jiangshanmeta 6 | name: jiangshan 7 | 8 | related: 16 9 | -------------------------------------------------------------------------------- /questions/03062-medium-shift/template.ts: -------------------------------------------------------------------------------- 1 | type Shift = any 2 | -------------------------------------------------------------------------------- /questions/03062-medium-shift/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | // @ts-expect-error 5 | Shift, 6 | Expect, []>>, 7 | Expect, []>>, 8 | Expect, [2, 1]>>, 9 | Expect, ['b', 'c', 'd']>>, 10 | ] 11 | -------------------------------------------------------------------------------- /questions/03188-medium-tuple-to-nested-object/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: Tuple to Nested Object 3 | tags: object, tuple 4 | author: 5 | github: jiangshanmeta 6 | name: jiangshan 7 | 8 | related: 10, 11, 472, 730 9 | -------------------------------------------------------------------------------- /questions/03188-medium-tuple-to-nested-object/template.ts: -------------------------------------------------------------------------------- 1 | type TupleToNestedObject = any 2 | -------------------------------------------------------------------------------- /questions/03188-medium-tuple-to-nested-object/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, { a: string }>>, 5 | Expect, { a: { b: number } }>>, 6 | Expect, { a: { b: { c: boolean } } }>>, 7 | Expect, boolean>>, 8 | ] 9 | -------------------------------------------------------------------------------- /questions/03192-medium-reverse/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: Reverse 3 | tags: tuple 4 | author: 5 | github: jiangshanmeta 6 | name: jiangshan 7 | -------------------------------------------------------------------------------- /questions/03192-medium-reverse/template.ts: -------------------------------------------------------------------------------- 1 | type Reverse = any 2 | -------------------------------------------------------------------------------- /questions/03192-medium-reverse/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, []>>, 5 | Expect, ['b', 'a']>>, 6 | Expect, ['c', 'b', 'a']>>, 7 | ] 8 | 9 | type errors = [ 10 | // @ts-expect-error 11 | Reverse<'string'>, 12 | // @ts-expect-error 13 | Reverse<{ key: 'value' }>, 14 | ] 15 | -------------------------------------------------------------------------------- /questions/03196-medium-flip-arguments/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: Flip Arguments 3 | tags: arguments 4 | author: 5 | github: jiangshanmeta 6 | name: jiangshan 7 | 8 | related: 3192 9 | -------------------------------------------------------------------------------- /questions/03196-medium-flip-arguments/template.ts: -------------------------------------------------------------------------------- 1 | type FlipArguments = any 2 | -------------------------------------------------------------------------------- /questions/03196-medium-flip-arguments/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect boolean>, () => boolean>>, 5 | Expect number>, (foo: string) => number>>, 6 | Expect void>, (arg0: boolean, arg1: number, arg2: string) => void>>, 7 | ] 8 | 9 | type errors = [ 10 | // @ts-expect-error 11 | FlipArguments<'string'>, 12 | // @ts-expect-error 13 | FlipArguments<{ key: 'value' }>, 14 | // @ts-expect-error 15 | FlipArguments<['apple', 'banana', 100, { a: 1 }]>, 16 | // @ts-expect-error 17 | FlipArguments, 18 | ] 19 | -------------------------------------------------------------------------------- /questions/03243-medium-flattendepth/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: FlattenDepth 3 | tags: array 4 | author: 5 | github: jiangshanmeta 6 | name: jiangshan 7 | 8 | related: 459 9 | -------------------------------------------------------------------------------- /questions/03243-medium-flattendepth/template.ts: -------------------------------------------------------------------------------- 1 | type FlattenDepth = any 2 | -------------------------------------------------------------------------------- /questions/03243-medium-flattendepth/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, []>>, 5 | Expect, [1, 2, 3, 4]>>, 6 | Expect, [1, 2]>>, 7 | Expect, [1, 2, 3, 4, [5]]>>, 8 | Expect, [1, 2, 3, 4, [[5]]]>>, 9 | Expect, [1, 2, 3, 4, [5]]>>, 10 | Expect, [1, 2, 3, 4, 5]>>, 11 | ] 12 | -------------------------------------------------------------------------------- /questions/03312-easy-parameters/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: easy 2 | title: Parameters 3 | tags: infer, tuple, built-in 4 | author: 5 | github: midorizemi 6 | name: midorizemi 7 | -------------------------------------------------------------------------------- /questions/03312-easy-parameters/template.ts: -------------------------------------------------------------------------------- 1 | type MyParameters any> = any 2 | -------------------------------------------------------------------------------- /questions/03312-easy-parameters/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | function foo(arg1: string, arg2: number): void {} 4 | function bar(arg1: boolean, arg2: { a: 'A' }): void {} 5 | function baz(): void {} 6 | 7 | type cases = [ 8 | Expect, [string, number]>>, 9 | Expect, [boolean, { a: 'A' }]>>, 10 | Expect, []>>, 11 | ] 12 | -------------------------------------------------------------------------------- /questions/03326-medium-bem-style-string/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: BEM style string 3 | tags: template-literal, union, tuple 4 | author: 5 | github: songhn233 6 | name: Songhn 7 | -------------------------------------------------------------------------------- /questions/03326-medium-bem-style-string/template.ts: -------------------------------------------------------------------------------- 1 | type BEM = any 2 | -------------------------------------------------------------------------------- /questions/03326-medium-bem-style-string/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, 'btn__price'>>, 5 | Expect, 'btn__price--warning' | 'btn__price--success' >>, 6 | Expect, 'btn--small' | 'btn--medium' | 'btn--large' >>, 7 | ] 8 | -------------------------------------------------------------------------------- /questions/03376-medium-inordertraversal/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: hard 2 | title: InorderTraversal 3 | tags: object 4 | author: 5 | github: jiangshanmeta 6 | name: jiangshan 7 | -------------------------------------------------------------------------------- /questions/03376-medium-inordertraversal/template.ts: -------------------------------------------------------------------------------- 1 | interface TreeNode { 2 | val: number 3 | left: TreeNode | null 4 | right: TreeNode | null 5 | } 6 | type InorderTraversal = any 7 | -------------------------------------------------------------------------------- /questions/04037-hard-ispalindrome/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: hard 2 | title: IsPalindrome 3 | tags: string 4 | author: 5 | github: jiangshanmeta 6 | name: jiangshan 7 | -------------------------------------------------------------------------------- /questions/04037-hard-ispalindrome/template.ts: -------------------------------------------------------------------------------- 1 | type IsPalindrome = any 2 | -------------------------------------------------------------------------------- /questions/04037-hard-ispalindrome/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, false>>, 5 | Expect, true>>, 6 | Expect, false>>, 7 | Expect, true>>, 8 | Expect, true>>, 9 | Expect, true>>, 10 | Expect, true>>, 11 | Expect, false>>, 12 | ] 13 | -------------------------------------------------------------------------------- /questions/04179-medium-flip/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: Flip 3 | tags: object 4 | author: 5 | github: kathawala 6 | name: Farhan Kathawala 7 | -------------------------------------------------------------------------------- /questions/04179-medium-flip/template.ts: -------------------------------------------------------------------------------- 1 | type Flip = any 2 | -------------------------------------------------------------------------------- /questions/04179-medium-flip/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect, NotEqual } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect>>, 5 | Expect>>, 6 | Expect>>, 7 | Expect>>, 8 | ] 9 | -------------------------------------------------------------------------------- /questions/04182-medium-fibonacci-sequence/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: Fibonacci Sequence 3 | author: 4 | github: wind-liang 5 | name: windliang 6 | -------------------------------------------------------------------------------- /questions/04182-medium-fibonacci-sequence/info.zh-CN.yml: -------------------------------------------------------------------------------- 1 | title: 斐波那契序列 2 | -------------------------------------------------------------------------------- /questions/04182-medium-fibonacci-sequence/template.ts: -------------------------------------------------------------------------------- 1 | type Fibonacci = any 2 | -------------------------------------------------------------------------------- /questions/04182-medium-fibonacci-sequence/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, 1>>, 5 | Expect, 1>>, 6 | Expect, 2>>, 7 | Expect, 21>>, 8 | ] 9 | -------------------------------------------------------------------------------- /questions/04260-medium-nomiwase/info.ja.yml: -------------------------------------------------------------------------------- 1 | title: 文字の組み合わせ 2 | -------------------------------------------------------------------------------- /questions/04260-medium-nomiwase/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: AllCombinations 3 | author: 4 | github: sugoroku-y 5 | name: 蛭子屋双六 6 | tags: template-literal, infer, union 7 | -------------------------------------------------------------------------------- /questions/04260-medium-nomiwase/template.ts: -------------------------------------------------------------------------------- 1 | type AllCombinations = any 2 | -------------------------------------------------------------------------------- /questions/04425-medium-greater-than/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: Greater Than 3 | tags: array 4 | author: 5 | github: ch3cknull 6 | name: ch3cknull 7 | -------------------------------------------------------------------------------- /questions/04425-medium-greater-than/template.ts: -------------------------------------------------------------------------------- 1 | type GreaterThan = any 2 | -------------------------------------------------------------------------------- /questions/04425-medium-greater-than/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, true>>, 5 | Expect, true>>, 6 | Expect, false>>, 7 | Expect, false>>, 8 | Expect, true>>, 9 | Expect, false>>, 10 | Expect, false>>, 11 | Expect, true>>, 12 | Expect, true>>, 13 | ] 14 | -------------------------------------------------------------------------------- /questions/04471-medium-zip/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: Zip 3 | tags: tuple 4 | author: 5 | github: qianxi0410 6 | name: キリサメ qianxi 7 | -------------------------------------------------------------------------------- /questions/04471-medium-zip/template.ts: -------------------------------------------------------------------------------- 1 | type Zip = any 2 | -------------------------------------------------------------------------------- /questions/04471-medium-zip/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, []>>, 5 | Expect, [[1, true], [2, false]]>>, 6 | Expect, [[1, '1'], [2, '2']]>>, 7 | Expect, []>>, 8 | Expect, [[[1, 2], 3]]>>, 9 | ] 10 | -------------------------------------------------------------------------------- /questions/04484-medium-istuple/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: IsTuple 3 | tags: tuple 4 | author: 5 | github: jiangshanmeta 6 | name: jiangshan 7 | 8 | related: 1042, 1097, 223 9 | -------------------------------------------------------------------------------- /questions/04484-medium-istuple/template.ts: -------------------------------------------------------------------------------- 1 | type IsTuple = any 2 | -------------------------------------------------------------------------------- /questions/04484-medium-istuple/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, true>>, 5 | Expect, true>>, 6 | Expect, true>>, 7 | Expect, false>>, 8 | Expect, false>>, 9 | Expect, false>>, 10 | ] 11 | -------------------------------------------------------------------------------- /questions/04499-medium-chunk/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: Chunk 3 | tags: tuple 4 | author: 5 | github: qianxi0410 6 | name: キリサメ qianxi 7 | -------------------------------------------------------------------------------- /questions/04499-medium-chunk/template.ts: -------------------------------------------------------------------------------- 1 | type Chunk = any 2 | -------------------------------------------------------------------------------- /questions/04499-medium-chunk/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, []>>, 5 | Expect, [[1], [2], [3]]>>, 6 | Expect, [[1, 2], [3]]>>, 7 | Expect, [[1, 2], [3, 4]]>>, 8 | Expect, [[1, 2, 3, 4]]>>, 9 | Expect, [[1, true], [2, false]]>>, 10 | ] 11 | -------------------------------------------------------------------------------- /questions/04518-medium-fill/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: Fill 3 | tags: tuple 4 | author: 5 | github: qianxi0410 6 | name: キリサメ qianxi 7 | -------------------------------------------------------------------------------- /questions/04518-medium-fill/template.ts: -------------------------------------------------------------------------------- 1 | type Fill< 2 | T extends unknown[], 3 | N, 4 | Start extends number = 0, 5 | End extends number = T['length'], 6 | > = any 7 | -------------------------------------------------------------------------------- /questions/04518-medium-fill/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, []>>, 5 | Expect, []>>, 6 | Expect, [1, 2, 3]>>, 7 | Expect, [1, 2, 3]>>, 8 | Expect, [0, 0, 0]>>, 9 | Expect, [true, true, true]>>, 10 | Expect, [true, 2, 3]>>, 11 | Expect, [1, true, true]>>, 12 | Expect, [1, 2, 3]>>, 13 | Expect, [1, 2, 3]>>, 14 | Expect, [true, true, true]>>, 15 | ] 16 | -------------------------------------------------------------------------------- /questions/04803-medium-trim-right/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: Trim Right 3 | author: 4 | github: Talljack 5 | name: Yugang Cao 6 | tags: template-literal 7 | related: 106, 108 8 | -------------------------------------------------------------------------------- /questions/04803-medium-trim-right/template.ts: -------------------------------------------------------------------------------- 1 | type TrimRight = any 2 | -------------------------------------------------------------------------------- /questions/04803-medium-trim-right/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, 'str'>>, 5 | Expect, 'str'>>, 6 | Expect, 'str'>>, 7 | Expect, ' str'>>, 8 | Expect, ' foo bar'>>, 9 | Expect, ''>>, 10 | Expect, ''>>, 11 | ] 12 | -------------------------------------------------------------------------------- /questions/05117-medium-without/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: Without 3 | tags: union, array 4 | author: 5 | github: Pineapple0919 6 | name: Pineapple 7 | -------------------------------------------------------------------------------- /questions/05117-medium-without/info.zh-CN.yml: -------------------------------------------------------------------------------- 1 | difficulty: 中等 2 | title: 去除数组指定元素 3 | tags: 联合类型, 数组 4 | author: 5 | github: Pineapple0919 6 | name: Pineapple 7 | -------------------------------------------------------------------------------- /questions/05117-medium-without/template.ts: -------------------------------------------------------------------------------- 1 | type Without = any 2 | -------------------------------------------------------------------------------- /questions/05117-medium-without/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, [2]>>, 5 | Expect, [4, 5]>>, 6 | Expect, []>>, 7 | ] 8 | -------------------------------------------------------------------------------- /questions/05140-medium-trunc/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: Trunc 3 | tags: template-literal 4 | author: 5 | github: jiangshanmeta 6 | name: jiangshan 7 | -------------------------------------------------------------------------------- /questions/05140-medium-trunc/template.ts: -------------------------------------------------------------------------------- 1 | type Trunc = any 2 | -------------------------------------------------------------------------------- /questions/05140-medium-trunc/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, '0'>>, 5 | Expect, '0'>>, 6 | Expect, '1'>>, 7 | Expect, '12'>>, 8 | Expect, '-5'>>, 9 | Expect, '0'>>, 10 | Expect, '1'>>, 11 | Expect, '-10'>>, 12 | Expect, '10'>>, 13 | ] 14 | -------------------------------------------------------------------------------- /questions/05153-medium-indexof/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: IndexOf 3 | tags: array 4 | author: 5 | github: Pineapple0919 6 | name: Pineapple 7 | -------------------------------------------------------------------------------- /questions/05153-medium-indexof/template.ts: -------------------------------------------------------------------------------- 1 | type IndexOf = any 2 | -------------------------------------------------------------------------------- /questions/05153-medium-indexof/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, 1>>, 5 | Expect, 2>>, 6 | Expect, -1>>, 7 | Expect, 2>>, 8 | Expect, 4>>, 9 | Expect, 1>>, 10 | Expect, 1>>, 11 | ] 12 | -------------------------------------------------------------------------------- /questions/05181-hard-mutable-keys/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: hard 2 | title: Mutable Keys 3 | tags: utils 4 | related: '2793' 5 | author: 6 | github: Talljack 7 | name: Yugang Cao 8 | -------------------------------------------------------------------------------- /questions/05181-hard-mutable-keys/template.ts: -------------------------------------------------------------------------------- 1 | type MutableKeys = any 2 | -------------------------------------------------------------------------------- /questions/05181-hard-mutable-keys/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, 'a'>>, 5 | Expect, 'a'>>, 6 | Expect, 'a' | 'c' | 'd'>>, 7 | Expect, never>>, 8 | ] 9 | -------------------------------------------------------------------------------- /questions/05310-medium-join/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: Join 3 | tags: array 4 | author: 5 | github: Pineapple0919 6 | name: Pineapple 7 | -------------------------------------------------------------------------------- /questions/05310-medium-join/template.ts: -------------------------------------------------------------------------------- 1 | type Join = any 2 | -------------------------------------------------------------------------------- /questions/05310-medium-join/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, 'a-p-p-l-e'>>, 5 | Expect, 'Hello World'>>, 6 | Expect, '21212'>>, 7 | Expect, 'o'>>, 8 | Expect, ''>>, 9 | ] 10 | -------------------------------------------------------------------------------- /questions/05317-medium-lastindexof/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: LastIndexOf 3 | tags: array 4 | author: 5 | github: jiangshanmeta 6 | name: jiangshan 7 | -------------------------------------------------------------------------------- /questions/05317-medium-lastindexof/info.zh-CN.yml: -------------------------------------------------------------------------------- 1 | difficulty: 中等 2 | title: LastIndexOf 3 | tags: array 4 | author: 5 | github: jiangshanmeta 6 | name: jiangshan 7 | -------------------------------------------------------------------------------- /questions/05317-medium-lastindexof/template.ts: -------------------------------------------------------------------------------- 1 | type LastIndexOf = any 2 | -------------------------------------------------------------------------------- /questions/05317-medium-lastindexof/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, 3>>, 5 | Expect, 7>>, 6 | Expect, -1>>, 7 | Expect, 4>>, 8 | Expect, 5>>, 9 | ] 10 | -------------------------------------------------------------------------------- /questions/05360-medium-unique/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: Unique 3 | tags: array 4 | author: 5 | github: Pineapple0919 6 | name: Pineapple 7 | -------------------------------------------------------------------------------- /questions/05360-medium-unique/info.zh-CN.yml: -------------------------------------------------------------------------------- 1 | difficulty: 中等 2 | title: Unique 3 | tags: array 4 | author: 5 | github: Pineapple0919 6 | name: Pineapple 7 | -------------------------------------------------------------------------------- /questions/05360-medium-unique/template.ts: -------------------------------------------------------------------------------- 1 | type Unique = any 2 | -------------------------------------------------------------------------------- /questions/05360-medium-unique/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, [1, 2, 3]>>, 5 | Expect, [1, 2, 3, 4, 5, 6, 7]>>, 6 | Expect, [1, 'a', 2, 'b']>>, 7 | Expect, [string, number, 1, 'a', 2, 'b']>>, 8 | Expect, [unknown, any, never]>>, 9 | ] 10 | -------------------------------------------------------------------------------- /questions/05423-hard-intersection/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: hard 2 | title: Intersection 3 | tags: union, array 4 | author: 5 | github: Pineapple0919 6 | name: Pineapple 7 | -------------------------------------------------------------------------------- /questions/05423-hard-intersection/template.ts: -------------------------------------------------------------------------------- 1 | type Intersection = any 2 | -------------------------------------------------------------------------------- /questions/05423-hard-intersection/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, 2>>, 5 | Expect, 2 | 3>>, 6 | Expect, never>>, 7 | Expect, 3>>, 8 | Expect, 2 | 3>>, 9 | Expect, never>>, 10 | ] 11 | -------------------------------------------------------------------------------- /questions/05821-medium-maptypes/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: MapTypes 3 | tags: map, object, utils 4 | author: 5 | github: wokayme 6 | name: Krzysztof "Wokay" Łokaj 7 | -------------------------------------------------------------------------------- /questions/05821-medium-maptypes/template.ts: -------------------------------------------------------------------------------- 1 | type MapTypes = any 2 | -------------------------------------------------------------------------------- /questions/06141-hard-binary-to-decimal/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: hard 2 | title: Binary to Decimal 3 | tags: math 4 | author: 5 | github: wotsushi 6 | name: wotsushi 7 | -------------------------------------------------------------------------------- /questions/06141-hard-binary-to-decimal/template.ts: -------------------------------------------------------------------------------- 1 | type BinaryToDecimal = any 2 | -------------------------------------------------------------------------------- /questions/06141-hard-binary-to-decimal/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, 2>>, 5 | Expect, 3>>, 6 | Expect, 0>>, 7 | Expect, 255>>, 8 | Expect, 170>>, 9 | ] 10 | -------------------------------------------------------------------------------- /questions/06228-extreme-json-parser/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: extreme 2 | title: JSON Parser 3 | tags: 4 | - template-literal 5 | - json 6 | author: 7 | github: hydrati 8 | name: Hydration 9 | -------------------------------------------------------------------------------- /questions/06228-extreme-json-parser/template.ts: -------------------------------------------------------------------------------- 1 | type Pure = { 2 | [P in keyof T]: T[P] extends object ? Pure : T[P] 3 | } 4 | 5 | type SetProperty = { 6 | [P in (keyof T) | K]: P extends K ? V : P extends keyof T ? T[P] : never 7 | } 8 | 9 | type Token = any 10 | type ParseResult = [T, K] 11 | type Tokenize = Token[] 12 | type ParseLiteral = ParseResult 13 | 14 | type Parse = Pure>[0]> 15 | -------------------------------------------------------------------------------- /questions/07258-hard-object-key-paths/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: hard 2 | title: Object Key Paths 3 | tags: object-keys 4 | author: 5 | github: ChenKS12138 6 | name: CattChen 7 | -------------------------------------------------------------------------------- /questions/07258-hard-object-key-paths/template.ts: -------------------------------------------------------------------------------- 1 | type ObjectKeyPaths = any 2 | -------------------------------------------------------------------------------- /questions/07544-medium-construct-tuple/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: Construct Tuple 3 | tags: tuple 4 | author: 5 | github: LoTwT 6 | name: Lo 7 | -------------------------------------------------------------------------------- /questions/07544-medium-construct-tuple/template.ts: -------------------------------------------------------------------------------- 1 | type ConstructTuple = any 2 | -------------------------------------------------------------------------------- /questions/07544-medium-construct-tuple/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, []>>, 5 | Expect, [unknown, unknown]>>, 6 | Expect['length'], 999>>, 7 | // @ts-expect-error 8 | Expect['length'], 1000>>, 9 | ] 10 | -------------------------------------------------------------------------------- /questions/07561-extreme-subtract/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: extreme 2 | title: Subtract 3 | tags: tuple 4 | author: 5 | github: LoTwT 6 | name: Lo 7 | -------------------------------------------------------------------------------- /questions/07561-extreme-subtract/template.ts: -------------------------------------------------------------------------------- 1 | // M => minuend, S => subtrahend 2 | type Subtract = any 3 | -------------------------------------------------------------------------------- /questions/07561-extreme-subtract/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, 0>>, 5 | Expect, 1>>, 6 | Expect, never>>, 7 | // @ts-expect-error 8 | Expect, 1>>, 9 | ] 10 | -------------------------------------------------------------------------------- /questions/08640-medium-number-range/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: Number Range 3 | author: 4 | github: HongxuanG 5 | name: AaronGuo 6 | -------------------------------------------------------------------------------- /questions/08640-medium-number-range/template.ts: -------------------------------------------------------------------------------- 1 | type NumberRange = any 2 | -------------------------------------------------------------------------------- /questions/08767-medium-combination/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: Combination 3 | tags: array, application, string 4 | author: 5 | github: HomyeeKing 6 | name: Homyee King 7 | 8 | related: 296 9 | -------------------------------------------------------------------------------- /questions/08767-medium-combination/template.ts: -------------------------------------------------------------------------------- 1 | type Combination = any 2 | -------------------------------------------------------------------------------- /questions/08767-medium-combination/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, 'foo' | 'bar' | 'baz' | 'foo bar' | 'foo bar baz' | 'foo baz' | 'foo baz bar' | 'bar foo' | 'bar foo baz' | 'bar baz' | 'bar baz foo' | 'baz foo' | 'baz foo bar' | 'baz bar' | 'baz bar foo'>>, 5 | ] 6 | -------------------------------------------------------------------------------- /questions/08804-hard-two-sum/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: hard 2 | title: Two Sum 3 | tags: array, math 4 | author: 5 | github: Psilocine 6 | name: PsiloLau 7 | -------------------------------------------------------------------------------- /questions/08804-hard-two-sum/info.zh-CN.yml: -------------------------------------------------------------------------------- 1 | difficulty: 困难 2 | title: 两数之和 3 | tags: array, math 4 | author: 5 | github: Psilocine 6 | name: PsiloLau 7 | -------------------------------------------------------------------------------- /questions/08804-hard-two-sum/template.ts: -------------------------------------------------------------------------------- 1 | type TwoSum = any 2 | -------------------------------------------------------------------------------- /questions/08804-hard-two-sum/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, true>>, 5 | Expect, true>>, 6 | Expect, false>>, 7 | Expect, true>>, 8 | Expect, false>>, 9 | Expect, false>>, 10 | Expect, false>>, 11 | Expect, true>>, 12 | Expect, true>>, 13 | Expect, true>>, 14 | Expect, false>>, 15 | Expect, true>>, 16 | ] 17 | -------------------------------------------------------------------------------- /questions/08987-medium-subsequence/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: Subsequence 3 | tags: union 4 | author: 5 | github: jiangshanmeta 6 | name: jiangshan 7 | -------------------------------------------------------------------------------- /questions/08987-medium-subsequence/template.ts: -------------------------------------------------------------------------------- 1 | type Subsequence = any 2 | -------------------------------------------------------------------------------- /questions/08987-medium-subsequence/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, [] | [1] | [2] | [1, 2]>>, 5 | Expect, [] | [1] | [2] | [1, 2] | [3] | [1, 3] | [2, 3] | [1, 2, 3] >>, 6 | ] 7 | -------------------------------------------------------------------------------- /questions/09142-medium-checkrepeatedchars/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: CheckRepeatedChars 3 | tags: union, string 4 | author: 5 | github: RThong 6 | name: Hong 7 | -------------------------------------------------------------------------------- /questions/09142-medium-checkrepeatedchars/info.zh-CN.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: CheckRepeatedChars 3 | tags: union, string 4 | author: 5 | github: RThong 6 | name: Hong 7 | -------------------------------------------------------------------------------- /questions/09142-medium-checkrepeatedchars/template.ts: -------------------------------------------------------------------------------- 1 | type CheckRepeatedChars = any 2 | -------------------------------------------------------------------------------- /questions/09142-medium-checkrepeatedchars/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, false>>, 5 | Expect, true>>, 6 | Expect, true>>, 7 | Expect, false>>, 8 | ] 9 | -------------------------------------------------------------------------------- /questions/09155-hard-validdate/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: hard 2 | title: ValidDate 3 | author: 4 | github: ch3cknull 5 | name: ch3cknull 6 | -------------------------------------------------------------------------------- /questions/09155-hard-validdate/template.ts: -------------------------------------------------------------------------------- 1 | type ValidDate = any 2 | -------------------------------------------------------------------------------- /questions/09155-hard-validdate/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, true>>, 5 | Expect, true>>, 6 | Expect, true>>, 7 | Expect, false>>, 8 | Expect, false>>, 9 | Expect, false>>, 10 | Expect, false>>, 11 | Expect, true>>, 12 | Expect, false>>, 13 | Expect, false>>, 14 | ] 15 | -------------------------------------------------------------------------------- /questions/09160-hard-assign/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: hard 2 | title: Assign 3 | tags: object, array 4 | author: 5 | github: workkk98 6 | name: zhangxiaofan 7 | -------------------------------------------------------------------------------- /questions/09160-hard-assign/template.ts: -------------------------------------------------------------------------------- 1 | type Assign, U> = any 2 | -------------------------------------------------------------------------------- /questions/09286-medium-firstuniquecharindex/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: FirstUniqueCharIndex 3 | tags: string 4 | author: 5 | github: jiangshanmeta 6 | name: jiangshan 7 | -------------------------------------------------------------------------------- /questions/09286-medium-firstuniquecharindex/template.ts: -------------------------------------------------------------------------------- 1 | type FirstUniqueCharIndex = any 2 | -------------------------------------------------------------------------------- /questions/09286-medium-firstuniquecharindex/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, 0>>, 5 | Expect, 2>>, 6 | Expect, -1>>, 7 | Expect, -1>>, 8 | Expect, -1>>, 9 | ] 10 | -------------------------------------------------------------------------------- /questions/09384-hard-maximum/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: hard 2 | title: Maximum 3 | tags: array 4 | author: 5 | github: ch3cknull 6 | name: ch3cknull 7 | -------------------------------------------------------------------------------- /questions/09384-hard-maximum/template.ts: -------------------------------------------------------------------------------- 1 | type Maximum = any 2 | -------------------------------------------------------------------------------- /questions/09384-hard-maximum/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, never>>, 5 | Expect, 2>>, 6 | Expect, 200>>, 7 | ] 8 | -------------------------------------------------------------------------------- /questions/09616-medium-parse-url-params/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: Parse URL Params 3 | tags: infer, string, template-literal 4 | author: 5 | github: andersonjoseph 6 | name: Anderson. J 7 | -------------------------------------------------------------------------------- /questions/09616-medium-parse-url-params/template.ts: -------------------------------------------------------------------------------- 1 | type ParseUrlParams = any 2 | -------------------------------------------------------------------------------- /questions/09616-medium-parse-url-params/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, never>>, 5 | Expect, 'id'>>, 6 | Expect, 'id'>>, 7 | Expect, 'id'>>, 8 | Expect, 'id' | 'user'>>, 9 | Expect, 'id' | 'user'>>, 10 | ] 11 | -------------------------------------------------------------------------------- /questions/09775-hard-capitalize-nest-object-keys/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: hard 2 | title: Capitalize Nest Object Keys 3 | tags: object, array 4 | author: 5 | github: Mayandev 6 | name: MayanDev 7 | -------------------------------------------------------------------------------- /questions/09775-hard-capitalize-nest-object-keys/template.ts: -------------------------------------------------------------------------------- 1 | type CapitalizeNestObjectKeys = any 2 | -------------------------------------------------------------------------------- /questions/09775-hard-capitalize-nest-object-keys/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type foo = { 4 | foo: string 5 | bars: [{ foo: string }] 6 | } 7 | 8 | type Foo = { 9 | Foo: string 10 | Bars: [{ 11 | Foo: string 12 | }] 13 | } 14 | 15 | type cases = [ 16 | Expect>>, 17 | ] 18 | -------------------------------------------------------------------------------- /questions/09896-medium-get-middle-element/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: GetMiddleElement 3 | author: 4 | github: kongmingLatern 5 | name: 凤之兮原 6 | -------------------------------------------------------------------------------- /questions/09896-medium-get-middle-element/info.zh-CN.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: 获取数组的中间元素 3 | author: 4 | github: kongmingLatern 5 | name: 凤之兮原 6 | -------------------------------------------------------------------------------- /questions/09896-medium-get-middle-element/template.ts: -------------------------------------------------------------------------------- 1 | type GetMiddleElement = any 2 | -------------------------------------------------------------------------------- /questions/09896-medium-get-middle-element/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, []>>, 5 | Expect, [3]>>, 6 | Expect, [3, 4]>>, 7 | Expect string]>, [() => string]>>, 8 | Expect number, '3', [3, 4], 5]>, ['3', [3, 4]]>>, 9 | Expect string, () => number]>, [() => string, () => number]>>, 10 | Expect, [never]>>, 11 | ] 12 | // @ts-expect-error 13 | type error = GetMiddleElement<1, 2, 3> 14 | -------------------------------------------------------------------------------- /questions/09898-medium-zhao-chu-mu-biao-shu-zu-zhong-zhi-chu-xian-guo-yi-ci-de-yuan-su/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: Appear only once 3 | author: 4 | github: brenner8023 5 | name: X.Q. Chen 6 | -------------------------------------------------------------------------------- /questions/09898-medium-zhao-chu-mu-biao-shu-zu-zhong-zhi-chu-xian-guo-yi-ci-de-yuan-su/info.zh-CN.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: 找出目标数组中只出现过一次的元素 3 | author: 4 | github: brenner8023 5 | name: X.Q. Chen 6 | -------------------------------------------------------------------------------- /questions/09898-medium-zhao-chu-mu-biao-shu-zu-zhong-zhi-chu-xian-guo-yi-ci-de-yuan-su/template.ts: -------------------------------------------------------------------------------- 1 | type FindEles = any 2 | -------------------------------------------------------------------------------- /questions/09898-medium-zhao-chu-mu-biao-shu-zu-zhong-zhi-chu-xian-guo-yi-ci-de-yuan-su/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, [1, 4, 5]>>, 5 | Expect, []>>, 6 | Expect, [1, 2, 3]>>, 7 | ] 8 | -------------------------------------------------------------------------------- /questions/09989-medium-tong-ji-shu-zu-zhong-de-yuan-su-ge-shu/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: Count Element Number To Object 3 | author: 4 | github: kongmingLatern 5 | name: 凤之兮原 6 | -------------------------------------------------------------------------------- /questions/09989-medium-tong-ji-shu-zu-zhong-de-yuan-su-ge-shu/info.zh-CN.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: 统计数组中的元素个数 3 | author: 4 | github: kongmingLatern 5 | name: 凤之兮原 6 | -------------------------------------------------------------------------------- /questions/09989-medium-tong-ji-shu-zu-zhong-de-yuan-su-ge-shu/template.ts: -------------------------------------------------------------------------------- 1 | type CountElementNumberToObject = any 2 | -------------------------------------------------------------------------------- /questions/10969-medium-integer/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: Integer 3 | tags: template-literal 4 | author: 5 | github: hbcraft 6 | name: HuaBing 7 | -------------------------------------------------------------------------------- /questions/10969-medium-integer/info.zh-CN.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: 整数 3 | tags: template-literal 4 | author: 5 | github: hbcraft 6 | name: HuaBing 7 | -------------------------------------------------------------------------------- /questions/10969-medium-integer/template.ts: -------------------------------------------------------------------------------- 1 | type Integer = any 2 | -------------------------------------------------------------------------------- /questions/10969-medium-integer/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | let x = 1 4 | let y = 1 as const 5 | 6 | type cases1 = [ 7 | Expect, 1>>, 8 | Expect, never>>, 9 | Expect, 1>>, 10 | Expect, 1>>, 11 | Expect, never>>, 12 | Expect, 28>>, 13 | Expect, never>>, 14 | Expect, never>>, 15 | Expect, 1>>, 16 | ] 17 | -------------------------------------------------------------------------------- /questions/13580-hard-replace-union/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: hard 2 | title: Replace Union 3 | author: 4 | github: crutch12 5 | name: Konstantin Barabanov 6 | -------------------------------------------------------------------------------- /questions/13580-hard-replace-union/template.ts: -------------------------------------------------------------------------------- 1 | type UnionReplace = any 2 | -------------------------------------------------------------------------------- /questions/13580-hard-replace-union/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | // string -> null 5 | Expect, number | null>>, 6 | 7 | // string -> null 8 | Expect, number | null>>, 9 | 10 | // Date -> string; Function -> undefined 11 | Expect, undefined | string | object>>, 12 | ] 13 | -------------------------------------------------------------------------------- /questions/14080-hard-fizzbuzz/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: hard 2 | title: FizzBuzz 3 | tags: array, math, infer 4 | author: 5 | github: Cygnut 6 | name: Lee Crosby 7 | -------------------------------------------------------------------------------- /questions/14080-hard-fizzbuzz/template.ts: -------------------------------------------------------------------------------- 1 | type FizzBuzz = any 2 | -------------------------------------------------------------------------------- /questions/14188-hard-run-length-encoding/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: hard 2 | title: Run-length encoding 3 | author: 4 | github: alfaproxima 5 | name: Hen Hedymdeith 6 | -------------------------------------------------------------------------------- /questions/14188-hard-run-length-encoding/template.ts: -------------------------------------------------------------------------------- 1 | namespace RLE { 2 | export type Encode = any 3 | export type Decode = any 4 | } 5 | -------------------------------------------------------------------------------- /questions/14188-hard-run-length-encoding/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | // Raw string -> encoded string 5 | Expect, '3AB2C6XY'>>, 6 | 7 | // Encoded string -> decoded string 8 | Expect, 'AAABCCXXXXXXY'>>, 9 | ] 10 | -------------------------------------------------------------------------------- /questions/15260-hard-tree-path-array/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: hard 2 | title: Tree path array 3 | author: 4 | github: noook 5 | name: Neil Richter 6 | -------------------------------------------------------------------------------- /questions/15260-hard-tree-path-array/template.ts: -------------------------------------------------------------------------------- 1 | type Path = any 2 | -------------------------------------------------------------------------------- /questions/15260-hard-tree-path-array/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { ExpectExtends, ExpectFalse, ExpectTrue } from '@type-challenges/utils' 2 | 3 | declare const example: { 4 | foo: { 5 | bar: { 6 | a: string 7 | } 8 | baz: { 9 | b: number 10 | c: number 11 | } 12 | } 13 | } 14 | 15 | type cases = [ 16 | ExpectTrue, ['a']>>, 17 | ExpectTrue, ['b'] | ['c'] >>, 18 | ExpectTrue, ['bar'] | ['baz'] | ['bar', 'a'] | ['baz', 'b'] | ['baz', 'c']>>, 19 | ExpectFalse, ['z']>>, 20 | ] 21 | -------------------------------------------------------------------------------- /questions/16259-medium-to-primitive/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: ToPrimitive 3 | author: 4 | github: mwc 5 | name: 前端子鱼 6 | -------------------------------------------------------------------------------- /questions/16259-medium-to-primitive/info.zh-CN.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: 将类型为字面类型(标签类型)的属性,转换为基本类型。 3 | author: 4 | github: mwc 5 | name: 前端子鱼 6 | -------------------------------------------------------------------------------- /questions/16259-medium-to-primitive/template.ts: -------------------------------------------------------------------------------- 1 | type ToPrimitive = any 2 | -------------------------------------------------------------------------------- /questions/16259-medium-to-primitive/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type PersonInfo = { 4 | name: 'Tom' 5 | age: 30 6 | married: false 7 | addr: { 8 | home: '123456' 9 | phone: '13111111111' 10 | } 11 | hobbies: ['sing', 'dance'] 12 | readonlyArr: readonly ['test'] 13 | fn: () => any 14 | } 15 | 16 | type ExpectedResult = { 17 | name: string 18 | age: number 19 | married: boolean 20 | addr: { 21 | home: string 22 | phone: string 23 | } 24 | hobbies: [string, string] 25 | readonlyArr: readonly [string] 26 | fn: Function 27 | } 28 | 29 | type cases = [ 30 | Expect, ExpectedResult>>, 31 | ] 32 | -------------------------------------------------------------------------------- /questions/17973-medium-deepmutable/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: DeepMutable 3 | author: 4 | github: cutefcc 5 | name: cutefcc 6 | tags: readonly, deep 7 | -------------------------------------------------------------------------------- /questions/17973-medium-deepmutable/template.ts: -------------------------------------------------------------------------------- 1 | type DeepMutable = any 2 | -------------------------------------------------------------------------------- /questions/18142-medium-all/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: All 3 | author: 4 | github: cutefcc 5 | name: cutefcc 6 | tags: array 7 | -------------------------------------------------------------------------------- /questions/18142-medium-all/template.ts: -------------------------------------------------------------------------------- 1 | type All = any 2 | -------------------------------------------------------------------------------- /questions/18220-medium-filter/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: Filter 3 | tags: array, filter 4 | author: 5 | github: x86chi 6 | name: Muhun Kim 7 | -------------------------------------------------------------------------------- /questions/18220-medium-filter/template.ts: -------------------------------------------------------------------------------- 1 | type Filter = [] 2 | -------------------------------------------------------------------------------- /questions/18220-medium-filter/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type Falsy = false | 0 | '' | null | undefined 4 | 5 | type cases = [ 6 | Expect, [2]>>, 7 | Expect, [0, 1]>>, 8 | Expect, [0]>>, 9 | ] 10 | -------------------------------------------------------------------------------- /questions/19458-hard-snakecase/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: hard 2 | title: SnakeCase 3 | tags: template-literal,string 4 | author: 5 | github: gvergnaud 6 | name: Gabriel Vergnaud 7 | -------------------------------------------------------------------------------- /questions/19458-hard-snakecase/template.ts: -------------------------------------------------------------------------------- 1 | type SnakeCase = any 2 | -------------------------------------------------------------------------------- /questions/19458-hard-snakecase/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, 'hello'>>, 5 | Expect, 'user_name'>>, 6 | Expect, 'get_element_by_id'>>, 7 | Expect, 'get_element_by_id' | 'get_element_by_class_names'>>, 8 | ] 9 | -------------------------------------------------------------------------------- /questions/21104-medium-findall/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: FindAll 3 | tags: template-literal, string 4 | author: 5 | github: tunamagur0 6 | name: tunamagur0 7 | -------------------------------------------------------------------------------- /questions/21104-medium-findall/template.ts: -------------------------------------------------------------------------------- 1 | type FindAll = any 2 | -------------------------------------------------------------------------------- /questions/21104-medium-findall/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, [14]>>, 5 | Expect, [16, 27]>>, 6 | Expect, []>>, 7 | Expect, []>>, 8 | Expect, []>>, 9 | Expect, [0, 1, 2, 3]>>, 10 | Expect, [0, 1, 2]>>, 11 | ] 12 | -------------------------------------------------------------------------------- /questions/21106-medium-zu-he-jian-lei-xing-combination-key-type/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: Combination key type 3 | author: 4 | github: Nauxscript 5 | name: Nauxscript 6 | -------------------------------------------------------------------------------- /questions/21106-medium-zu-he-jian-lei-xing-combination-key-type/info.zh-CN.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: 组合键类型 Combination key type 3 | author: 4 | github: Nauxscript 5 | name: Nauxscript 6 | -------------------------------------------------------------------------------- /questions/21106-medium-zu-he-jian-lei-xing-combination-key-type/template.ts: -------------------------------------------------------------------------------- 1 | // 实现 Combs 2 | type Combs = any 3 | -------------------------------------------------------------------------------- /questions/21106-medium-zu-he-jian-lei-xing-combination-key-type/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type ModifierKeys = ['cmd', 'ctrl', 'opt', 'fn'] 4 | type CaseTypeOne = 'cmd ctrl' | 'cmd opt' | 'cmd fn' | 'ctrl opt' | 'ctrl fn' | 'opt fn' 5 | 6 | type cases = [ 7 | Expect, CaseTypeOne>>, 8 | ] 9 | -------------------------------------------------------------------------------- /questions/21220-medium-permutations-of-tuple/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: Permutations of Tuple 3 | tags: union, tuple, conditional type, recursion 4 | related: 296, 4260, 8767, 5 | author: 6 | github: gaac510 7 | name: null 8 | -------------------------------------------------------------------------------- /questions/21220-medium-permutations-of-tuple/template.ts: -------------------------------------------------------------------------------- 1 | type PermutationsOfTuple = any 2 | -------------------------------------------------------------------------------- /questions/25170-medium-replace-first/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: Replace First 3 | author: 4 | github: ProjectFlinn 5 | name: George Flinn 6 | -------------------------------------------------------------------------------- /questions/25170-medium-replace-first/template.ts: -------------------------------------------------------------------------------- 1 | type ReplaceFirst = any 2 | -------------------------------------------------------------------------------- /questions/25170-medium-replace-first/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, [1, 2, 4]>>, 5 | Expect, ['A', 'B', 'D']>>, 6 | Expect, [false, true, true]>>, 7 | Expect, [string, string, number]>>, 8 | Expect, [1, 2, 3]>>, 9 | Expect, ['six', 'eight', 'ten']>>, 10 | ] 11 | -------------------------------------------------------------------------------- /questions/25270-medium-transpose/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: Transpose 3 | tags: array, math 4 | author: 5 | github: Shinerising 6 | name: Apollo Wayne 7 | -------------------------------------------------------------------------------- /questions/25270-medium-transpose/template.ts: -------------------------------------------------------------------------------- 1 | type Transpose = any 2 | -------------------------------------------------------------------------------- /questions/25270-medium-transpose/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, []>>, 5 | Expect, [[1]]>>, 6 | Expect, [[1], [2]]>>, 7 | Expect, [[1, 3], [2, 4]]>>, 8 | Expect, [[1, 4], [2, 5], [3, 6]]>>, 9 | Expect, [[1, 2, 3], [4, 5, 6]]>>, 10 | Expect, [[1, 4, 7], [2, 5, 8], [3, 6, 9]]>>, 11 | ] 12 | -------------------------------------------------------------------------------- /questions/25747-hard-isnegativenumber/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: hard 2 | title: IsNegativeNumber 3 | tags: number, template literal 4 | author: 5 | github: ahrjarrett 6 | name: andrew jarrett 7 | -------------------------------------------------------------------------------- /questions/25747-hard-isnegativenumber/template.ts: -------------------------------------------------------------------------------- 1 | type IsNegativeNumber = any 2 | -------------------------------------------------------------------------------- /questions/25747-hard-isnegativenumber/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, false>>, 5 | Expect, never>>, 6 | Expect, never>>, 7 | Expect, true>>, 8 | Expect, true>>, 9 | Expect, true>>, 10 | Expect, false>>, 11 | Expect, false>>, 12 | Expect, false>>, 13 | ] 14 | -------------------------------------------------------------------------------- /questions/26401-medium-json-schema-to-typescript/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: JSON Schema to TypeScript 3 | tags: JSON 4 | author: 5 | github: aswinsvijay 6 | name: null 7 | -------------------------------------------------------------------------------- /questions/26401-medium-json-schema-to-typescript/template.ts: -------------------------------------------------------------------------------- 1 | type JSONSchema2TS = any 2 | -------------------------------------------------------------------------------- /questions/27133-medium-square/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: Square 3 | tags: tuple, array, math 4 | author: 5 | github: aswinsvijay 6 | name: null 7 | -------------------------------------------------------------------------------- /questions/27133-medium-square/template.ts: -------------------------------------------------------------------------------- 1 | type Square = number 2 | -------------------------------------------------------------------------------- /questions/27133-medium-square/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, 0>>, 5 | Expect, 1>>, 6 | Expect, 9>>, 7 | Expect, 400>>, 8 | Expect, 10000>>, 9 | 10 | // Negative numbers 11 | Expect, 4>>, 12 | Expect, 25>>, 13 | Expect, 961>>, 14 | Expect, 2500>>, 15 | ] 16 | -------------------------------------------------------------------------------- /questions/27152-medium-triangular-number/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: Triangular number 3 | tags: tuple, array, math 4 | author: 5 | github: aswinsvijay 6 | name: null 7 | -------------------------------------------------------------------------------- /questions/27152-medium-triangular-number/template.ts: -------------------------------------------------------------------------------- 1 | type Triangular = any 2 | -------------------------------------------------------------------------------- /questions/27152-medium-triangular-number/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, 0>>, 5 | Expect, 1>>, 6 | Expect, 6>>, 7 | Expect, 55>>, 8 | Expect, 210>>, 9 | Expect, 1540>>, 10 | Expect, 5050>>, 11 | ] 12 | -------------------------------------------------------------------------------- /questions/27862-medium-cartesianproduct/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: CartesianProduct 3 | tags: union 4 | author: 5 | github: jazelly 6 | name: jazelly 7 | -------------------------------------------------------------------------------- /questions/27862-medium-cartesianproduct/template.ts: -------------------------------------------------------------------------------- 1 | type CartesianProduct = any 2 | -------------------------------------------------------------------------------- /questions/27862-medium-cartesianproduct/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, [2, 'a'] | [1, 'a'] | [2, 'b'] | [1, 'b']>>, 5 | Expect, [2, 'a'] | [1, 'a'] | [3, 'a'] | [2, 'b'] | [1, 'b'] | [3, 'b'] | [2, 'c'] | [1, 'c'] | [3, 'c']>>, 6 | Expect, [2, 'a'] | [1, 'a'] >>, 7 | Expect, ['a', Function] | ['a', string]>>, 8 | ] 9 | -------------------------------------------------------------------------------- /questions/27932-medium-mergeall/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: MergeAll 3 | tags: object, array, union 4 | author: 5 | github: scarf005 6 | name: scarf 7 | -------------------------------------------------------------------------------- /questions/27932-medium-mergeall/template.ts: -------------------------------------------------------------------------------- 1 | type MergeAll = any 2 | -------------------------------------------------------------------------------- /questions/27932-medium-mergeall/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, {} >>, 5 | Expect, { a: 1 }>>, 6 | Expect, 8 | { a: string } 9 | > 10 | >, 11 | Expect, 13 | { a: string } 14 | > 15 | >, 16 | Expect, 18 | { a: 1, c: 2 } 19 | > 20 | >, 21 | Expect, 23 | { a: 1 | 2, b: 2, c: 3 } 24 | > 25 | >, 26 | Expect, { a: number }>>, 27 | Expect, { a: number }>>, 28 | Expect, { a: 1 | 2 | 3 }>>, 29 | ] 30 | -------------------------------------------------------------------------------- /questions/27958-medium-checkrepeatedtuple/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: CheckRepeatedTuple 3 | author: 4 | github: jiaowoxiaobala 5 | name: bowen 6 | -------------------------------------------------------------------------------- /questions/27958-medium-checkrepeatedtuple/info.zh-CN.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: CheckRepeatedTuple 3 | author: 4 | github: jiaowoxiaobala 5 | name: bowen 6 | -------------------------------------------------------------------------------- /questions/27958-medium-checkrepeatedtuple/template.ts: -------------------------------------------------------------------------------- 1 | type CheckRepeatedTuple = any 2 | -------------------------------------------------------------------------------- /questions/27958-medium-checkrepeatedtuple/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, true>>, 5 | Expect, false>>, 6 | Expect, false>>, 7 | Expect, true>>, 8 | Expect, false>>, 9 | Expect, false>>, 10 | ] 11 | -------------------------------------------------------------------------------- /questions/28143-hard-optionalundefined/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: hard 2 | title: OptionalUndefined 3 | author: 4 | github: JesusTheHun 5 | name: Jesus The Hun 6 | -------------------------------------------------------------------------------- /questions/28143-hard-optionalundefined/template.ts: -------------------------------------------------------------------------------- 1 | type OptionalUndefined = any 2 | -------------------------------------------------------------------------------- /questions/28333-medium-public-type/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: Public Type 3 | tags: object-keys 4 | author: 5 | github: kaikaibenkai 6 | name: KaiKai 7 | -------------------------------------------------------------------------------- /questions/28333-medium-public-type/template.ts: -------------------------------------------------------------------------------- 1 | type PublicType = any 2 | -------------------------------------------------------------------------------- /questions/28333-medium-public-type/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, { a: number }>>, 5 | Expect, {}>>, 6 | Expect, { readonly c?: number }>>, 7 | Expect, { d: string }>>, 8 | Expect bigint[] }>, {}>>, 9 | Expect, { g: '_g' }>>, 10 | Expect, { i: unknown }>>, 11 | ] 12 | -------------------------------------------------------------------------------- /questions/29650-medium-extracttoobject/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: ExtractToObject 3 | tags: object 4 | author: 5 | github: bazuka5801 6 | name: Maxim Bazuev 7 | -------------------------------------------------------------------------------- /questions/29650-medium-extracttoobject/template.ts: -------------------------------------------------------------------------------- 1 | type ExtractToObject = any 2 | -------------------------------------------------------------------------------- /questions/29785-medium-deep-omit/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: Deep Omit 3 | tags: omit object-keys deep 4 | author: 5 | github: jiaowoxiaobala 6 | name: bowen 7 | -------------------------------------------------------------------------------- /questions/29785-medium-deep-omit/template.ts: -------------------------------------------------------------------------------- 1 | type DeepOmit = any 2 | -------------------------------------------------------------------------------- /questions/29785-medium-deep-omit/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type obj = { 4 | person: { 5 | name: string 6 | age: { 7 | value: number 8 | } 9 | } 10 | } 11 | 12 | type cases = [ 13 | Expect, {}>>, 14 | Expect, { person: { age: { value: number } } }>>, 15 | Expect, obj>>, 16 | Expect, { person: { name: string, age: {} } }>>, 17 | ] 18 | -------------------------------------------------------------------------------- /questions/30301-medium-isodd/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: IsOdd 3 | tags: string 4 | author: 5 | github: jiangshanmeta 6 | name: jiangshan 7 | -------------------------------------------------------------------------------- /questions/30301-medium-isodd/template.ts: -------------------------------------------------------------------------------- 1 | type IsOdd = any 2 | -------------------------------------------------------------------------------- /questions/30301-medium-isodd/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, true>>, 5 | Expect, true>>, 6 | Expect, false>>, 7 | Expect, false>>, 8 | ] 9 | -------------------------------------------------------------------------------- /questions/30430-medium-tower-of-hanoi/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: Tower of hanoi 3 | tags: array 4 | author: 5 | github: aswinsvijay 6 | name: null 7 | -------------------------------------------------------------------------------- /questions/30430-medium-tower-of-hanoi/template.ts: -------------------------------------------------------------------------------- 1 | type Hanoi = any 2 | -------------------------------------------------------------------------------- /questions/30430-medium-tower-of-hanoi/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type Tests = [ 4 | Expect, []>>, 5 | Expect, [['A', 'B']]>>, 6 | Expect, [['A', 'C'], ['A', 'B'], ['C', 'B']]>>, 7 | Expect, [['A', 'B'], ['A', 'C'], ['B', 'C'], ['A', 'B'], ['C', 'A'], ['C', 'B'], ['A', 'B']]>>, 8 | Expect, [['A', 'B'], ['A', 'C'], ['B', 'C'], ['A', 'B'], ['C', 'A'], ['C', 'B'], ['A', 'B'], ['A', 'C'], ['B', 'C'], ['B', 'A'], ['C', 'A'], ['B', 'C'], ['A', 'B'], ['A', 'C'], ['B', 'C'], ['A', 'B'], ['C', 'A'], ['C', 'B'], ['A', 'B'], ['C', 'A'], ['B', 'C'], ['B', 'A'], ['C', 'A'], ['C', 'B'], ['A', 'B'], ['A', 'C'], ['B', 'C'], ['A', 'B'], ['C', 'A'], ['C', 'B'], ['A', 'B']]>>, 9 | ] 10 | -------------------------------------------------------------------------------- /questions/30575-hard-bitwisexor/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: hard 2 | title: BitwiseXOR 3 | author: 4 | github: jiangshanmeta 5 | name: jiangshan 6 | -------------------------------------------------------------------------------- /questions/30575-hard-bitwisexor/template.ts: -------------------------------------------------------------------------------- 1 | type BitwiseXOR = any 2 | -------------------------------------------------------------------------------- /questions/30575-hard-bitwisexor/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, '1'>>, 5 | Expect, '0'>>, 6 | Expect, '11'>>, 7 | Expect, '111'>>, 8 | Expect, '110'>>, 9 | ] 10 | -------------------------------------------------------------------------------- /questions/30958-medium-pascals-triangle/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: Pascal's triangle 3 | tags: array, math 4 | author: 5 | github: aswinsvijay 6 | name: Aswin S Vijay 7 | -------------------------------------------------------------------------------- /questions/30958-medium-pascals-triangle/template.ts: -------------------------------------------------------------------------------- 1 | type Pascal = any 2 | -------------------------------------------------------------------------------- /questions/30970-medium-shitariteraru/info.ja.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: 確定した文字列リテラル 3 | author: 4 | github: sugoroku-y 5 | name: 蛭子屋双六 6 | -------------------------------------------------------------------------------- /questions/30970-medium-shitariteraru/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: medium 2 | title: IsFixedStringLiteralType 3 | author: 4 | github: sugoroku-y 5 | name: 蛭子屋双六 6 | -------------------------------------------------------------------------------- /questions/30970-medium-shitariteraru/template.ts: -------------------------------------------------------------------------------- 1 | type IsFixedStringLiteralType = any 2 | -------------------------------------------------------------------------------- /questions/31447-extreme-countreversepairs/info.yml: -------------------------------------------------------------------------------- 1 | difficulty: extreme 2 | title: CountReversePairs 3 | related: 741 4 | author: 5 | github: jiangshanmeta 6 | name: jiangshan 7 | -------------------------------------------------------------------------------- /questions/31447-extreme-countreversepairs/template.ts: -------------------------------------------------------------------------------- 1 | type CountReversePairs = any 2 | -------------------------------------------------------------------------------- /questions/31447-extreme-countreversepairs/test-cases.ts: -------------------------------------------------------------------------------- 1 | import type { Equal, Expect } from '@type-challenges/utils' 2 | 3 | type cases = [ 4 | Expect, 4>>, 5 | Expect, 0>>, 6 | Expect, 0>>, 7 | Expect, 0>>, 8 | ] 9 | -------------------------------------------------------------------------------- /screenshots/logo-dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/k8adev/type-challenges/6e02d139d0975cbd90de9042cb7af67e9ec75abb/screenshots/logo-dark.png -------------------------------------------------------------------------------- /screenshots/logo-light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/k8adev/type-challenges/6e02d139d0975cbd90de9042cb7af67e9ec75abb/screenshots/logo-light.png -------------------------------------------------------------------------------- /screenshots/logo-mask.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/k8adev/type-challenges/6e02d139d0975cbd90de9042cb7af67e9ec75abb/screenshots/logo-mask.png -------------------------------------------------------------------------------- /scripts/actions/loader.ts: -------------------------------------------------------------------------------- 1 | import process from 'node:process' 2 | import * as core from '@actions/core' 3 | import { context, getOctokit } from '@actions/github' 4 | import * as io from '@actions/io' 5 | 6 | process.on('unhandledRejection', handleError) 7 | main().catch(handleError) 8 | 9 | async function main(): Promise { 10 | const token = process.argv[2] 11 | const fnName = process.argv[3] 12 | const github = getOctokit(token) 13 | 14 | // eslint-disable-next-line ts/no-var-requires 15 | const fn = require(`./${fnName}.ts`) 16 | fn.default(github, context, core, io) 17 | } 18 | 19 | function handleError(err: any): void { 20 | console.error(err) 21 | core.setFailed(`Unhandled error: ${err}`) 22 | process.exit(1) 23 | } 24 | -------------------------------------------------------------------------------- /scripts/actions/utils/toCommentBlock.ts: -------------------------------------------------------------------------------- 1 | export const toCommentBlock = function (text: string) { 2 | return `/*\n${ 3 | text 4 | .trim() 5 | .split('\n') 6 | .map(i => i.trim() ? ` ${i}`.trimEnd() : '') 7 | .join('\n') 8 | }\n*/\n` 9 | } 10 | -------------------------------------------------------------------------------- /scripts/actions/utils/toDivider.ts: -------------------------------------------------------------------------------- 1 | export const toDivider = function (text: string) { 2 | return `\n/* _____________ ${text} _____________ */\n` 3 | } 4 | -------------------------------------------------------------------------------- /scripts/actions/utils/toFooter.ts: -------------------------------------------------------------------------------- 1 | import type { Quiz } from '../../types' 2 | 3 | import type { SupportedLocale } from '../../locales' 4 | import { t } from '../../locales' 5 | import { toAnswerShort, toHomepageShort, toSolutionsShort } from '../../toUrl' 6 | 7 | export const toFooter = function (quiz: Quiz, locale: SupportedLocale) { 8 | return '\n\n' 9 | + `> ${t(locale, 'link.share-solutions')}${toAnswerShort(quiz.no, locale)}\n` 10 | + `> ${t(locale, 'link.checkout-solutions')}${toSolutionsShort(quiz.no)}\n` 11 | + `> ${t(locale, 'link.more-challenges')}${toHomepageShort(locale)}\n` 12 | } 13 | -------------------------------------------------------------------------------- /scripts/actions/utils/toInfoHeader.ts: -------------------------------------------------------------------------------- 1 | import type { Quiz } from '../../types' 2 | import type { SupportedLocale } from '../../locales' 3 | import { t } from '../../locales' 4 | import { resolveInfo } from '../../loader' 5 | 6 | export const toInfoHeader = function toInfoHeader(quiz: Quiz, locale: SupportedLocale) { 7 | const info = resolveInfo(quiz, locale) 8 | 9 | const author = `${info.author?.name} (@${info?.author?.github})` 10 | 11 | return `${quiz.no} - ${info.title || ''}\n` 12 | + '-------\n' 13 | + `by ${author} #${t(locale, `difficulty.${quiz.difficulty}`)} ${info?.tags?.map(i => `#${i}`).join(' ') || ''}\n\n` 14 | + `### ${t(locale, 'title.question')}\n\n` 15 | } 16 | -------------------------------------------------------------------------------- /scripts/actions/utils/toLinks.ts: -------------------------------------------------------------------------------- 1 | import type { Quiz } from '../../types' 2 | import type { SupportedLocale } from '../../locales' 3 | import { t } from '../../locales' 4 | import { toReadmeShort } from '../../toUrl' 5 | 6 | export function toLinks(quiz: Quiz, locale: SupportedLocale) { 7 | return '\n\n' 8 | + `> ${t(locale, 'link.view-on-github')}${toReadmeShort(quiz.no, locale)}` 9 | } 10 | -------------------------------------------------------------------------------- /scripts/locales/zh-CN.json: -------------------------------------------------------------------------------- 1 | { 2 | "badge.back": "返回首页", 3 | "badge.checkout-solutions": "查看解答", 4 | "badge.share-your-solutions": "分享你的解答", 5 | "badge.take-the-challenge": "接受挑战", 6 | "badge.preview-playground": "在 Playground 中预览", 7 | "details.by-tags": "按标签", 8 | "details.by-plain-text": "通过纯文本", 9 | "difficulty.easy": "简单", 10 | "difficulty.extreme": "地狱", 11 | "difficulty.hard": "困难", 12 | "difficulty.medium": "中等", 13 | "difficulty.warm": "热身", 14 | "display": "简体中文", 15 | "divider.code-start": "你的代码", 16 | "divider.further-steps": "下一步", 17 | "divider.test-cases": "测试用例", 18 | "link.checkout-solutions": "查看解答:", 19 | "link.more-challenges": "更多题目:", 20 | "link.share-solutions": "分享你的解答:", 21 | "link.view-on-github": "在 Github 上查看:", 22 | "readme.related-challenges": "相关挑战", 23 | "readme.google-translated": "由谷歌自动翻译,欢迎 PR 改进翻译质量。", 24 | "title.question": "题目" 25 | } 26 | -------------------------------------------------------------------------------- /scripts/netlify.sh: -------------------------------------------------------------------------------- 1 | cd .. 2 | npx pnpm i --store=node_modules/.pnpm-store 3 | npm run build 4 | cd scripts 5 | cp -r ../site/*.* dist 6 | -------------------------------------------------------------------------------- /scripts/netlify.toml: -------------------------------------------------------------------------------- 1 | [build] 2 | ignore = "git diff --quiet HEAD^ HEAD .." 3 | 4 | [build.environment] 5 | NODE_VERSION = "20" 6 | 7 | [[redirects]] 8 | from = "/" 9 | to = "/index.html" 10 | status = 200 11 | 12 | [[headers]] 13 | for = "/*" 14 | 15 | [headers.values] 16 | Access-Control-Allow-Origin = "*" 17 | -------------------------------------------------------------------------------- /scripts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@type-challenges/scripts", 3 | "version": "1.0.0", 4 | "private": true, 5 | "dependencies": { 6 | "@actions/core": "^1.10.1", 7 | "@actions/github": "^6.0.0", 8 | "@actions/io": "^1.1.3", 9 | "@type-challenges/octokit-create-pull-request": "^0.1.9", 10 | "@vitalets/google-translate-api": "^9.2.0", 11 | "esno": "^4.0.0", 12 | "fast-glob": "^3.3.2", 13 | "fs-extra": "^11.2.0", 14 | "js-yaml": "^4.1.0", 15 | "limax": "^4.1.0", 16 | "lz-string": "^1.5.0" 17 | }, 18 | "devDependencies": { 19 | "@octokit/types": "^12.4.0", 20 | "@types/js-yaml": "^4.0.9", 21 | "@types/lz-string": "^1.5.0" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /scripts/translate-cli.ts: -------------------------------------------------------------------------------- 1 | import { updateREADMEs } from './readme' 2 | import { translateAllQuizes } from './translate' 3 | import { defaultLocale } from './locales' 4 | 5 | async function run() { 6 | await translateAllQuizes(defaultLocale, 'zh-CN') 7 | await translateAllQuizes(defaultLocale, 'ja') 8 | await translateAllQuizes(defaultLocale, 'pt-BR') 9 | await updateREADMEs() 10 | } 11 | 12 | run() 13 | -------------------------------------------------------------------------------- /scripts/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es2017", 4 | "lib": ["ESNext"], 5 | "module": "esnext", 6 | "moduleResolution": "node", 7 | "allowJs": true, 8 | "strict": true, 9 | "noImplicitReturns": true, 10 | "noUnusedLocals": false, 11 | "noUnusedParameters": true, 12 | "esModuleInterop": true, 13 | "skipLibCheck": true 14 | }, 15 | "exclude": ["node_modules", "dist"] 16 | } 17 | -------------------------------------------------------------------------------- /scripts/utils/resolve.ts: -------------------------------------------------------------------------------- 1 | import { defaultLocale } from '../locales' 2 | 3 | export function resolveFilePath(dir: string, name: string, ext: string, locale: string) { 4 | if (locale === defaultLocale) 5 | return `${dir}/${name}.${ext}` 6 | else 7 | return `${dir}/${name}.${locale}.${ext}` 8 | } 9 | -------------------------------------------------------------------------------- /site/favicon.svg: -------------------------------------------------------------------------------- 1 | <T> -------------------------------------------------------------------------------- /tsconfig.base.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es2017", 4 | "lib": ["ESNext"], 5 | "module": "esnext", 6 | "moduleResolution": "node", 7 | "allowJs": true, 8 | "strict": true, 9 | "noImplicitReturns": true, 10 | "noUnusedLocals": false, 11 | "noUnusedParameters": true, 12 | "esModuleInterop": true, 13 | "skipLibCheck": true 14 | }, 15 | "exclude": ["node_modules", "dist"] 16 | } 17 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.base.json", 3 | "compilerOptions": { 4 | "module": "commonjs" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /utils/README.md: -------------------------------------------------------------------------------- 1 | # Type Utilities 2 | 3 | for [Type Challenges](https://github.com/antfu/type-challenges) -------------------------------------------------------------------------------- /utils/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@type-challenges/utils", 3 | "version": "0.1.1", 4 | "license": "MIT", 5 | "types": "index.d.ts", 6 | "files": [ 7 | "index.d.ts" 8 | ], 9 | "scripts": { 10 | "release": "pnpx bumpp --commit --tag && pnpm publish" 11 | }, 12 | "devDependencies": { 13 | "typescript": "^5.3.3" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /utils/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.base.json" 3 | } 4 | --------------------------------------------------------------------------------