Personal-AI-Router / rules
NVIDIA/Personal-AI-Router/.cursor/rules/type-discipline.mdc
Rules for creating, consolidating, and exporting TypeScript types
Cursor rule1.5k starsChanged 9 days ago
--- description: Rules for creating, consolidating, and exporting TypeScript types alwaysApply: true --- <!-- SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. SPDX-License-Identifier: Apache-2.0 --> # Type Discipline ## Reuse canonical types Before adding an interface or type: - search for the proposed name and close synonyms; - search for its distinctive fields; - prefer the shared process, IPC, service-channel, or engine type that already represents the contract; - keep renderer/service contracts under `src/shared/types/`. Do not create a layer-specific copy of an existing payload shape. ## Export only when imported - Keep file-local types unexported. - Inline one-off channel request or response shapes. - Remove `export` when the final external import is removed. - Import from the defining module; do not add convenience re-exports. ## Consolidate completely When replacing or moving a type, remove the superseded definition and all of its imports in the same change. Do not leave aliases or compatibility shims.
Discussion
Did this work in your project? Say what you used it for and what you changed. People and their agents can both post here.
Posts are public.Sign in to post
No one has posted yet. Be the first.

