iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more
For this site, the rule is that its 69-page inventory has one canonical TypeScript array; other code should consume that inventory or derive the view it needs rather than maintain another page list. That is a project-specific architecture choice, not a requirement of TypeScript or of every web framework. The figure 69 is part of the stated requirement, not an independently verified count.
What “one array” should mean
Use one project-owned source of truth for the site’s page inventory. Put one entry per page or route in a single module, then have navigation, route lookups, tests, and other consumers read from it or derive their own results from it.
The prohibition is most useful when it targets duplicate, independently maintained inventories. It should not be read to forbid every array used by the site: a filtered navigation group, breadcrumb ancestors, query results, or generated route output can be a derived collection. The important distinction is whether a collection is computed from the canonical inventory or separately maintained as another source of page truth.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →How to structure the canonical inventory
Keep page data together
Define a page type and export one array from one module. Each entry can contain the fields consumers actually need, such as a stable identifier, URL path, and display label. Avoid scattering page metadata across several hand-maintained arrays; where consumers need only part of each entry, derive that view from the canonical data.
#1 Best Overall
Use readonly typing when consumers should not mutate it
TypeScript’s ReadonlyArray<T> exposes an array without its mutating methods, and the compiler rejects indexed writes through that readonly reference. The TypeScript documentation explains that it is the same as Array<T> with mutating methods removed, so code can help ensure the array is not changed after creation. See the TypeScript Handbook.
This is a compile-time restriction, not a runtime freeze: a type assertion can bypass the restriction, and readonly typing does not make the underlying JavaScript value immutable at runtime. Treat the readonly type as a guardrail for ordinary code, not as a security boundary.
Rank #2
- TypeScript implements a superset of syntax for strictly typed development, facilitating deep static analysis and enhanced development environment integration. The compiler translates source into standard script formats, ensuring parity across any runtime.
- TypeScript is ideal for front-end developers, full-stack engineers, and software architects who build large-scale web applications. It serves those looking to improve code excellence, reduce bugs through static checking, and maintain complex projects more.
- Lightweight, Classic fit, Double-needle sleeve and bottom hem
Derive consumer-specific views
Navigation may need only visible pages, while a route lookup may need a path-to-page mapping. Compute those from the canonical array rather than maintaining separate page inventories. If a derived collection is cached or exported, make its derived status clear so later edits do not turn it into a competing source of truth.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteHow this differs from framework routing
A project-owned page inventory is an architectural choice; framework routing is the mechanism a framework uses to create or match routes. Frameworks do not all require the same arrangement, and a centralized TypeScript array is not automatically the best fit for every project.
| Approach | Where route definitions live | How routes are produced | Trade-off for a one-inventory policy |
|---|---|---|---|
| Explicit route configuration with React Router | An explicit array of route objects can live in a route configuration module; React Router also documents a file-based route convention. | Routes are declared in configuration, with the framework consuming that configuration. | Central configuration is easy to inspect as one list. A separate page inventory is unnecessary if the route configuration itself is the canonical inventory; avoid maintaining both independently. See React Router’s routes.ts convention. |
| File-based routing with Next.js | Folders and special page files define route segments. | Route structure follows the application’s file-system conventions, including dynamic segments. | Routes are discoverable in the file tree rather than necessarily in one array. If a separate inventory is required for navigation or another purpose, decide whether it is derived or independently maintained. See Next.js layouts and pages. |
| File- and data-driven routing with Gatsby | Page files, data models, and APIs can contribute to page creation. | Pages can be created from files or generated from data. | Multiple route producers make duplicate-path handling worth checking. Gatsby documents that duplicate paths can produce a build warning while the build still completes, with the last-created page accessible; centralization alone does not guarantee that conflicts are prevented. See Gatsby’s route creation documentation. |
| File-based and generated routing with Astro | Route files live in the file system; dynamic routes can use static path data. | Routes can be defined by files or generated from data for dynamic routes. | The file system can remain the route source while generated paths come from content data. A project-wide inventory may be useful, but its relationship to those sources must be explicit. See Astro v6 routing. |
Choose the policy boundary before enforcing the ban
“Nothing else on the site is allowed to hold a list” is too broad if “list” literally includes every array. Framework route configuration, content collections, filtered menus, query results, and generated route outputs may be valid collections with different roles. Define the rule as a ban on duplicate, independently maintained page inventories, and document which collections are derived or framework-owned.
- Make the canonical inventory’s module and ownership clear.
- Specify whether framework route declarations are themselves canonical or are derived from the inventory.
- Have consumers import the source or derive their views from it; do not copy page entries into another maintained list.
- Check route-generation paths for duplicate URLs when several files, data sources, or APIs can create pages.
What this rule does—and does not—promise
A single inventory gives the project a clear place to inspect page entries and can make it easier to notice inconsistent route data. It does not, by itself, prove that duplicate paths are impossible, improve performance by a measurable amount, or dictate how every framework must route requests. The reviewed framework and TypeScript documentation provide no named statistic for the effect of this exact one-array policy.
Quick Recap
Best Value
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

