Skip to content

Improve inference by not considering thisless functions to be context-sensitive - #62243

Merged
Gabriela Araujo Britto (gabritto) merged 16 commits into
microsoft:mainfrom
Andarist:no-context-sensitivity-for-this-less-functions
Dec 10, 2025
Merged

Improve inference by not considering thisless functions to be context-sensitive#62243
Gabriela Araujo Britto (gabritto) merged 16 commits into
microsoft:mainfrom
Andarist:no-context-sensitivity-for-this-less-functions

Conversation

@Andarist

Copy link
Copy Markdown
Contributor

implements Ryan Cavanaugh (@RyanCavanaugh)'s suggestion from #47599 :

As a stopgap, consider an object literal method to not be context-sensitive if it doesn't reference this. I believe we already have code for this and it would fix another large class of surprises.

fixes#62204
fixes#60986
fixes#58630
fixes#57572
fixes#56067
fixes#55489
fixes#55124
fixes#53924
fixes#50258

CopilotAI review requested due to automatic review settings August 9, 2025 19:05
@github-project-automationgithub-project-automationBot moved this to Not started in PR BacklogAug 9, 2025
@typescript-botTypeScript Bot (typescript-bot) added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Aug 9, 2025

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR improves TypeScript's type inference by making functions that don't reference this not context-sensitive. Previously, all object literal methods were considered context-sensitive, causing poor inference when type parameters depended on inferring from these methods first. The change helps TypeScript better infer types in common patterns involving object literals with functions.

Key Changes:

  • Modified hasContextSensitiveParameters to check for actual this usage rather than assuming all function-like declarations are context-sensitive
  • Updated binder to track this keyword usage with NodeFlags.ContainsThis flag
  • Extended context-sensitive checking to include yield expressions in generators

Reviewed Changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 3 comments.

Show a summary per file
FileDescription
src/compiler/binder.tsAdds tracking of this keyword usage and sets ContainsThis flag on functions
src/compiler/checker.tsUpdates context-sensitive checking to include yield expressions and generators
src/compiler/utilities.tsModifies hasContextSensitiveParameters and forEachYieldExpression to support new logic
tests/cases/compiler/*.tsNew test cases demonstrating improved inference for thisless functions
tests/baselines/reference/.Updated baselines showing improved type inference results

Comment threadsrc/compiler/utilities.ts
Comment threadsrc/compiler/binder.ts
Comment threadsrc/compiler/binder.ts Outdated
(node as FunctionLikeDeclaration | ClassStaticBlockDeclaration).endFlowNode = currentFlow;
}
if (seenThisKeyword) {
node.flags |= NodeFlags.ContainsThis;

CopilotAIAug 9, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's trailing whitespace at the end of this line. Remove the extra spaces.

Suggested change
node.flags|=NodeFlags.ContainsThis;
node.flags|=NodeFlags.ContainsThis;

Copilot uses AI. Check for mistakes.
case SyntaxKind.JSDocFunctionType:
case SyntaxKind.FunctionType:
case SyntaxKind.ConstructSignature:
case SyntaxKind.ConstructorType:

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Type-level AST nodes had ContainerFlags.IsControlFlowContainer here. This was messing up some of the changes I made since it was interfering with the implemented seenThisKeyword tracking. I don't see why those would be considered control flow containers and there are no tests proving it was needed.

Other changes in this function are basically of the same kind - I just removed ContainerFlags.IsControlFlowContainer from the type-level nodes.

@gabrittoGabriela Araujo Britto (gabritto)Dec 8, 2025

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We seem to have added at least one of those on purpose:
#8941
So I'm wondering why it's not needed anymore. Anders Hejlsberg (@ahejlsberg) do you remember why this was needed?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As to SyntaxKind.PropertyDeclaration - given the test from the referenced PR still works just OK, I'd assume that its needs are covered by arrow functions being treated as flow containers (arrows were used as property declaration initializers in that test).

Comment threadsrc/compiler/checker.ts Outdated

function isContextSensitiveFunctionLikeDeclaration(node: FunctionLikeDeclaration): boolean {
return hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node);
return hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node) || !!(getFunctionFlags(node) & FunctionFlags.Generator && node.body && forEachYieldExpression(node.body as Block, isContextSensitive));

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously generators were always context-sensitive as they can't even be arrow functions. At times, they are truly context-sensitive in cases like:

declarefunctiontest(gen: ()=>Generator<(arg: number)=>string,void,void>,): void;test(function*(){yield(arg)=>String(arg);});

So I had to add this extra forEachYieldExpression to cover for this

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just in terms of readability, maybe this would be better as its own function, then it can have a descriptive name like hasContextSensitiveYieldExpression and that example can be its documentation.

// in that traversal terminates in the event that 'visitor' supplies a truthy value.
/** @internal */
export function forEachYieldExpression(body: Block, visitor: (expr: YieldExpression) => void): void {
export function forEachYieldExpression<T>(body: Block, visitor: (expr: YieldExpression) => T): T | undefined {

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this basically changes this function to work in the same way as forEachReturnStatement defined above

const myStoreConnect: Connect = function(
>myStoreConnect : Connect
> : ^^^^^^^
>function( mapStateToProps?: any, mapDispatchToProps?: any, mergeProps?: any, options: unknown = {},) { return connect( mapStateToProps, mapDispatchToProps, mergeProps, options, );} : <TStateProps, TOwnProps>(mapStateToProps?: any, mapDispatchToProps?: any, mergeProps?: any, options?: unknown) => InferableComponentEnhancerWithProps<TStateProps, Omit<P, Extract<keyof TStateProps, keyof P>> & TOwnProps>

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this just changes the inferred type to match the type inferred from the equivalent arrow function with type parameters, it's purely a result of making a thisless function context-insensitive

> : ^^^^^^^^^^^^^^^
>strategy("Nothing", function* (state: State) { yield ; return state; // `return`/`TReturn` isn't supported by `strategy`, so this should error.}) : (a: State) => IterableIterator<State, void>
> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>strategy("Nothing", function* (state: State) { yield ; return state; // `return`/`TReturn` isn't supported by `strategy`, so this should error.}) : (a: any) => IterableIterator<any, void>

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

similarly here, this is a result of inferSignatureInstantiationForOverloadFailure no longer skipping the generator function on the basis it's context-sensitive (inferSignatureInstantiationForOverloadFailure uses CheckMode.SkipContextSensitive)

},
}
impl.explicitVoid1 = function () { return 12; };
>impl.explicitVoid1 = function () { return 12; } : (this: void) => number

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

those this parameters were not used by the assigned implementation - they were just auto-assigned to it based on the this parameter in the contextual signature

@jakebailey

Copy link
Copy Markdown
Member

TypeScript Bot (@typescript-bot) test it
TypeScript Bot (@typescript-bot) pack this

@typescript-bot

TypeScript Bot (typescript-bot) commented Aug 9, 2025

Copy link
Copy Markdown
Contributor

Starting jobs; this comment will be updated as builds start and complete.

CommandStatusResults
pack this✅ Started✅ Results
test top400✅ Started👀 Results
user test this✅ Started👀 Results
run dt✅ Started👀 Results
perf test this faster✅ Started👀 Results

@typescript-bot

TypeScript Bot (typescript-bot) commented Aug 9, 2025

Copy link
Copy Markdown
Contributor

Hey Jake Bailey (@jakebailey), I've packed this into an installable tgz. You can install it for testing by referencing it in your package.json like so:

{
"devDependencies": {
"typescript": "https://typescript.visualstudio.com/cf7ac146-d525-443c-b23c-0d58337efebc/_apis/build/builds/165836/artifacts?artifactName=tgz&fileId=13B4C26B69BE38B41CF288EF1AA02FC1EA994BAF88B23E179E9D52E418EE347402&fileName=/typescript-6.0.0-insiders.20250809.tgz"
}
}

and then running npm install.


There is also a playground for this build and an npm module you can use via "typescript": "npm:@typescript-deploys/pr-build@6.0.0-pr-62243-2".;

@typescript-bot

Copy link
Copy Markdown
Contributor

Hey Jake Bailey (@jakebailey), the results of running the DT tests are ready.

There were interesting changes:

Branch only errors:

Package: jqrangeslider
Error:

Error: /mnt/vss/_work/1/DefinitelyTyped/types/jqrangeslider/jqrangeslider-tests.ts
160:20 error TypeScript@local compile error: Function expression, which lacks return-type annotation, implicitly has an 'any' return type @definitelytyped/expect
✖ 1 problem (1 error, 0 warnings)
at combineErrorsAndWarnings (/mnt/vss/_work/1/DefinitelyTyped/node_modules/.pnpm/@definitelytyped+dtslint@0.2.33_typescript@6.0.0-dev.20250809/node_modules/@definitelytyped/dtslint/dist/index.js:199:28)
at runTests (/mnt/vss/_work/1/DefinitelyTyped/node_modules/.pnpm/@definitelytyped+dtslint@0.2.33_typescript@6.0.0-dev.20250809/node_modules/@definitelytyped/dtslint/dist/index.js:191:20)

You can check the log here.

@typescript-bot

Copy link
Copy Markdown
Contributor

Jake Bailey (@jakebailey) Here are the results of running the user tests with tsc comparing main and refs/pull/62243/merge:

There were infrastructure failures potentially unrelated to your change:

  • 1 instance of "Git clone failed"

Otherwise...

Something interesting changed - please have a look.

Details

effect

tsconfig.json

tsconfig.build.json

@typescript-bot

Copy link
Copy Markdown
Contributor

Jake Bailey (@jakebailey)
The results of the perf run you requested are in!

Here they are:

tsc

Comparison Report - baseline..pr
MetricbaselineprDeltaBestWorstp-value
Compiler-Unions - node (v18.15.0, x64)
Errors3434~~~p=1.000 n=6
Symbols62,37062,370~~~p=1.000 n=6
Types50,38650,386~~~p=1.000 n=6
Memory used192,921k (± 0.01%)194,706k (± 0.99%)~192,783k196,638kp=0.378 n=6
Parse Time1.30s (± 0.94%)1.31s (± 0.62%)~1.29s1.31sp=1.000 n=6
Bind Time0.73s0.73s~~~p=1.000 n=6
Check Time9.74s (± 0.27%)9.71s (± 0.31%)~9.67s9.76sp=0.107 n=6
Emit Time2.73s (± 0.85%)2.73s (± 0.98%)~2.68s2.76sp=0.737 n=6
Total Time14.51s (± 0.26%)14.48s (± 0.29%)~14.41s14.53sp=0.259 n=6
angular-1 - node (v18.15.0, x64)
Errors5656~~~p=1.000 n=6
Symbols948,914948,687-227 (- 0.02%)~~p=0.001 n=6
Types410,884410,829-55 (- 0.01%)~~p=0.001 n=6
Memory used1,226,420k (± 0.00%)1,225,226k (± 0.01%)-1,194k (- 0.10%)1,225,099k1,225,315kp=0.005 n=6
Parse Time6.51s (± 0.76%)6.54s (± 0.75%)~6.48s6.61sp=0.295 n=6
Bind Time1.87s (± 0.28%)1.88s (± 0.22%)+0.01s (+ 0.44%)1.88s1.89sp=0.022 n=6
Check Time32.02s (± 0.51%)31.97s (± 0.26%)~31.86s32.07sp=0.298 n=6
Emit Time14.67s (± 1.19%)14.85s (± 0.47%)~14.74s14.92sp=0.092 n=6
Total Time55.07s (± 0.48%)55.24s (± 0.19%)~55.06s55.34sp=0.298 n=6
mui-docs - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols2,548,6222,548,597-25 (- 0.00%)~~p=0.001 n=6
Types903,221903,206-15 (- 0.00%)~~p=0.001 n=6
Memory used2,833,313k (± 0.00%)2,832,160k (± 0.00%)-1,153k (- 0.04%)2,832,066k2,832,299kp=0.005 n=6
Parse Time8.77s (± 0.32%)8.77s (± 0.17%)~8.74s8.78sp=0.935 n=6
Bind Time2.25s (± 0.61%)2.26s (± 0.23%)~2.25s2.26sp=0.928 n=6
Check Time85.83s (± 0.60%)85.84s (± 0.52%)~85.29s86.48sp=0.936 n=6
Emit Time2.32s (± 3.91%)2.23s (± 9.27%)~2.04s2.48sp=0.574 n=6
Total Time99.16s (± 0.53%)99.10s (± 0.40%)~98.38s99.51sp=0.810 n=6
self-build-src - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols1,227,0661,227,058-8 (- 0.00%)~~p=0.001 n=6
Types267,480267,484+4 (+ 0.00%)~~p=0.001 n=6
Memory used2,363,039k (± 0.03%)2,418,908k (± 6.14%)~2,357,778k2,722,466kp=0.066 n=6
Parse Time5.19s (± 0.86%)5.24s (± 0.93%)~5.18s5.31sp=0.128 n=6
Bind Time1.78s (± 0.61%)1.81s (± 0.73%)+0.03s (+ 1.59%)1.79s1.83sp=0.009 n=6
Check Time35.41s (± 0.33%)35.31s (± 0.64%)~34.99s35.64sp=0.471 n=6
Emit Time2.99s (± 2.39%)3.05s (± 2.72%)~2.98s3.21sp=0.149 n=6
Total Time45.39s (± 0.43%)45.41s (± 0.54%)~45.11s45.77sp=0.936 n=6
self-build-src-public-api - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols1,227,0661,227,058-8 (- 0.00%)~~p=0.001 n=6
Types267,480267,484+4 (+ 0.00%)~~p=0.001 n=6
Memory used2,824,370k (±13.26%)2,940,432k (±11.52%)~2,428,471k3,157,631kp=0.575 n=6
Parse Time6.83s (± 1.55%)6.82s (± 1.38%)~6.69s6.90sp=0.521 n=6
Bind Time2.18s (± 2.34%)2.21s (± 1.13%)~2.18s2.25sp=0.148 n=6
Check Time42.73s (± 0.81%)42.93s (± 0.84%)~42.21s43.22sp=0.378 n=6
Emit Time3.56s (± 1.53%)3.58s (± 2.67%)~3.44s3.67sp=0.575 n=6
Total Time55.30s (± 0.80%)55.55s (± 0.83%)~54.65s55.98sp=0.471 n=6
self-compiler - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols262,555262,559+4 (+ 0.00%)~~p=0.001 n=6
Types107,165107,177+12 (+ 0.01%)~~p=0.001 n=6
Memory used441,956k (± 0.01%)441,608k (± 0.01%)-348k (- 0.08%)441,571k441,667kp=0.005 n=6
Parse Time4.38s (± 0.72%)4.38s (± 0.64%)~4.34s4.42sp=0.935 n=6
Bind Time1.62s (± 0.75%)1.63s (± 1.19%)~1.61s1.66sp=0.868 n=6
Check Time23.48s (± 0.23%)23.49s (± 0.30%)~23.41s23.58sp=0.936 n=6
Emit Time1.91s (± 0.97%)1.91s (± 0.63%)~1.89s1.92sp=0.625 n=6
Total Time31.39s (± 0.16%)31.40s (± 0.19%)~31.33s31.48sp=0.810 n=6
ts-pre-modules - node (v18.15.0, x64)
Errors7171~~~p=1.000 n=6
Symbols225,367225,367~~~p=1.000 n=6
Types94,29094,290~~~p=1.000 n=6
Memory used371,100k (± 0.01%)370,813k (± 0.02%)-287k (- 0.08%)370,749k370,919kp=0.005 n=6
Parse Time2.89s (± 1.00%)2.90s (± 1.36%)~2.84s2.94sp=0.573 n=6
Bind Time1.59s (± 0.47%)1.64s (± 1.76%)+0.04s (+ 2.72%)1.60s1.68sp=0.007 n=6
Check Time16.45s (± 0.36%)16.44s (± 0.33%)~16.37s16.51sp=0.689 n=6
Emit Time0.00s (±244.70%)0.00s~~~p=0.405 n=6
Total Time20.93s (± 0.36%)20.96s (± 0.34%)~20.86s21.05sp=0.520 n=6
vscode - node (v18.15.0, x64)
Errors16🔻+5 (+500.00%)~~p=0.001 n=6
Symbols3,843,5143,839,554-3,960 (- 0.10%)~~p=0.001 n=6
Types1,211,4011,210,628-773 (- 0.06%)~~p=0.001 n=6
Memory used3,677,122k (± 0.00%)3,674,086k (± 0.00%)-3,036k (- 0.08%)3,673,905k3,674,201kp=0.005 n=6
Parse Time15.27s (± 0.69%)15.30s (± 0.56%)~15.20s15.45sp=0.423 n=6
Bind Time4.94s (± 0.50%)5.04s (± 2.69%)~4.95s5.23sp=0.064 n=6
Check Time101.40s (± 1.96%)103.38s (± 3.10%)~100.01s109.50sp=0.230 n=6
Emit Time34.63s (±26.92%)32.00s (± 8.83%)~30.52s37.76sp=1.000 n=6
Total Time156.24s (± 6.40%)155.74s (± 2.41%)~151.55s160.88sp=0.297 n=6
webpack - node (v18.15.0, x64)
Errors22~~~p=1.000 n=6
Symbols320,272320,263-9 (- 0.00%)~~p=0.001 n=6
Types139,137139,125-12 (- 0.01%)~~p=0.001 n=6
Memory used476,591k (± 0.03%)476,019k (± 0.02%)-572k (- 0.12%)475,920k476,167kp=0.005 n=6
Parse Time4.33s (± 0.45%)4.34s (± 0.27%)~4.33s4.36sp=0.618 n=6
Bind Time1.85s (± 0.95%)1.84s (± 1.22%)~1.82s1.87sp=0.413 n=6
Check Time21.10s (± 0.61%)21.14s (± 0.28%)~21.07s21.21sp=0.521 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time27.27s (± 0.49%)27.31s (± 0.28%)~27.23s27.42sp=0.520 n=6
xstate-main - node (v18.15.0, x64)
Errors3030~~~p=1.000 n=6
Symbols663,630663,455-175 (- 0.03%)~~p=0.001 n=6
Types198,311198,165-146 (- 0.07%)~~p=0.001 n=6
Memory used570,537k (± 0.02%)569,637k (± 0.03%)-900k (- 0.16%)569,437k569,810kp=0.005 n=6
Parse Time4.28s (± 0.79%)4.28s (± 0.65%)~4.24s4.32sp=1.000 n=6
Bind Time1.33s (± 0.77%)1.32s (± 0.88%)~1.31s1.34sp=0.117 n=6
Check Time20.07s (± 1.90%)20.21s (± 1.70%)~19.87s20.60sp=0.298 n=6
Emit Time0.00s0.00s (±244.70%)~0.00s0.01sp=0.405 n=6
Total Time25.68s (± 1.56%)25.81s (± 1.43%)~25.46s26.25sp=0.470 n=6
System info unknown
Hosts
  • node (v18.15.0, x64)
Scenarios
  • Compiler-Unions - node (v18.15.0, x64)
  • angular-1 - node (v18.15.0, x64)
  • mui-docs - node (v18.15.0, x64)
  • self-build-src - node (v18.15.0, x64)
  • self-build-src-public-api - node (v18.15.0, x64)
  • self-compiler - node (v18.15.0, x64)
  • ts-pre-modules - node (v18.15.0, x64)
  • vscode - node (v18.15.0, x64)
  • webpack - node (v18.15.0, x64)
  • xstate-main - node (v18.15.0, x64)
BenchmarkNameIterations
Currentpr6
Baselinebaseline6

Developer Information:

Download Benchmarks

@typescript-bot

Copy link
Copy Markdown
Contributor

Jake Bailey (@jakebailey) Here are the results of running the top 400 repos with tsc comparing main and refs/pull/62243/merge:

Something interesting changed - please have a look.

Details

reduxjs/reselect

test/tsconfig.json

steven-tey/novel

1 of 2 projects failed to build with the old tsc and were ignored

packages/headless/tsconfig.json

ueberdosis/tiptap

3 of 8 projects failed to build with the old tsc and were ignored

tests/cypress/tsconfig.json

@Andarist

Mateusz Burzyński (Andarist) commented Aug 10, 2025

Copy link
Copy Markdown
ContributorAuthor
  1. jqrangeslider break - I'm not concerned about it. It already behaves quite weirdly today: TS playground
  2. novel break - this is an improvement. The current code only works because it infers any for the extension's options: TS playground. It's not great that using this in addOptions makes it to infer any again - but that's not a new problem.
  3. tiptap break - this is basically the same as above (the above uses tiptap). This code only works now because it infers any for the options: TS playground
  4. reselect break - this is just a moved error position (the new position matches the position reported when an arrow function is used instead of a function expression): TS playground. It's worth noting those were changed in tests that inentionally use invalid arguments to test that a runtime error is thrown when the function receives them
  5. effect break - this one is actually bad for their users: TS playground. Without this change they are able to benefit from the return type inference. With this change, they could benefit from it but some earlier inferences made from returnOnlyType prevent that. This type was never created before for generators as they were always considered to have a context-sensitive parameter. THIS IS FIXED

@jakebailey

Copy link
Copy Markdown
Member

TypeScript Bot (@typescript-bot) test it
TypeScript Bot (@typescript-bot) pack this

@typescript-bot

TypeScript Bot (typescript-bot) commented Aug 11, 2025

Copy link
Copy Markdown
Contributor

Starting jobs; this comment will be updated as builds start and complete.

CommandStatusResults
pack this✅ Started✅ Results
test top400✅ Started👀 Results
user test this✅ Started👀 Results
run dt✅ Started👀 Results
perf test this faster✅ Started👀 Results

@typescript-bot

TypeScript Bot (typescript-bot) commented Aug 11, 2025

Copy link
Copy Markdown
Contributor

Hey Jake Bailey (@jakebailey), I've packed this into an installable tgz. You can install it for testing by referencing it in your package.json like so:

{
"devDependencies": {
"typescript": "https://typescript.visualstudio.com/cf7ac146-d525-443c-b23c-0d58337efebc/_apis/build/builds/165850/artifacts?artifactName=tgz&fileId=8C27070A12055925406C680737D02B67824D8D3CFB34BD5BC89B4B93A679A97B02&fileName=/typescript-6.0.0-insiders.20250811.tgz"
}
}

and then running npm install.


There is also a playground for this build and an npm module you can use via "typescript": "npm:@typescript-deploys/pr-build@6.0.0-pr-62243-10".;

@typescript-bot

Copy link
Copy Markdown
Contributor

Hey Jake Bailey (@jakebailey), the results of running the DT tests are ready.

There were interesting changes:

Branch only errors:

Package: jqrangeslider
Error:

Error: /mnt/vss/_work/1/DefinitelyTyped/types/jqrangeslider/jqrangeslider-tests.ts
160:20 error TypeScript@local compile error: Function expression, which lacks return-type annotation, implicitly has an 'any' return type @definitelytyped/expect
✖ 1 problem (1 error, 0 warnings)
at combineErrorsAndWarnings (/mnt/vss/_work/1/DefinitelyTyped/node_modules/.pnpm/@definitelytyped+dtslint@0.2.33_typescript@6.0.0-dev.20250811/node_modules/@definitelytyped/dtslint/dist/index.js:199:28)
at runTests (/mnt/vss/_work/1/DefinitelyTyped/node_modules/.pnpm/@definitelytyped+dtslint@0.2.33_typescript@6.0.0-dev.20250811/node_modules/@definitelytyped/dtslint/dist/index.js:191:20)

You can check the log here.

@Andarist

Copy link
Copy Markdown
ContributorAuthor

Gabriela Araujo Britto (@gabritto) in case you have missed it, I commented on the breaks here

@jakebailey

Copy link
Copy Markdown
Member

The perf run shows 5 new errors in vscode; I am not sure why they are not showing up in the top or user tests...

@Andarist

Copy link
Copy Markdown
ContributorAuthor

Jake Bailey (@jakebailey) thanks for noticing, I'll look into it

@Andarist

Mateusz Burzyński (Andarist) commented Dec 9, 2025

Copy link
Copy Markdown
ContributorAuthor

microsoft/vscode#282223 should address VS Code break. A general fix for this issue could be a performant version of #57421 .

I have prototyped locally a version of contextuallyCheckFunctionExpressionOrObjectLiteralMethod that could address the vscode break without changing their project but I'd consider it to be something out of the scope of this PR here. It would also only address the issue in a subset of scenarios (a solution to #57421 would still be required to fix it altogether)

@gabritto

Copy link
Copy Markdown
Member

Jake Bailey (@jakebailey) Here are the results of running the top 400 repos with tsc comparing main and refs/pull/62243/merge:

Something interesting changed - please have a look.

Details

steven-tey/novel

1 of 2 projects failed to build with the old tsc and were ignored

packages/headless/tsconfig.json

This error looks correct but is unfortunate because it's caused by the type cast (as SuggestionOptions) + improved inference with this PR.

@github-project-automationgithub-project-automationBot moved this from Not started to Needs merge in PR BacklogDec 10, 2025
Merged via the queue into microsoft:main with commit 366da34Dec 10, 2025
33 checks passed
@github-project-automationgithub-project-automationBot moved this from Needs merge to Done in PR BacklogDec 10, 2025
@Andarist
Mateusz Burzyński (Andarist) deleted the no-context-sensitivity-for-this-less-functions branch December 11, 2025 09:31
@microsoftMicrosoft (microsoft) locked as resolved and limited conversation to collaborators Jun 10, 2026
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

For Uncommitted BugPR for untriaged, rejected, closed or missing bug

Projects

Status: Done

6 participants

@Andarist@jakebailey@typescript-bot@gabritto@andrewbranch