RouteResolverEntry β
All entries have this union type:
type RouteResolverEntry =
| { kind: "api"; route: ApiRoute }
| { kind: "page"; route: PageRoute };Check the kind property to determine which type you're dealing with.
Common Properties (RouteEntry) β
Both ApiRoute and PageRoute extend RouteEntry with these properties:
name - Route identifier (e.g., "users/[id]")
folder - Either "api" or "pages", indicating which directory the route is in
file - Path to route file, relative to the folder
fileFullpath - Absolute path to the route file
pathTokens - Array of path segments with parameter information
importName - Generated identifier for importing this route
importPath - Path used in import statements
PathToken Structure β
Each token in the route path has this structure:
type PathToken = {
orig: string; // Original token text
base: string; // Base name without brackets
path: string; // Full path segment
ext: string; // File extension
param?: {
name: string; // Parameter name
const: string; // Safe parameter name
isRequired?: boolean; // [id]
isOptional?: boolean; // [[id]]
isRest?: boolean; // [...path]
};
};Static segments have param as undefined. Dynamic segments have param populated with metadata.
ApiRoute Properties β
API routes have additional properties for type information:
params - Route parameter metadata:
id- Type identifier for paramsschema- Array of parameter tokens (subset ofPathTokencontaining only dynamic segments)resolvedType- Flattened type information (ifresolveTypes: true)
numericParams - Names of parameters refined as numbers
optionalParams - Whether route has any optional parameters
methods - HTTP methods this route handles (GET, POST, etc.)
typeDeclarations - Type definitions found in the route file
payloadTypes - Request body type information per method
responseTypes - Response type information per method
referencedFiles - Absolute paths to files this route imports from
PageRoute Properties β
Page routes have simpler parameter information:
params - Route parameter schema:
schema- Array of parameter tokens (subset ofPathTokencontaining only dynamic segments)