-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
What are Utility Types? #1
Comments
Hello 🙂 Yes, "utility type" is the right terminology as it comes directly from the official TypeScript website, per the link you shared. Utility types are mapped types and conditional types that are defined and exposed from TypeScript itself (cf. lib.es5.d.ts). They are called "utility" because they are great at doing common operations on types. You can define your own utility types in your projects depending on your needs, as "utility" is just a label put on top of a group of mapped and conditional types.
This is actually a great way of seeing types that take other types as parameter(s). Any type that has at least 1 type parameter can be considered a "function at the type-level". But generally, these types are called "generic types" instead of "functions" or "type transformers". |
https://www.typescriptlang.org/docs/handbook/utility-types.html#excludeuniontype-excludedmembers
To me these seems like
type functions
? But I don't thinkfunctions
is the right word.Is
utility types
the right nomenclature in TypeScript world?Utility types = tools that transform types? type transformers?
Utility types = type constructors?
The text was updated successfully, but these errors were encountered: