Skip to content

Cursor for TypeScript: A Sourced Read of the Documentation

A read of Cursor's documentation for TypeScript work: rules files, @-mentions, Tab and how Agent sees compiler errors. Sources linked, nothing tested.

· · 7 min read

Updated: November 25, 2026

A Cursor mdc rules file with globs for TypeScript files and rules about any, return types and schemas

Quick Take

This used to be a list of twenty Cursor tips. It is now a shorter page that says only what Cursor's own documentation and one staff forum reply state about TypeScript work: where rules live, what an @-mention adds, what Tab reads, and how Agent sees compiler errors. It is a read of the docs, not a test of the editor.

Read this first: I don't use Cursor. The AI tools I've used daily for over a year are Claude Code and GitHub Copilot. This page is a read of Cursor's documentation and one staff reply on its forum, done on November 25, 2026, with every claim tied to its source. Nothing below was tested in the editor. The only thing I ran is the TypeScript at the end, through tsc 7.0.2.

An earlier version of this page listed twenty tips and wrote several of them as if they'd been observed. They hadn't. What's left is what can be checked.

TL;DR: Cursor's docs put TypeScript rules in .cursor/rules/*.mdc or an AGENTS.md, and they say rules don't reach Tab. @-mentions add files, folders, terminal output, past chats, git diffs and the browser. Agent reads linter output after it edits, but by a staff reply it sees diagnostics mostly for open files, so a full tsc --noEmit is still your job.

What Cursor says it reads from a TypeScript project

It reads less than most tip lists claim. Cursor's JavaScript and TypeScript page is short. It recommends three extensions for people starting out: ESLint, which it calls "Required for Cursor's AI-powered lint fixing capabilities", the built-in JavaScript and TypeScript Language Features, and Path Intellisense. It lists framework support for React and Next.js, Vue, Angular, Svelte, Express and NestJS. And it states that after the agent changes code, it reads the linter output (ESLint, Biome and others) and tries to fix the errors.

How does Agent see a TypeScript error, then? The most specific answer I found isn't in the docs. It's a reply from a Cursor staff member, Colin, in a forum thread dated August 28, 2026: Agent "reads diagnostics from the same store as the Problems panel". Two limits come in the same reply. "Only Error and Warning severities are surfaced." And most language servers publish diagnostics for open documents only, so for a file an edit broke indirectly, "the lint check can come back empty."

That second limit is the useful one. A green lint pass after an Agent edit covers the files you have open, not the project.

Where TypeScript rules go

The rules page is the best-documented part, and it's precise about files.

What the docs sayDetail
Location.cursor/rules, as .mdc files
Plain markdown there"A plain .md file in .cursor/rules is ignored by the rules system."
Frontmatter fieldsdescription, globs, alwaysApply
Rule typesAlways Apply, Apply Intelligently, Apply to Specific Files, Apply Manually
Simpler alternativeAGENTS.md, supported "in the project root and subdirectories", no metadata
Size"Keep rules under 500 lines."
PrecedenceTeam, then Project, then User; applicable rules are merged
Tab"Rules do not impact Cursor Tab or other AI features."

From those three fields, a TypeScript rule scoped to source files would look like this. It's written from the documented format; I haven't loaded it into Cursor.

---
description: TypeScript conventions for this repo
globs: src/**/*.ts,src/**/*.tsx
alwaysApply: false
---

- No `any`. Use `unknown` and narrow it.
- Annotate the return type of every exported function.
- Validate external data with a schema before it gets a type.

Two things the page doesn't say. It no longer mentions .cursorrules, the single-file format older guides describe, so I wouldn't start a project on it. And it promises nothing about obedience. Why does that matter? Because of what I see in the tool I do use: Claude Code reads my CLAUDE.md every session and still drifts from it now and then. I'd assume any agent can, and keep no-explicit-any as a lint error too. The rule files comparison goes through the Cursor and Copilot formats side by side.

A rules file shapes what the agent writes. By Cursor's own docs it doesn't touch Tab, so the lint rule still has to exist.

Share this Post on X Bluesky

@-mentions: five kinds of context

Five things, per the @ Mentions page:

  • Files and folders. @auth.ts adds a file, @src/components/ a folder, and a slash after a selected folder goes deeper.
  • Terminals. Adds terminal output to the prompt.
  • Chats. Pulls context from an earlier conversation.
  • Git diffs. Either the uncommitted working state or the full branch diff against main.
  • Browser. Context from the built-in browser.

For TypeScript the first two do the work. Mentioning the file that holds an interface puts the actual declaration in the prompt, not the model's guess at it. And a terminal mention is a documented way to hand over the output of tsc --noEmit, file paths and error codes included.

Tab's documented inputs

The Tab page says suggestions are "based on your recent edits, surrounding code, and linter errors." It also says Tab can change several lines at once, add missing import statements, jump to a predicted next edit after you accept one, and offer an edit in another file through a portal window at the bottom of the editor.

What it doesn't mention: TypeScript by name, tsconfig.json, or comments as triggers. So does Tab read your strict flags? The docs don't say, and I can't tell you. If a tip tells you a // TODO: implement comment makes Tab fill in a typed body, that's somebody's observation, not documentation. It may well work. It isn't something I can source.

Unsourced claims removed from the old version

Four things, and they're gone:

  • that Cursor reads tsconfig.json to learn its constraints. None of the four pages above says so.
  • that stricter types make its output measurably better. Plausible, and it's the thesis of our types-as-contracts piece, but nobody here measured it in Cursor.
  • that a cold language server is why suggestions feel off. A guess.
  • that a short rules file gets followed more closely than a long one. The docs give a 500-line ceiling and no claim about obedience.

I'd rather publish a short page than keep twenty tips when several of them were never observed.

Compiler checks that don't depend on the editor

The compiler ones. If the agent sees diagnostics mostly for open files, the checks worth setting up are those tsc reports for the whole project, whoever wrote the code. Here are three I compiled with tsc 7.0.2 and --strict for this update.

type FetchResult<T> =
  | { status: "success"; data: T }
  | { status: "error"; code: string; message: string }
  | { status: "loading" };

// No error: the return type is inferred as string | undefined.
export function label(r: FetchResult<number>) {
  switch (r.status) {
    case "success":
      return "ok";
    case "error":
      return r.message;
  }
}

function assertNever(x: never): never {
  throw new Error("Unhandled case: " + JSON.stringify(x));
}

// Error: the default branch still receives the "loading" variant.
export function strictLabel(r: FetchResult<number>): string {
  switch (r.status) {
    case "success":
      return "ok";
    case "error":
      return r.message;
    default:
      return assertNever(r);
  }
}

The first function forgets loading and compiles clean. Annotate it : string and the compiler stops it:

error TS2366: Function lacks ending return statement and return type does not include 'undefined'.

The second function reports the missing branch by name:

error TS2345: Argument of type '{ status: "loading"; }' is not assignable to parameter of type 'never'.

And a catch (e) block that returns e.message fails with TS18046: 'e' is of type 'unknown'. Under strict, that is. Since TypeScript 6.0, strict is on by default (the 6.0 announcement says "strict is now true by default"), but an older project may switch it off or extend a base that does, so tsc --showConfig tells you more than assuming. The strict mode guide has each flag as a before and after pair.

Is any of that Cursor advice? Not really. It's what makes any generated TypeScript checkable, and it's the same list I rely on with Claude Code: an explicit return type on exported functions, a never check in every union switch, unknown in catch blocks, and a full tsc --noEmit before I read the diff.

What a tested version would need

A project, a fixed set of prompts, the Cursor version, and the diffs. This page has none of that. If you want posts on this site that do rest on a run, the AI coding tools overview lists them, and the CI quality gates guide covers the checks that catch generated code after it leaves the editor.

Frequently Asked Questions

Does Cursor work better with TypeScript than JavaScript?
Cursor's documentation doesn't claim that, and this page doesn't test it. What is documented: after Agent changes code it reads linter output and tries to fix the errors, and a Cursor staff reply says Agent reads diagnostics from the same store as the Problems panel. TypeScript errors published by the language server are therefore visible to it, with two stated limits: only Error and Warning severities, and usually only for open documents.
Where should Cursor rules for a TypeScript project go?
In .cursor/rules as .mdc files, or in a plain AGENTS.md at the project root or in a subdirectory. The rules page says a plain .md file inside .cursor/rules is ignored. An .mdc rule has three frontmatter fields: description, globs and alwaysApply. The same page advises keeping a rule under 500 lines and no longer mentions the old .cursorrules file at all.
Do Cursor rules affect Tab completions?
No. The rules page answers this directly: rules do not impact Cursor Tab or other AI features. A rule that bans any shapes what Agent writes, not what Tab suggests, so a lint rule such as no-explicit-any is still the thing that catches it.
Should I still run tsc after Agent finishes?
Yes. By the staff reply cited here, most language servers publish diagnostics for open documents only, so a file an edit broke indirectly may not be reported and the lint check can come back empty. A full tsc --noEmit run checks every file in the project, open or not.
Did the author test Cursor for this article?
No. The author's daily tools are Claude Code and GitHub Copilot. Everything said about Cursor here is attributed to Cursor's documentation or its forum, read on November 25, 2026. The only things executed are the TypeScript snippets, compiled with tsc 7.0.2 under strict.