Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/agalabov/only-types
https://github.com/agalabov/only-types
Last synced: 9 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/agalabov/only-types
- Owner: AGalabov
- License: mit
- Created: 2022-08-13T15:08:03.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2024-03-06T11:58:40.000Z (8 months ago)
- Last Synced: 2024-03-06T12:38:51.837Z (8 months ago)
- Language: TypeScript
- Size: 15.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# No functions only types
Solving the puzzles using variables, loops and functions is cool and all. But have you tried using types only?
## My personal knowledge base of TS keywords for mapped types:
- `keyof`: Used to fetch a union of keys from a given type. Useful in mapped types to operate on each property of a type.
- `extends`: Used in conditional types to check if a type is a subtype of another. It's essentially an if condition for types.
- `infer`: Used within conditional types to infer a type within a conditional branch. This inferred type can then be used in further branches of the conditional type.
- `in`: Used in mapped types to iterate over all keys of an object type.
- `as`: Used in key remapping in mapped types. It allows you to take an existing key and map it to a new key in the resulting type.
- `typeof`: Used to derive the type of a given expression.