Releases: plainbrew/next-utils
Releases · plainbrew/next-utils
@plainbrew/next-typed-href@0.3.0
Minor Changes
-
#58
34f31dfThanks @amotarao! - feat(nuqs): addrequiredSearchParamsoption todefineTypedHrefWithNuqsBreaking change
defineTypedHrefWithNuqsis now a 3-level curried function. An options call has been inserted as the second level:// before defineTypedHrefWithNuqs<Routes, RouteParamsMap>()(nuqsMap); // after defineTypedHrefWithNuqs<Routes, RouteParamsMap>()()(nuqsMap);
New feature
Pass
{ requiredSearchParams: true }in the second call to enforce thatsearchParamsis provided for routes with nuqs parsers defined.Fields without
.withDefault()become required; fields with.withDefault()remain optional.const { $href } = defineTypedHrefWithNuqs<Routes, RouteParamsMap>()({ requiredSearchParams: true, })({ "/search": { q: parseAsString, // required page: parseAsInteger.withDefault(1), // optional }, }); $href({ route: "/search", searchParams: { q: "hello" } }); // OK $href({ route: "/search", searchParams: { q: "hello", page: 2 } }); // OK $href({ route: "/search" }); // Type error $href({ route: "/search", searchParams: { page: 2 } }); // Type error
@plainbrew/vercel-basic-auth@0.2.1
@plainbrew/next-typed-href@0.2.1
@plainbrew/next-typed-href@0.2.0
Minor Changes
-
#28
4b54edbThanks @amotarao! - feat: Add defineTypedHrefWithNuqs for type-safe searchParams with nuqs parsers -
#46
eaeb183Thanks @amotarao! - fix: Support withDefault parsers in defineTypedHrefWithNuqs; null is now a type error for non-nullable params, and values equal to the default are omitted from the URL