TypeScript Return Types

Declare return types in top-level functions to support future edits by coding agents.

---
description: Declare return types in top-level functions to support future edits by coding agents
globs: **/*.ts, **/*.tsx
---

Return Types

When declaring functions on the top-level of a module, declare their return types. This will help future AI assistants understand the function's purpose.

const myFunc = (): string => {
  return "hello";
};

One exception to this is components which return JSX. No need to declare the return type of a component, as it is always JSX.

const MyComponent = () => {
  return <div>Hello</div>;
};

Add this context to your project via the ctxs command line integration: