Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
181 commits
Select commit Hold shift + click to select a range
b86ab7d
Stop reassigning `.valueDeclaration` to avoid replacing earlier decla…
Andarist May 15, 2025
81c9518
Fix getResolvePackageJsonImports utility (#61707)
andrewbranch May 16, 2025
b504a1e
Handle lock file 3 version when caching the typings ensuring we can r…
sheetalkamat May 21, 2025
44d4671
Update pr_owners.txt (#61798)
jakebailey Jun 3, 2025
3dd0a35
Initialize the map for dts to reference and source to reference when …
sheetalkamat Jun 4, 2025
2b88aeb
LEGO: Pull request from lego/hb_5378966c-b857-470a-8675-daebef4a6da1_…
csigs Jun 4, 2025
a591ca3
fix(61747): for (using of = is incorrectly parsed (#61764)
a-tarasyuk Jun 5, 2025
ac03ba4
fix(checker): report error when using bigint as enum key (#61777)
magic-akari Jun 5, 2025
cd34199
tsc --init update (#61813)
RyanCavanaugh Jun 6, 2025
a69c6d0
Add support for `import defer` proposal (#60757)
nicolo-ribaudo Jun 6, 2025
ffd98c1
feat: add Error.isError() to ESNext lib (#60788)
dirkluijk Jun 6, 2025
51dcd90
Cache mapper instantiations (#61505)
Andarist Jun 6, 2025
652ed7f
Add lib.esnext.sharedmemory (#61646)
Renegade334 Jun 6, 2025
1e24945
explicitly disallow `using` in ambient contexts (#61781)
Renegade334 Jun 6, 2025
fa2a0fc
Issue "'{0}' declarations can only be declared inside a block." for b…
Andarist Jun 6, 2025
7715955
Fix helpers emit for .cjs files in ESM module mode (#61814)
andrewbranch Jun 6, 2025
355b9e0
Avoid resolving source prop type when the target is `unknown`/`any` (…
Andarist Jun 6, 2025
97cfa26
optimization, reduce memory usage (#61822)
VincentBailly Jun 9, 2025
cb38d99
Add `--module node20` (#61805)
andrewbranch Jun 9, 2025
34d1ea6
Fix type variable leaks and cache inconsistencies (#61668)
ahejlsberg Jun 9, 2025
0dfd0c2
Restore `import defer =` parsing (#61837)
nicolo-ribaudo Jun 9, 2025
12e09f4
Port "Improve type discrimination algorithm" from tsgo (#61828)
jakebailey Jun 9, 2025
529ed09
fix link to "Help Wanted" issues (#61843)
AllenSH12 Jun 11, 2025
dd1e258
LEGO: Pull request from lego/hb_5378966c-b857-470a-8675-daebef4a6da1_…
csigs Jun 11, 2025
f1d2494
LEGO: Pull request from lego/hb_5378966c-b857-470a-8675-daebef4a6da1_…
csigs Jun 17, 2025
5a3271b
LEGO: Pull request from lego/hb_5378966c-b857-470a-8675-daebef4a6da1_…
csigs Jun 18, 2025
479285d
Create fourslash syntax, compiler testcase, and build instructions su…
Copilot Jun 18, 2025
78c1679
Don't ignore completions at source file locations (#61909)
Andarist Jun 23, 2025
50b93bc
Allow trailing commas after import attributes in `ImportType` (#61920)
Andarist Jun 24, 2025
3af37ef
Add Copilot setup steps (#61933)
RyanCavanaugh Jun 24, 2025
6dea899
Update Copilot instructions and setup script (#61937)
RyanCavanaugh Jun 24, 2025
47ca599
Remove corsa-specific steps from copilot-setup-steps.yml (#61938)
RyanCavanaugh Jun 24, 2025
dca7170
Fix bad JSON syntax in tests, use JSON.parse first for perf (#61901)
jakebailey Jun 24, 2025
e6a50a7
Use strict subtype relation in `getCommonSupertype` (#61903)
ahejlsberg Jun 24, 2025
d6c3ac3
Add line endings and printf debugging section (#61947)
RyanCavanaugh Jun 25, 2025
1ed8674
Allow `accessor` properties in ambient contexts when targeting ES5 (#…
Copilot Jun 25, 2025
6e519c5
Fix BigInt literal error in ambient contexts when targeting < ES2020 …
Copilot Jun 25, 2025
f3a6d31
Update copilot-setup-steps.yml (#61948)
jakebailey Jun 25, 2025
02672d2
Use jsx language variant for jsx file scanning in getChildren (#61928)
gabritto Jun 25, 2025
efeb135
Revert #54442 and add a testcase (#61955)
RyanCavanaugh Jun 27, 2025
dfb7488
Fix capitalisation for `checkJs` (#61795)
gameroman Jun 29, 2025
d297037
Fixed crash on `ConstructSignature` when computing interactive inlay …
Andarist Jun 30, 2025
36f7fba
Improve release publisher pipeline (#61551)
jakebailey Jun 30, 2025
8665f92
Fixed crash on `ComputedPropertyName` when computing interactive inla…
Andarist Jun 30, 2025
88b3bea
Fix typo in nightly yaml (#61906)
steeleduncan Jun 30, 2025
b46556e
Fixed JSDoc display on `JsxNamespacedName` attributes (#61825)
Andarist Jun 30, 2025
c33f83a
Fixed a printer crash caused by empty parameter modifiers (#60537)
Andarist Jun 30, 2025
2ea2ecf
Fixed crash in `hasVisibleDeclarations` related to binding elements (…
Andarist Jun 30, 2025
5519be3
Fixed crash when getting a definition for a class member with a compu…
Andarist Jun 30, 2025
3267e42
Handle `silentNeverType` in iteration-related functions (#61317)
Andarist Jun 30, 2025
c35b143
Keep accessors as accessors in emitted anonymous class declarations (…
Andarist Jun 30, 2025
58665cf
Don't return `tags` when returning quick info for JSDoc nodes (#59816)
Andarist Jun 30, 2025
91cdbd5
Fixed nullish coalesce operator's precedence (#61372)
Andarist Jun 30, 2025
b70d4d7
Revert change to type print in an error message (#61977)
Andarist Jun 30, 2025
1ea1809
Properly disallow `yield` in bodyless arrows (#61976)
Andarist Jun 30, 2025
5fd65f3
Bump the github-actions group across 1 directory with 3 updates (#61804)
dependabot[bot] Jun 30, 2025
e58dde5
perf: improve regexp performance by using non-capturing groups (#58551)
antfu Jun 30, 2025
666ef27
Fix Copilot instructions to emphasize mandatory lint, test, and forma…
Copilot Jun 30, 2025
3ba257f
fix: diagnostic message for class name 'Object' when targeting differ…
idango10 Jun 30, 2025
6d684e3
Restore repo dispatch for twoslash-repros workflow (#60682)
jakebailey Jul 1, 2025
8518a87
fix `Intl.Segments#containing` return value type (#61236)
petamoriken Jul 2, 2025
441655c
DOM Update 2025-06-18 (#61986)
jakebailey Jul 2, 2025
fe698ae
Just add a trailing call to `visitNode` instead of creating a new arr…
DanielRosenwasser Jul 2, 2025
0018c9f
LEGO: Pull request from lego/hb_5378966c-b857-470a-8675-daebef4a6da1_…
csigs Jul 2, 2025
833a8d4
Fix Symbol completion priority and cursor positioning (#61945)
Copilot Jul 2, 2025
87740bc
Fix for Issue 61081 (#61221)
JulianTaub Jul 7, 2025
9e20e03
Clear out checker-level stacks on pop (#62016)
jakebailey Jul 8, 2025
65cb4bd
LEGO: Pull request from lego/hb_5378966c-b857-470a-8675-daebef4a6da1_…
csigs Jul 10, 2025
2778e84
Restore AbortSignal.abort (#62086)
sandersn Jul 17, 2025
f14b5c8
Remove unused and confusing dom.iterable.d.ts file (#62037)
jakebailey Jul 21, 2025
d5a414c
Don't use `noErrorTruncation` when printing types with `maximumLength…
Andarist Jul 22, 2025
22ef577
LEGO: Pull request from lego/hb_5378966c-b857-470a-8675-daebef4a6da1_…
csigs Jul 22, 2025
be86783
Give more specific errors for `verbatimModuleSyntax` (#62113)
DanielRosenwasser Jul 23, 2025
c3ee238
Add format to update baselines/fix lints task (#62160)
weswigham Jul 31, 2025
39c5d01
Fix private identifier fields generating errors in class expression d…
Copilot Jul 31, 2025
c1f5656
Restructure CI to prepare for required checks and merge queues (#61978)
jakebailey Jul 31, 2025
c6a1812
Bump version to 6.0 (#62162)
DanielRosenwasser Jul 31, 2025
e3ef7ff
added john favret to pr_owners.txt (#62191)
johnfav03 Aug 4, 2025
3916165
Bump github/codeql-action from 3.29.1 to 3.29.2 in the github-actions…
dependabot[bot] Aug 5, 2025
605d7ee
Bump the github-actions group with 2 updates (#62252)
dependabot[bot] Aug 11, 2025
e39d577
Update Node.js core modules (#62201)
Renegade334 Aug 11, 2025
73c0bc8
Update deps (#62285)
jakebailey Aug 14, 2025
261630d
Bump the github-actions group with 2 updates (#62299)
dependabot[bot] Aug 18, 2025
e635bb9
Allow `--module bundler --moduleResolution commonjs` (#62320)
andrewbranch Aug 22, 2025
3eb7b6a
Stop pinging Kat on protocol changes (#62339)
andrewbranch Aug 26, 2025
7956c00
Deprecate `--moduleResolution node10` (#62338)
andrewbranch Aug 27, 2025
0f415c5
Bump the github-actions group across 1 directory with 4 updates (#62411)
dependabot[bot] Sep 8, 2025
0f4b338
LEGO: Pull request from lego/hb_5378966c-b857-470a-8675-daebef4a6da1_…
csigs Sep 8, 2025
3f5c77f
Replace all testcase instances of 'module' with 'namespace' (#62399)
RyanCavanaugh Sep 8, 2025
4f94cb2
Fix parenthesizer rules for manually constructed binary expressions w…
Andarist Sep 9, 2025
3320dfd
Add missing Float16Array constructors (#62351)
greggman Sep 9, 2025
cdfc519
Switch `libReplacement` to `false` by default (#62391)
Copilot Sep 11, 2025
e9bcbe6
Fix incorrectly ignored dts file from project reference for resolutio…
sheetalkamat Sep 11, 2025
233f392
fix(error message): fixes issue in error message TS1355 (#62465)
Janhvi21 Sep 19, 2025
904e7dd
Enable `noUncheckedSideEffectImports` by default (#62443)
RyanCavanaugh Sep 22, 2025
96acaa5
Remove no-default-lib (#62435)
jakebailey Sep 24, 2025
6f6efb4
Disable conditional exports fallbacks on `null` values (#62483)
andrewbranch Sep 25, 2025
5f183ad
Revert PR 61928 (#62423)
jakebailey Sep 25, 2025
1cd5309
Port https://github.com/microsoft/typescript-go/pull/1759 (#62502)
ahejlsberg Sep 28, 2025
97610a8
Port microsoft/typescript-go#1757 (#62501)
ahejlsberg Sep 29, 2025
e350126
Port microsoft/typescript-go#1764 (#62510)
ahejlsberg Sep 29, 2025
83ff202
Bump the github-actions group across 1 directory with 2 updates (#62507)
dependabot[bot] Sep 30, 2025
d4b15eb
Enhance type argument completions (#62170)
mkantor Sep 30, 2025
31a0ead
Don't compare "missing" to `undefined` in `compareProperties` under `…
HansBrende Sep 30, 2025
eef6a0c
Deprecate baseUrl (#62509)
andrewbranch Sep 30, 2025
968d5de
Fix incorrect test options (#62515)
jakebailey Oct 1, 2025
837e3a1
Fix releaser tag creation (#62522)
jakebailey Oct 1, 2025
9c4c377
Update DOM types (#62496)
jakebailey Oct 2, 2025
ced90d9
Move Iterable/AsyncIterable into main DOM/WebWorker libs (#62111)
jakebailey Oct 2, 2025
3a68348
Add type definitions for `Uint8Array` to/from base64 methods (#61696)
dontwanttothink Oct 3, 2025
d0d675a
Update DOM types for FileSystemDirectoryHandle changes (#62538)
jakebailey Oct 3, 2025
6ba7d35
Consistently resolve to the `errorType` on `arguments` with error (#6…
Andarist Oct 5, 2025
fe592f1
Bump the github-actions group with 2 updates (#62551)
dependabot[bot] Oct 6, 2025
91b32ac
Remove circularity, rootDir errors from node modules compiler tests (…
jakebailey Oct 9, 2025
1112dae
Add extra test for extending multiple bases with incompatible optiona…
Andarist Oct 9, 2025
10b2cf5
LEGO: Pull request from lego/hb_5378966c-b857-470a-8675-daebef4a6da1_…
csigs Oct 9, 2025
0b6a241
Fix: Make discriminant property selection order-independent in unions…
prathmesh796 Oct 13, 2025
d3be7e1
Allow line break before import attributes `with` keyword (#62593)
Andarist Oct 14, 2025
d8aafb3
Handle more child types when generating navigation tree items for `ex…
Andarist Oct 17, 2025
16a52ed
Bump the github-actions group across 1 directory with 2 updates (#62632)
dependabot[bot] Oct 20, 2025
84f4856
Fix fourslash tests (#62641)
andrewbranch Oct 20, 2025
af3a377
add allowJs default value description (#62611)
manbearwiz Oct 20, 2025
cbc2059
Fixed a crash when parsing invalid decorator on await expression (#62…
Andarist Oct 22, 2025
542b095
Fix TS2783 false positive for union types in object spread expression…
Copilot Oct 22, 2025
f450c1b
Deprecate esModuleInterop and allowSyntheticDefaultImports (default t…
andrewbranch Oct 22, 2025
42f6576
Deprecate `--module amd`, `umd`, `system`, `none`; `--moduleResolutio…
andrewbranch Oct 24, 2025
8ea03f8
Bump the github-actions group with 2 updates (#62678)
dependabot[bot] Oct 27, 2025
11ee01b
Add missing whitespace after type parameter's modifiers in interactiv…
Andarist Oct 29, 2025
2a90a73
Fixed an issue with "slow" sync iteration types spoiling cached value…
Andarist Oct 29, 2025
6fd2874
Use comparability for discriminant properties when narrowing types fo…
Andarist Oct 30, 2025
2b2d6ce
Improve references search and quick info on properties with type erro…
Andarist Oct 30, 2025
f6f4eab
Allow implicit `undefined` returns when the contextual union type con…
Andarist Oct 30, 2025
b44ac69
Keep returned (and yielded) literal types as const when their types u…
Andarist Oct 30, 2025
ac7825c
LEGO: Pull request from lego/hb_5378966c-b857-470a-8675-daebef4a6da1_…
csigs Oct 30, 2025
9222837
Switch custom runners from mariner-2.0 to azure-linux-3 (#62697)
jakebailey Oct 31, 2025
cc05d94
Propagate variance reliability (#62604)
ahejlsberg Oct 31, 2025
1654ebf
LEGO: Pull request from lego/hb_5378966c-b857-470a-8675-daebef4a6da1_…
csigs Oct 31, 2025
6f4fb01
Bump github/codeql-action from 4.31.0 to 4.31.2 in the github-actions…
dependabot[bot] Nov 3, 2025
efca03f
Switch 1ESPT pipelines to 1ESPT-AzureLinux3 (#62727)
jakebailey Nov 7, 2025
48244d8
fix: `[Symbol.iterator]()` lost on union with `never` (#62661)
nrainhart Nov 10, 2025
4a957b7
Fixed control flow Analysis of aliased discriminants with parenthesiz…
Andarist Nov 11, 2025
0f766a9
Remove watchdogs workflow (#62690)
RyanCavanaugh Nov 12, 2025
ea48ded
Shrink relationComplexityError test size (#62754)
jakebailey Nov 13, 2025
09e31cf
Move unreachable checks to checker (#62751)
jakebailey Nov 14, 2025
cc2610f
Update error for allowImportingTsExtensions to mention rewriteRelativ…
bakkot Nov 14, 2025
486fce7
Fix unreachable code detection persisting after incremental edits (#6…
Copilot Nov 19, 2025
0c801e6
Update deps (#62784)
jakebailey Nov 19, 2025
60e99ec
Disallow `[await] using` statements under case/default clauses (#62709)
Renegade334 Nov 19, 2025
fbb051f
LEGO: Pull request from lego/hb_5378966c-b857-470a-8675-daebef4a6da1_…
csigs Nov 22, 2025
669c25c
Add --ignoreConfig and dont allow specifying files on commandline wit…
sheetalkamat Nov 24, 2025
5026c66
Bump the github-actions group across 1 directory with 2 updates (#62799)
dependabot[bot] Dec 1, 2025
28fbc0a
Filter return type inferences by constraint applicability (#58910)
Andarist Dec 3, 2025
4ef2378
Update security.md (#62833)
RyanCavanaugh Dec 3, 2025
dba6c9b
LEGO: Pull request from lego/hb_5378966c-b857-470a-8675-daebef4a6da1_…
csigs Dec 4, 2025
b33d372
Don't set parent on non-transient symbols in mergeSymbolTable (#61560)
jakebailey Dec 4, 2025
0752278
Widen reverse mapped type properties to fix them being treated as EPC…
Andarist Dec 5, 2025
38d95c8
Avoid `silentNeverType` leaking into generator types inferred based o…
Andarist Dec 5, 2025
6618cf7
Bump the github-actions group with 3 updates (#62851)
dependabot[bot] Dec 8, 2025
dafed7f
Add tests for contextual param type assignment in nested return type …
Andarist Dec 8, 2025
b2327c0
Make go to definition go to the constraint's properties for object li…
Andarist Dec 8, 2025
69a0879
Include source node inferences in string literal completions deeper i…
Andarist Dec 8, 2025
3544dd7
Fix ContextFlags compile error (#62855)
jakebailey Dec 8, 2025
c21f73f
Reenable fail-fast in merge queues (#62856)
jakebailey Dec 8, 2025
ab142be
Move knip args (#62865)
webpro Dec 9, 2025
3b9acae
Allow subpath imports that start with `#/` (#62844)
magic-akari Dec 9, 2025
1da8266
Disable some more merge queue jobs (#62871)
jakebailey Dec 9, 2025
366da34
Improve inference by not considering thisless functions to be context…
Andarist Dec 10, 2025
bbb5322
ES2020: fix String.prototype.matchAll type and description (#62873)
ljharb Dec 11, 2025
c84cb94
Revert "ES2020: fix String.prototype.matchAll type and description" (…
jakebailey Dec 11, 2025
16b933f
Deprecate `module` syntax (#62876)
RyanCavanaugh Dec 12, 2025
d7ae3aa
Fix accidental module replacements in tests (#62890)
jakebailey Dec 12, 2025
0a07132
Fix typo: MERCHANTABLITY → MERCHANTABILITY (#62891)
tt-a1i Dec 12, 2025
db3ae1b
Bump the github-actions group with 4 updates (#62897)
dependabot[bot] Dec 15, 2025
b78f089
Add note re: PRs to CONTRIBUTING.md (#62889)
RyanCavanaugh Dec 15, 2025
2dfdbba
Fixed crash when adding unreachable code diagnostic in situations wit…
Andarist Dec 19, 2025
1f5f9f3
Fix crash in mixin checking (#62928)
ahejlsberg Dec 26, 2025
f3770c9
Fix crash in abstract property checking (#62923)
ahejlsberg Dec 28, 2025
9d36497
Simplify "Configure Build Tools" devcontainer step. (#62955)
DanielRosenwasser Jan 5, 2026
632479f
Fixed an issue causing spurious "used before being assigned" errors i…
Andarist Jan 9, 2026
c574e40
Fix "never nullish" diagnostic missing expressions wrapped in parenth…
Copilot Jan 9, 2026
f5ccf43
Test updates for strict initialization (#62958)
DanielRosenwasser Jan 9, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": {
"Configure Build Tools": "sudo corepack enable npm; sudo npm install -g hereby; npm ci",
"Configure Build Tools": "sudo npm install -g hereby; npm ci",
"Install pprof": "go install github.com/google/pprof@latest",
"Install Graphviz": "sudo apt install graphviz"
},
Expand Down
342 changes: 342 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,342 @@
# Guide for Copilot

This document provides a concise guide for writing TypeScript fourslash tests and compiler tests, along with build instructions.

## Build Instructions Summary

### Setup
1. Install Node.js (current or LTS)
2. Clone the repository: `git clone --depth=1 https://github.com/microsoft/TypeScript`
3. Install dependencies: `npm ci`

### Common Build Tasks
```bash
npx hereby local # Build the compiler into built/local
npx hereby clean # Delete the built compiler
npx hereby tests # Build the test infrastructure
npx hereby runtests # Run all tests
npx hereby runtests-parallel # Run tests in parallel 🚨 MANDATORY BEFORE FINISHING!
npx hereby runtests --runner=fourslash # Run only fourslash tests
npx hereby runtests --runner=compiler # Run only compiler tests
npx hereby runtests --tests=<testPath> # Run specific test
npx hereby baseline-accept # Accept new test baselines
npx hereby lint # Run eslint 🚨 MANDATORY BEFORE FINISHING!
npx hereby format # Run code formatting 🚨 MANDATORY BEFORE FINISHING!
```

## Fourslash Test Syntax Guide

Fourslash tests are interactive TypeScript language service tests. They validate IDE features like completions, quick info, navigation, and refactoring.

### Basic Structure
```typescript
/// <reference path='fourslash.ts'/>

////code goes here with /*markers*/

// Test assertions go here
```

### Key Syntax Elements

#### 1. Source Code Definition
Use `////` to define source code lines:
```typescript
////function foo(x: number) {
//// return x + 1;
////}
////let result = foo(/*marker*/42);
```

#### 2. Markers for Positioning
Use `/**/` for anonymous markers or `/*name*/` for named markers:
```typescript
////let x = /*1*/someValue;
////let y = /*cursor*/anotherValue;
```

#### 3. Multi-file Tests
Use `// @Filename:` to define multiple files:
```typescript
// @Filename: /a.ts
////export const value = 42;

// @Filename: /b.ts
////import { value } from './a';
////console.log(/*marker*/value);
```

#### 4. Ranges
Use `[|text|]` to define text ranges:
```typescript
////function test() {
//// [|return 42;|]
////}
```

### Common API Patterns

#### Navigation & Positioning
```typescript
goTo.marker("markerName"); // Navigate to marker
goTo.marker(); // Navigate to anonymous marker /**/
```

#### Verification (Prefer these over baselines)
```typescript
verify.currentLineContentIs("expected content");
verify.completions({ includes: "itemName" });
verify.completions({ excludes: "itemName" });
verify.quickInfoIs("expected info");
verify.codeFix({
description: "Fix description",
newFileContent: "expected content after fix"
});
```

#### Completions Testing
```typescript
verify.completions({
marker: "1",
includes: { name: "foo", source: "/a", hasAction: true },
isNewIdentifierLocation: true,
preferences: { includeCompletionsForModuleExports: true }
});
```

#### Code Fixes Testing
```typescript
verify.codeFix({
description: "Add missing property",
index: 0,
newFileContent: `class C {
property: string;
method() { this.property = "value"; }
}`
});
```

#### Formatting
```typescript
format.document();
verify.currentLineContentIs("formatted content");
```

### Simple Example
```typescript
/// <reference path='fourslash.ts'/>

////interface User {
//// name: string;
////}
////
////const user: User = {
//// /*completion*/
////};

verify.completions({
marker: "completion",
includes: { name: "name", sortText: "0" }
});
```

## Compiler Test Syntax Guide

Compiler tests validate TypeScript compilation behavior, type checking, and error reporting.

### Basic Structure
- Simple `.ts` files in `tests/cases/compiler/`
- Use comments to indicate expected behavior
- No special test harness - just TypeScript code

### Compiler Directives
Use `// @directive: value` for compiler options:
```typescript
// @strict: true
// @target: ES2015
// @lib: ES2015,DOM

let x: string = 42; // Error expected
```

### Common Directives
```typescript
// @strict: true/false
// @noImplicitAny: true/false
// @target: ES5/ES2015/ES2020/ESNext
// @module: commonjs/amd/es6/esnext
// @lib: ES5,DOM/ES2015/ES2020
// @declaration: true/false
// @skipLibCheck: true/false
```

### Multi-file Tests
```typescript
// @Filename: helper.ts
export function helper(x: number): string {
return x.toString();
}

// @Filename: main.ts
import { helper } from "./helper";
const result = helper(42);
```

### Error Expectations
Use comments to document expected behavior:
```typescript
abstract class Base {
abstract method(): void;
}

class Derived extends Base {
// Missing implementation - should error
}

new Base(); // Should error - cannot instantiate abstract class
```

### Type Testing Patterns
```typescript
// Test type inference
let inferred = [1, 2, 3]; // Should infer number[]

// Test type compatibility
type A = { x: number };
type B = { x: number; y: string };
let a: A = { x: 1 };
let b: B = { x: 1, y: "hello" };
a = b; // Should work - B is assignable to A
b = a; // Should error - A missing property y
```

### Simple Example
```typescript
// Test that optional properties work correctly
interface Config {
required: string;
optional?: number;
}

const config1: Config = { required: "test" }; // Should work
const config2: Config = { required: "test", optional: 42 }; // Should work
const config3: Config = { optional: 42 }; // Should error - missing required
```

## Test Writing Best Practices

### For Fourslash Tests
1. **Prefer validation over baselines** - Use `verify.currentLineContentIs()` instead of `verify.baseline*()`
2. **Use simple, focused examples** - Test one feature at a time
3. **Name markers clearly** - Use descriptive marker names like `/*completion*/`
4. **Test the simplest form first** - Start with basic cases before complex scenarios

### For Compiler Tests
1. **Use clear file names** - Name tests after the feature being tested
2. **Add explanatory comments** - Document expected behavior with comments
3. **Test error cases** - Include both valid and invalid code examples
4. **Keep tests focused** - One primary feature per test file

### General Guidelines
1. **Make tests deterministic** - Avoid random or environment-dependent behavior
2. **Use realistic examples** - Test scenarios developers actually encounter
3. **Start simple** - Begin with the most basic case of a feature
4. **Test edge cases** - Include boundary conditions and error scenarios

## Running Specific Tests

```bash
# Run a specific fourslash test
npx hereby runtests --tests=tests/cases/fourslash/completionForObjectProperty.ts

# Run a specific compiler test
npx hereby runtests --tests=tests/cases/compiler/abstractClassUnionInstantiation.ts

# Run tests matching a pattern
npx hereby runtests --tests=tests/cases/fourslash/completion*.ts
```

## Important Guidelines

### 🚨 CRITICAL: Before Finishing Your Work 🚨

**THESE STEPS ARE MANDATORY BEFORE COMMITTING/PUSHING ANY CHANGES:**

1. **MUST RUN:** `npx hereby runtests-parallel` (even though it takes 10-15 minutes)
2. **MUST RUN:** `npx hereby lint` and fix ALL lint issues
3. **MUST RUN:** `npx hereby format` as the final step

**❌ PRs that fail these checks will be rejected without review.**

### Keeping Things Tidy

- You can assume lint, tests, and formatting are clean on a fresh clone
- Only run these verification steps AFTER making changes to code
- Run `npx hereby lint` and fix ALL issues after making changes
- Run `npx hereby format` as your final step after making changes

### Test Locations

- Only add testcases in `tests/cases/compiler` or `tests/cases/fourslash`
- Filenames in `tests/cases/compiler` must always end with `.ts`, not `.d.ts`
- Do not write direct unit tests as they are almost never the correct test format for our repo

### Performance Expectations

- Running a set of tests may take up to 4 minutes
- A full test run may take up to 15 minutes

### Working with Issues

- Maintainer comments in the issue should generally take priority over OP's comments
- Maintainers might give you hints on where to start. They are not always right, but a good place to start

### Debugging Tips

printf debugging is going to be very useful as you are figuring things out.
To do this, use `console.log`, but you'll need to `ts-ignore` it.
Write something like this:
```ts,diff
function checkSomething(n: Node) {
doSomething(n);
+ // @ts-ignore DEBUG CODE ONLY, REMOVE ME WHEN DONE
+ console.log(`Got node with pos = ${n.pos}`);
doSomethingElse(n);
}
```
We have a lot of enums so you might want to print back their symbolic name, to do this, index back into the name of the enum
```ts
// @ts-ignore DEBUG CODE ONLY, REMOVE ME WHEN DONE
console.log(`Got node with kind = ${SyntaxKind[n.kind]}`);
```

## Recommended Workflow

When fixing bugs or implementing features, follow this workflow:

1. **Make a testcase that demonstrates the behavior**
- Run it (by itself) and review the baselines it generates to ensure it demonstrates the bug
- Add the test and its baselines in one commit

2. **Fix the bug by changing code as appropriate**
- Put this fix in another commit

3. **Run the test you wrote again**
- Ensure the baselines change in a way that demonstrates that the bug is fixed
- Put this baseline diff in its own commit

4. **Add more testing**
- Once you've got the basics figured out, enhance your test to cover edge cases and other variations
- Run the test again and commit the baseline diff along with the test edit

5. **🚨 MANDATORY: Run all other tests to ensure you didn't break anything**
- **REQUIRED:** Run `npx hereby runtests-parallel` and wait for it to finish (10-15 minutes is normal!)
- **THIS STEP CANNOT BE SKIPPED** - patience is essential!
- Some collateral baseline changes are normal, but review for correctness
- Put these diffs in another commit

6. **🚨 MANDATORY: Lint and format your changes**
- **REQUIRED:** Run `npx hereby lint` and fix ALL issues
- **REQUIRED:** Run `npx hereby format` before you're done
- **YOU CANNOT FINISH WITHOUT THESE STEPS**
- Double-check your line endings. Source files in this repo typically use CRLF line endings. Fix all line endings to be consistent before you wrap up
6 changes: 1 addition & 5 deletions .github/pr_owners.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,10 @@ weswigham
andrewbranch
RyanCavanaugh
sheetalkamat
rbuckton
ahejlsberg
amcasey
minestarks
armanio123
gabritto
jakebailey
DanielRosenwasser
navya9singh
iisaduan
dependabot
johnfav03
9 changes: 5 additions & 4 deletions .github/workflows/accept-baselines-fix-lints.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Accept Baselines and Fix Lints
name: Accept Baselines, Fix Lints, and Format

on:
workflow_dispatch: {}
Expand All @@ -17,10 +17,10 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
token: ${{ secrets.TS_BOT_GITHUB_TOKEN }}
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
- uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
with:
node-version: 'lts/*'

Expand All @@ -32,8 +32,9 @@ jobs:
git rm -r --quiet tests/baselines/reference
npx hereby runtests-parallel --ci --fix || true
npx hereby baseline-accept
npx hereby format
git add ./src
git add ./tests/baselines/reference
git diff --cached
git commit -m "Update Baselines and/or Applied Lint Fixes"
git commit -m "Update Baselines, Applied Lint Fixes, and/or Formatted"
git push
Loading
Loading