type-fest
graphql-utils
Our great sponsors
type-fest | graphql-utils | |
---|---|---|
32 | 30 | |
13,221 | 49 | |
- | - | |
9.0 | 0.0 | |
about 14 hours ago | almost 2 years ago | |
TypeScript | TypeScript | |
Creative Commons Zero v1.0 Universal | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
type-fest
-
Adding type safety to object IDs in TypeScript
Related: https://github.com/sindresorhus/type-fest/blob/main/source/o...
-
Enforcing Localization through Types
Typescript doesn’t natively provide an Opaque type that we can use to define a string that has already been localized. If the data looks like a string, Typescript will consider it a string. We can however use utility types that simulate opaque types, like the Opaque definition in type-fest:
- Is there a better way to do read-only types
-
Boost Your JavaScript with JSDoc Typing
With these powerful features, you can create dynamic and expressive types. One last thing I want to mention before moving on, is that you can install libraries with which you can add more types to your project like type-fest or utility-types. These libraries contain a lot of useful types that you can use in your project.
-
Essential Code Organization Principles
Also, it’s not as restrictive as mutability tools — if you know what you are doing and want to ignore this limitation for a particular case, you can apply the -readonly modifier or the Writeable type from type-fest or ts-essentials.
-
Best practice for typing server data for get vs post in client code
Remember you can derive one type from another type so you can make sure they don't diverge. SetOptional type util
-
All JavaScript and TypeScript features of the last 3 years explained
Some folks have built whole SQL databases and DSL compilers in the TS type system. These tend to be toy projects with disclaimers not to use them. But the type system being Turing complete[0] (for better or worse), pretty much whatever you can imagine. This project[1] is one I actually return to frequently for practical ideas.
0: https://github.com/microsoft/TypeScript/issues/14833
1: https://github.com/sindresorhus/type-fest
-
Question on how to handle an object that can have different states and avoid assertions.
Have a look at SetRequired and SetOptional in type-fest
-
Preventing more parameters being passed than needed by a type definition?
Try the Exact method provided by Type Fest, looks like it does what you're looking for
-
Creating a derived type of only required parameters from a base type?
This is a fairly common scenario and available via libraries like type-fest or implementable with a couple lines of code.
graphql-utils
-
How do I do Authorization Properly?
This is what I meant you should be doing anyway. Dataloader or simple field resolvers are extremely inefficient. You can use a library I created - GraphQL-Utils - to retrieve a mapping of the fields you need to JOIN and then do so with your ORM or data mapping technology of choice (Prisma, Knex.js, etc.)
- I'm new to GraphQL: Why use Apollo Server over express-graphql ? Pros & cons of both?
-
Seeking some feedback on my graphql api
By the way, I see you're using Docusaurus, something that might be kind of cool to integrate is a live GraphQL playground with some mock data if you want to spruce it up. I have a documentation for my own library, GraphQL-Utils that does this. Might be worth checking out the source code for my Sandbox component!
- Advanced Promises in Javascript (Dataloader Pattern)
-
I wrote a type for enforcing some type safety on 'path strings'. StackBlitz link in comments.
If you would like to see how I've gone about implementing it so far, I opened a new branch, keymap, in the GraphQL-Utils GitHub repository and if you happen to have any input on those problems I mentioned I'd really appreciate it!
-
Requesting explicit fields and relations in GraphQL queries. 🔥
I released a library, GraphQL-Utils, which contains helpers such as resolveSelections(), as well as a full NestJS integration that ships with decorators like @Selections(), which you can see above. It supports wildcards to retrieve fields that contain subselections, flat fields, deep fields, and many more options!
-
New project using postgres which creates join queries on the fly for relations rather than using resolvers
GitHub - Jenyus-Org/graphql-utils: Utilities and helpers to make working with GraphQL.js based APIs simpler.
-
What's your best nodejs framework?
I come from C# and Java so the structure just makes so much more sense and the tooling is way better. I also love the GraphQL integration and made a library to optimize queries, so yeah, I'm stuck in the ecosystem.
-
10 Things Every Nest.js Developer Should Know
Check out my blog post on GraphQL-Utils if you use NestJS for GraphQL projects!
-
Is ExpressJS dead?
NestJS is amazing. I've been spending a lot of time with it and using its GraphQL integration to build hybrid APIs. I like it so much that I spent some time figuring out how to optimize query relations and wrote a package to aid in doing so called GraphQL-Utils.
What are some alternatives?
ts-toolbelt - 👷 TypeScript's largest type utility library
tsyringe - Lightweight dependency injection container for JavaScript/TypeScript
runtypes - Runtime validation for static types
tss-react - ✨ Dynamic CSS-in-TS solution, based on Emotion
graphql-tools - :wrench: Utility library for GraphQL to build, stitch and mock GraphQL schemas in the SDL-first approach
zod - TypeScript-first schema validation with static type inference
nodejs-api-starter - 💥 Yarn v2 based monorepo template (seed project) pre-configured with GraphQL API, PostgreSQL, React, Relay, and Material UI. [Moved to: https://github.com/kriasoft/relay-starter-kit]
ts-essentials - All essential TypeScript types in one place 🤙
Nest - A progressive Node.js framework for building efficient, scalable, and enterprise-grade server-side applications with TypeScript/JavaScript 🚀
variant - Variant types in TypeScript
io-ts - Runtime type system for IO decoding/encoding