0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-16 21:46:22 -05:00

feat: try type routePattern

This commit is contained in:
Florian Lefebvre 2024-09-20 15:39:27 +02:00
parent f430225af6
commit ccae0e5358
4 changed files with 6 additions and 3 deletions

View file

@ -3,6 +3,8 @@ import BaseHead from '../components/BaseHead.astro';
import Header from '../components/Header.astro';
import Footer from '../components/Footer.astro';
import { SITE_TITLE, SITE_DESCRIPTION } from '../consts';
Astro.routePattern
---
<!doctype html>

View file

@ -1,5 +1,5 @@
{
"extends": "astro/tsconfigs/base",
"extends": "astro/tsconfigs/strict",
"include": [".astro/types.d.ts", "**/*"],
"exclude": ["dist"],
"compilerOptions": {

View file

@ -146,7 +146,7 @@ export interface AstroGlobal<
* - The value when rendering `src/pages/blog/[slug].astro` will `blog/[slug]`.
* - The value when rendering `src/pages/[...path].astro` will `[...path]`.
*/
routePattern: string;
routePattern: keyof App.RoutePattern extends never ? string : keyof App.RoutePattern;
/**
* The <Astro.self /> element allows a component to reference itself recursively.
*
@ -523,5 +523,5 @@ export interface APIContext<
* - The value when rendering `src/pages/blog/[slug].astro` will `blog/[slug]`.
* - The value when rendering `src/pages/[...path].astro` will `[...path]`.
*/
routePattern: string;
routePattern: keyof App.RoutePattern extends never ? string : keyof App.RoutePattern;
}

View file

@ -10,6 +10,7 @@ declare global {
* Used by middlewares to store information, that can be read by the user via the global `Astro.locals`
*/
export interface Locals {}
export interface RoutePattern {}
}
namespace Astro {