Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Collection of TypeScript type challenges with online judge

License

NotificationsYou must be signed in to change notification settings

type-challenges/type-challenges

Repository files navigation

Collection of TypeScript type challenges


English |简体中文 |日本語 |한국어 |Português

Intro

by the power of TypeScript's well-knownTuring Completed type system

High-quality types can help improve projects' maintainability while avoiding potential bugs.

This project is aimed at helping you better understand how the type system works, writing your own utilities, or just having fun with the challenges. We are also trying to form a community where you can ask questions and get answers you have faced in the real world - they may become part of the challenges!

You can also use some existing type utility libraries such astype-fest. There are also some stale packages (not actively maintained) that you could reference, likeutility-types,ts-toolbelt,SimplyTyped.

Challenges

Click the following badges to see details of the challenges.

Note: Challenges work in thestrict mode.


1
13・Hello World

13
4・Pick7・Readonly11・Tuple to Object14・First of Array18・Length of Tuple43・Exclude189・Awaited268・If533・Concat898・Includes3057・Push3060・Unshift3312・Parameters

103
2・Get Return Type3・Omit8・Readonly 29・Deep Readonly10・Tuple to Union12・Chainable Options15・Last of Array16・Pop20・Promise.all62・Type Lookup106・Trim Left108・Trim110・Capitalize116・Replace119・ReplaceAll191・Append Argument296・Permutation298・Length of String459・Flatten527・Append to object529・Absolute531・String to Union599・Merge612・KebabCase645・Diff949・AnyOf1042・IsNever1097・IsUnion1130・ReplaceKeys1367・Remove Index Signature1978・Percentage Parser2070・Drop Char2257・MinusOne2595・PickByType2688・StartsWith2693・EndsWith2757・PartialByKeys2759・RequiredByKeys2793・Mutable2852・OmitByType2946・ObjectEntries3062・Shift3188・Tuple to Nested Object3192・Reverse3196・Flip Arguments3243・FlattenDepth3326・BEM style string3376・InorderTraversal4179・Flip4182・Fibonacci Sequence4260・AllCombinations4425・Greater Than4471・Zip4484・IsTuple4499・Chunk4518・Fill4803・Trim Right5117・Without5140・Trunc5153・IndexOf5310・Join5317・LastIndexOf5360・Unique5821・MapTypes7544・Construct Tuple8640・Number Range8767・Combination8987・Subsequence9142・CheckRepeatedChars9286・FirstUniqueCharIndex9616・Parse URL Params9896・GetMiddleElement9898・Appear only once9989・Count Element Number To Object10969・Integer16259・ToPrimitive17973・DeepMutable18142・All18220・Filter21104・FindAll21106・Combination key type21220・Permutations of Tuple25170・Replace First25270・Transpose26401・JSON Schema to TypeScript27133・Square27152・Triangular number27862・CartesianProduct27932・MergeAll27958・CheckRepeatedTuple28333・Public Type29650・ExtractToObject29785・Deep Omit30301・IsOdd30430・Tower of hanoi30958・Pascal's triangle30970・IsFixedStringLiteralType34007・Compare Array Length34857・Defined Partial Record35045・Longest Common Prefix35191・Trace35252・IsAlphabet35991・MyUppercase

55
6・Simple Vue17・Currying 155・Union to Intersection57・Get Required59・Get Optional89・Required Keys90・Optional Keys112・Capitalize Words114・CamelCase147・C-printf Parser213・Vue Basic Props223・IsAny270・Typed Get300・String to Number399・Tuple Filter472・Tuple to Enum Object545・printf553・Deep object to unique651・Length of String 2730・Union to Tuple847・String Join956・DeepPick1290・Pinia1383・Camelize2059・Drop String2822・Split2828・ClassPublicKeys2857・IsRequiredKey2949・ObjectFromEntries4037・IsPalindrome5181・Mutable Keys5423・Intersection6141・Binary to Decimal7258・Object Key Paths8804・Two Sum9155・ValidDate9160・Assign9384・Maximum9775・Capitalize Nest Object Keys13580・Replace Union14080・FizzBuzz14188・Run-length encoding15260・Tree path array19458・SnakeCase25747・IsNegativeNumber28143・OptionalUndefined30178・Unique Items30575・BitwiseXOR31797・Sudoku31824・Length of String 332427・Unbox32532・Binary Addition33763・Union to Object from key34286・Take Elements35314・Valid Sudoku

17
5・Get Readonly Keys151・Query String Parser216・Slice274・Integers Comparator462・Currying 2476・Sum517・Multiply697・Tag734・Inclusive Range741・Sort869・DistributeUnions925・Assert Array Index6228・JSON Parser7561・Subtract31447・CountReversePairs31997・Parameter Intersection33345・Dynamic Route

By Tags
#JSON26401・JSON Schema to TypeScript6228・JSON Parser
#application12・Chainable Options8767・Combination6・Simple Vue213・Vue Basic Props30178・Unique Items
#arguments191・Append Argument3196・Flip Arguments
#array14・First of Array533・Concat898・Includes3057・Push3060・Unshift15・Last of Array16・Pop20・Promise.all459・Flatten949・AnyOf3062・Shift3243・FlattenDepth4425・Greater Than5117・Without5153・IndexOf5310・Join5317・LastIndexOf5360・Unique8767・Combination18142・All18220・Filter25270・Transpose27133・Square27152・Triangular number27932・MergeAll30430・Tower of hanoi30958・Pascal's triangle34007・Compare Array Length17・Currying 12822・Split5423・Intersection8804・Two Sum9160・Assign9384・Maximum9775・Capitalize Nest Object Keys14080・FizzBuzz31797・Sudoku32427・Unbox32532・Binary Addition34286・Take Elements35314・Valid Sudoku216・Slice734・Inclusive Range741・Sort925・Assert Array Index31997・Parameter Intersection
#built-in4・Pick7・Readonly43・Exclude189・Awaited3312・Parameters2・Get Return Type3・Omit
#cif30178・Unique Items
#conditional type21220・Permutations of Tuple
#deep9・Deep Readonly17973・DeepMutable553・Deep object to unique956・DeepPick
#filter18220・Filter
#function32427・Unbox
#game31797・Sudoku35314・Valid Sudoku
#infer3312・Parameters2・Get Return Type10・Tuple to Union2070・Drop Char4260・AllCombinations9616・Parse URL Params55・Union to Intersection57・Get Required59・Get Optional399・Tuple Filter730・Union to Tuple2059・Drop String14080・FizzBuzz734・Inclusive Range741・Sort
#intersection31997・Parameter Intersection
#map62・Type Lookup5821・MapTypes
#math529・Absolute2257・MinusOne25270・Transpose27133・Square27152・Triangular number30958・Pascal's triangle6141・Binary to Decimal8804・Two Sum14080・FizzBuzz35314・Valid Sudoku274・Integers Comparator476・Sum517・Multiply
#number25747・IsNegativeNumber
#object599・Merge645・Diff2595・PickByType2757・PartialByKeys2759・RequiredByKeys2852・OmitByType2946・ObjectEntries3188・Tuple to Nested Object3376・InorderTraversal4179・Flip5821・MapTypes27932・MergeAll29650・ExtractToObject2949・ObjectFromEntries9160・Assign9775・Capitalize Nest Object Keys
#object-keys7・Readonly11・Tuple to Object8・Readonly 29・Deep Readonly527・Append to object1130・ReplaceKeys1367・Remove Index Signature2793・Mutable28333・Public Type7258・Object Key Paths5・Get Readonly Keys
#omit object-keys deep29785・Deep Omit
#optional31997・Parameter Intersection
#parameters31997・Parameter Intersection
#promise189・Awaited20・Promise.all32427・Unbox
#readonly7・Readonly8・Readonly 29・Deep Readonly2793・Mutable17973・DeepMutable
#recursion21220・Permutations of Tuple34007・Compare Array Length1383・Camelize32532・Binary Addition
#rest31997・Parameter Intersection
#split2822・Split
#string531・String to Union8767・Combination9142・CheckRepeatedChars9286・FirstUniqueCharIndex9616・Parse URL Params21104・FindAll30301・IsOdd2822・Split4037・IsPalindrome19458・SnakeCase
#template-literal106・Trim Left108・Trim110・Capitalize116・Replace119・ReplaceAll298・Length of String529・Absolute612・KebabCase1978・Percentage Parser2070・Drop Char2688・StartsWith2693・EndsWith3326・BEM style string4260・AllCombinations4803・Trim Right5140・Trunc9616・Parse URL Params10969・Integer21104・FindAll112・Capitalize Words114・CamelCase147・C-printf Parser270・Typed Get300・String to Number472・Tuple to Enum Object545・printf651・Length of String 22059・Drop String19458・SnakeCase25747・IsNegativeNumber151・Query String Parser274・Integers Comparator476・Sum517・Multiply6228・JSON Parser
#this6・Simple Vue1290・Pinia
#tuple18・Length of Tuple3312・Parameters10・Tuple to Union3188・Tuple to Nested Object3192・Reverse3326・BEM style string4471・Zip4484・IsTuple4499・Chunk4518・Fill7544・Construct Tuple21220・Permutations of Tuple27133・Square27152・Triangular number399・Tuple Filter472・Tuple to Enum Object730・Union to Tuple2822・Split30178・Unique Items31797・Sudoku32427・Unbox7561・Subtract
#union4・Pick43・Exclude3・Omit10・Tuple to Union62・Type Lookup296・Permutation531・String to Union1042・IsNever1097・IsUnion3326・BEM style string4260・AllCombinations5117・Without8987・Subsequence9142・CheckRepeatedChars21220・Permutations of Tuple27862・CartesianProduct27932・MergeAll730・Union to Tuple1383・Camelize5423・Intersection31797・Sudoku
#utils268・If1042・IsNever5821・MapTypes55・Union to Intersection57・Get Required59・Get Optional89・Required Keys90・Optional Keys223・IsAny270・Typed Get2828・ClassPublicKeys2857・IsRequiredKey5181・Mutable Keys32427・Unbox5・Get Readonly Keys
#variadic31997・Parameter Intersection
#vue6・Simple Vue213・Vue Basic Props1290・Pinia
          

By Plain Text

warm-up (1)

easy (13)

medium (103)

hard (55)

extreme (17)


Upcoming challenges

🔥 Start the challenge inTypeScript Playground

🚀 Start the challenge locally inyour IDE or text editor with TypeScript language support

⚡️ Start the challenge inVS Code Extension

Recommended Readings

Official

Articles

Talks

Projects / Solutions

Books

How to Contribute

There are several ways you can contribute to this project

  • Share your answers / solutions
  • Propose new challenges
  • Add more test cases to the existing challenges
  • Provide learning resources or ideas of how to solve challenges
  • Share the problems you have faced in real-world projects, regardless you having the solution or not - the community would help you as well
  • Help with others by discussion in issues
  • Contribute the infra of this projectTODOs.md

Justopen an issue and choose the corresponding template. Thanks!

Play Locally

You can build the challenges and play locally using your preferred IDE or text editor with TypeScript language support.

To do that, you will need the latest version ofNode.js andpnpm installed.

After cloning the repo, installed the dependencies by:

pnpm install

Then and run thegenerate script:

pnpm generate

It will prompt you to select the desired language, then you can find the generated challenges in the./playground folder.

Later if you want to update playground while keeping your changes:

pnpm generate --keep-changes

OR

pnpm generate -K

Thanks

This project was born from solving real-world types problem with@hardfist and@MeCKodo. And great thanks to@sinoon who contributed a lot while giving early feedback on this project.

Inspired by

Contributors

Star History Chart

License

MIT

About

Collection of TypeScript type challenges with online judge

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Sponsor this project

 

Contributors277

Languages


[8]ページ先頭

©2009-2025 Movatter.jp