Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/schniz/next-static-paths
Statically prevent 404s in your Next.js applications using TypeScript
https://github.com/schniz/next-static-paths
next nextjs static-analysis typescript
Last synced: about 1 month ago
JSON representation
Statically prevent 404s in your Next.js applications using TypeScript
- Host: GitHub
- URL: https://github.com/schniz/next-static-paths
- Owner: Schniz
- Archived: true
- Created: 2022-03-23T10:38:08.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-11-17T00:34:18.000Z (12 months ago)
- Last Synced: 2024-09-29T12:41:03.422Z (about 1 month ago)
- Topics: next, nextjs, static-analysis, typescript
- Language: TypeScript
- Homepage: https://github.com/schniz/next-static-paths
- Size: 504 KB
- Stars: 23
- Watchers: 2
- Forks: 2
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# This feature is supported natively in [Next.js 13.2](https://nextjs.org/13-2)
upgrade and have fun!
---
# `next-static-paths`
Statically prevent HTTP 404 Not Found in your Next.js applications using TypeScript and code generation.
## Features
💻 A command-line interface to generate static types and custom route helper functions
🔗 A `` component which wraps Next.js `` and provides type-safe path matching
📝 A `pathFor` helper that enables path generation in a type-safe manner
## Usage
```sh-session
$ pnpm add next-static-paths
# or
$ yarn add next-static-paths
# or
$ npm install next-static-paths
```Then, from within your Next.js application root, run the following command:
```sh-session
# For pnpm users
$ pnpx next-static-paths# For yarn users
$ yarn next-static-paths# For npm users
$ npx next-static-paths
```## Usage screenshots
#### Path autocomplete
![Path autocomplete](./docs/autocomplete-paths.png)
#### Dynamic path segment type checking
![dynamic path segment type checking](./docs/error-in-variadic.png)