diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts
index 27ec079f614ab..685b713d5a2cc 100644
--- a/src/compiler/binder.ts
+++ b/src/compiler/binder.ts
@@ -1014,6 +1014,7 @@ function createBinder(): (file: SourceFile, options: CompilerOptions) => void {
const saveExceptionTarget = currentExceptionTarget;
const saveActiveLabelList = activeLabelList;
const saveHasExplicitReturn = hasExplicitReturn;
+ const saveSeenThisKeyword = seenThisKeyword;
const isImmediatelyInvoked = (
containerFlags & ContainerFlags.IsFunctionExpression &&
!hasSyntacticModifier(node, ModifierFlags.Async) &&
@@ -1036,19 +1037,22 @@ function createBinder(): (file: SourceFile, options: CompilerOptions) => void {
currentContinueTarget = undefined;
activeLabelList = undefined;
hasExplicitReturn = false;
+ seenThisKeyword = false;
bindChildren(node);
- // Reset all reachability check related flags on node (for incremental scenarios)
- node.flags &= ~NodeFlags.ReachabilityAndEmitFlags;
+ // Reset flags (for incremental scenarios)
+ node.flags &= ~(NodeFlags.ReachabilityAndEmitFlags | NodeFlags.ContainsThis);
if (!(currentFlow.flags & FlowFlags.Unreachable) && containerFlags & ContainerFlags.IsFunctionLike && nodeIsPresent((node as FunctionLikeDeclaration | ClassStaticBlockDeclaration).body)) {
node.flags |= NodeFlags.HasImplicitReturn;
if (hasExplicitReturn) node.flags |= NodeFlags.HasExplicitReturn;
(node as FunctionLikeDeclaration | ClassStaticBlockDeclaration).endFlowNode = currentFlow;
}
+ if (seenThisKeyword) {
+ node.flags |= NodeFlags.ContainsThis;
+ }
if (node.kind === SyntaxKind.SourceFile) {
node.flags |= emitFlags;
(node as SourceFile).endFlowNode = currentFlow;
}
-
if (currentReturnTarget) {
addAntecedent(currentReturnTarget, currentFlow);
currentFlow = finishFlowLabel(currentReturnTarget);
@@ -1065,12 +1069,15 @@ function createBinder(): (file: SourceFile, options: CompilerOptions) => void {
currentExceptionTarget = saveExceptionTarget;
activeLabelList = saveActiveLabelList;
hasExplicitReturn = saveHasExplicitReturn;
+ seenThisKeyword = node.kind === SyntaxKind.ArrowFunction ? saveSeenThisKeyword || seenThisKeyword : saveSeenThisKeyword;
}
else if (containerFlags & ContainerFlags.IsInterface) {
+ const saveSeenThisKeyword = seenThisKeyword;
seenThisKeyword = false;
bindChildren(node);
Debug.assertNotNode(node, isIdentifier); // ContainsThis cannot overlap with HasExtendedUnicodeEscape on Identifier
node.flags = seenThisKeyword ? node.flags | NodeFlags.ContainsThis : node.flags & ~NodeFlags.ContainsThis;
+ seenThisKeyword = saveSeenThisKeyword;
}
else {
bindChildren(node);
@@ -2873,6 +2880,9 @@ function createBinder(): (file: SourceFile, options: CompilerOptions) => void {
}
// falls through
case SyntaxKind.ThisKeyword:
+ if (node.kind === SyntaxKind.ThisKeyword) {
+ seenThisKeyword = true;
+ }
// TODO: Why use `isExpression` here? both Identifier and ThisKeyword are expressions.
if (currentFlow && (isExpression(node) || parent.kind === SyntaxKind.ShorthandPropertyAssignment)) {
(node as Identifier | ThisExpression).flowNode = currentFlow;
@@ -3941,6 +3951,8 @@ export function getContainerFlags(node: Node): ContainerFlags {
// falls through
case SyntaxKind.Constructor:
case SyntaxKind.FunctionDeclaration:
+ case SyntaxKind.ClassStaticBlockDeclaration:
+ return ContainerFlags.IsContainer | ContainerFlags.IsControlFlowContainer | ContainerFlags.HasLocals | ContainerFlags.IsFunctionLike;
case SyntaxKind.MethodSignature:
case SyntaxKind.CallSignature:
case SyntaxKind.JSDocSignature:
@@ -3948,12 +3960,11 @@ export function getContainerFlags(node: Node): ContainerFlags {
case SyntaxKind.FunctionType:
case SyntaxKind.ConstructSignature:
case SyntaxKind.ConstructorType:
- case SyntaxKind.ClassStaticBlockDeclaration:
- return ContainerFlags.IsContainer | ContainerFlags.IsControlFlowContainer | ContainerFlags.HasLocals | ContainerFlags.IsFunctionLike;
+ return ContainerFlags.IsContainer | ContainerFlags.HasLocals | ContainerFlags.IsFunctionLike;
case SyntaxKind.JSDocImportTag:
// treat as a container to prevent using an enclosing effective host, ensuring import bindings are scoped correctly
- return ContainerFlags.IsContainer | ContainerFlags.IsControlFlowContainer | ContainerFlags.HasLocals;
+ return ContainerFlags.IsContainer | ContainerFlags.HasLocals;
case SyntaxKind.FunctionExpression:
case SyntaxKind.ArrowFunction:
@@ -3961,8 +3972,6 @@ export function getContainerFlags(node: Node): ContainerFlags {
case SyntaxKind.ModuleBlock:
return ContainerFlags.IsControlFlowContainer;
- case SyntaxKind.PropertyDeclaration:
- return (node as PropertyDeclaration).initializer ? ContainerFlags.IsControlFlowContainer : 0;
case SyntaxKind.CatchClause:
case SyntaxKind.ForStatement:
diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts
index 75be36474222f..a376424c79681 100644
--- a/src/compiler/checker.ts
+++ b/src/compiler/checker.ts
@@ -21135,9 +21135,10 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
const { initializer } = node as JsxAttribute;
return !!initializer && isContextSensitive(initializer);
}
- case SyntaxKind.JsxExpression: {
+ case SyntaxKind.JsxExpression:
+ case SyntaxKind.YieldExpression: {
// It is possible to that node.expression is undefined (e.g
)
- const { expression } = node as JsxExpression;
+ const { expression } = node as JsxExpression | YieldExpression;
return !!expression && isContextSensitive(expression);
}
}
@@ -21146,7 +21147,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
}
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));
}
function hasContextSensitiveReturnExpression(node: FunctionLikeDeclaration) {
diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts
index 4687bb8796fad..3fb29ef54c005 100644
--- a/src/compiler/utilities.ts
+++ b/src/compiler/utilities.ts
@@ -2864,19 +2864,24 @@ export function forEachReturnStatement(body: Block | Statement, visitor: (stm
}
}
+// Warning: This has the same semantics as the forEach family of functions,
+// 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(body: Block, visitor: (expr: YieldExpression) => T): T | undefined {
return traverse(body);
- function traverse(node: Node): void {
+ function traverse(node: Node): T | undefined {
switch (node.kind) {
case SyntaxKind.YieldExpression:
- visitor(node as YieldExpression);
+ const value = visitor(node as YieldExpression);
+ if (value) {
+ return value;
+ }
const operand = (node as YieldExpression).expression;
- if (operand) {
- traverse(operand);
+ if (!operand) {
+ return;
}
- return;
+ return traverse(operand);
case SyntaxKind.EnumDeclaration:
case SyntaxKind.InterfaceDeclaration:
case SyntaxKind.ModuleDeclaration:
@@ -2889,14 +2894,13 @@ export function forEachYieldExpression(body: Block, visitor: (expr: YieldExpress
if (node.name && node.name.kind === SyntaxKind.ComputedPropertyName) {
// Note that we will not include methods/accessors of a class because they would require
// first descending into the class. This is by design.
- traverse(node.name.expression);
- return;
+ return traverse(node.name.expression);
}
}
else if (!isPartOfTypeNode(node)) {
// This is the general case, which should include mostly expressions and statements.
// Also includes NodeArrays.
- forEachChild(node, traverse);
+ return forEachChild(node, traverse);
}
}
}
@@ -10825,7 +10829,7 @@ export function hasContextSensitiveParameters(node: FunctionLikeDeclaration): bo
// an implicit 'this' parameter which is subject to contextual typing.
const parameter = firstOrUndefined(node.parameters);
if (!(parameter && parameterIsThisKeyword(parameter))) {
- return true;
+ return !!(node.flags & NodeFlags.ContainsThis);
}
}
}
diff --git a/tests/baselines/reference/circularlySimplifyingConditionalTypesNoCrash.types b/tests/baselines/reference/circularlySimplifyingConditionalTypesNoCrash.types
index 765ca3234d8cb..5aa7b5c308c6b 100644
--- a/tests/baselines/reference/circularlySimplifyingConditionalTypesNoCrash.types
+++ b/tests/baselines/reference/circularlySimplifyingConditionalTypesNoCrash.types
@@ -68,8 +68,8 @@ declare var connect: Connect;
const myStoreConnect: Connect = function(
>myStoreConnect : Connect
> : ^^^^^^^
->function( mapStateToProps?: any, mapDispatchToProps?: any, mergeProps?: any, options: unknown = {},) { return connect( mapStateToProps, mapDispatchToProps, mergeProps, options, );} : (mapStateToProps?: any, mapDispatchToProps?: any, mergeProps?: any, options?: unknown) => InferableComponentEnhancerWithProps> & TOwnProps>
-> : ^ ^^ ^^ ^^^ ^^ ^^^ ^^ ^^^ ^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>function( mapStateToProps?: any, mapDispatchToProps?: any, mergeProps?: any, options: unknown = {},) { return connect( mapStateToProps, mapDispatchToProps, mergeProps, options, );} : (mapStateToProps?: any, mapDispatchToProps?: any, mergeProps?: any, options?: unknown) => InferableComponentEnhancerWithProps> & TOwnProps>
+> : ^ ^^^ ^^ ^^^ ^^ ^^^ ^^ ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
mapStateToProps?: any,
>mapStateToProps : any
diff --git a/tests/baselines/reference/classCanExtendConstructorFunction.errors.txt b/tests/baselines/reference/classCanExtendConstructorFunction.errors.txt
index 6be00dcf3fb7c..d7a29da097bae 100644
--- a/tests/baselines/reference/classCanExtendConstructorFunction.errors.txt
+++ b/tests/baselines/reference/classCanExtendConstructorFunction.errors.txt
@@ -1,6 +1,6 @@
first.js(23,9): error TS2554: Expected 1 arguments, but got 0.
first.js(31,5): error TS2416: Property 'load' in type 'Sql' is not assignable to the same property in base type 'Wagon'.
- Type '(files: string[], format: "csv" | "json" | "xmlolololol") => void' is not assignable to type '(supplies?: any[]) => void'.
+ Type '(files: string[], format: "csv" | "json" | "xmlolololol") => void' is not assignable to type '(supplies?: any[] | undefined) => void'.
Target signature provides too few arguments. Expected 2 or more, but got 1.
first.js(47,24): error TS2507: Type '(numberEaten: number) => void' is not a constructor function type.
generic.js(19,19): error TS2554: Expected 1 arguments, but got 0.
@@ -8,7 +8,7 @@ generic.js(20,32): error TS2345: Argument of type 'number' is not assignable to
second.ts(8,25): error TS2507: Type '(numberEaten: number) => void' is not a constructor function type.
second.ts(14,7): error TS2417: Class static side 'typeof Conestoga' incorrectly extends base class static side 'typeof Wagon'.
Types of property 'circle' are incompatible.
- Type '(others: (typeof Wagon)[]) => number' is not assignable to type '(wagons?: Wagon[]) => number'.
+ Type '(others: (typeof Wagon)[]) => number' is not assignable to type '(wagons?: Wagon[] | undefined) => number'.
Types of parameters 'others' and 'wagons' are incompatible.
Type 'Wagon[]' is not assignable to type '(typeof Wagon)[]'.
Property 'circle' is missing in type 'Wagon' but required in type 'typeof Wagon'.
@@ -52,7 +52,7 @@ second.ts(17,15): error TS2345: Argument of type 'string' is not assignable to p
load(files, format) {
~~~~
!!! error TS2416: Property 'load' in type 'Sql' is not assignable to the same property in base type 'Wagon'.
-!!! error TS2416: Type '(files: string[], format: "csv" | "json" | "xmlolololol") => void' is not assignable to type '(supplies?: any[]) => void'.
+!!! error TS2416: Type '(files: string[], format: "csv" | "json" | "xmlolololol") => void' is not assignable to type '(supplies?: any[] | undefined) => void'.
!!! error TS2416: Target signature provides too few arguments. Expected 2 or more, but got 1.
if (format === "xmlolololol") {
throw new Error("please do not use XML. It was a joke.");
@@ -95,7 +95,7 @@ second.ts(17,15): error TS2345: Argument of type 'string' is not assignable to p
~~~~~~~~~
!!! error TS2417: Class static side 'typeof Conestoga' incorrectly extends base class static side 'typeof Wagon'.
!!! error TS2417: Types of property 'circle' are incompatible.
-!!! error TS2417: Type '(others: (typeof Wagon)[]) => number' is not assignable to type '(wagons?: Wagon[]) => number'.
+!!! error TS2417: Type '(others: (typeof Wagon)[]) => number' is not assignable to type '(wagons?: Wagon[] | undefined) => number'.
!!! error TS2417: Types of parameters 'others' and 'wagons' are incompatible.
!!! error TS2417: Type 'Wagon[]' is not assignable to type '(typeof Wagon)[]'.
!!! error TS2417: Property 'circle' is missing in type 'Wagon' but required in type 'typeof Wagon'.
diff --git a/tests/baselines/reference/generatorTypeCheck62.types b/tests/baselines/reference/generatorTypeCheck62.types
index 6196ace757ddb..0a4b1e599cf2e 100644
--- a/tests/baselines/reference/generatorTypeCheck62.types
+++ b/tests/baselines/reference/generatorTypeCheck62.types
@@ -117,8 +117,8 @@ export const Nothing2: Strategy = strategy("Nothing", function*(state: St
export const Nothing3: Strategy = strategy("Nothing", function* (state: State) {
>Nothing3 : Strategy
> : ^^^^^^^^^^^^^^^
->strategy("Nothing", function* (state: State) { yield ; return state; // `return`/`TReturn` isn't supported by `strategy`, so this should error.}) : (a: State) => IterableIterator
-> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>strategy("Nothing", function* (state: State) { yield ; return state; // `return`/`TReturn` isn't supported by `strategy`, so this should error.}) : (a: any) => IterableIterator
+> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>strategy : (stratName: string, gen: (a: T) => IterableIterator) => (a: T) => IterableIterator
> : ^ ^^^^^^^^^ ^^ ^^ ^^ ^^ ^^^^^
>"Nothing" : "Nothing"
diff --git a/tests/baselines/reference/jsdocTemplateTag.errors.txt b/tests/baselines/reference/jsdocTemplateTag.errors.txt
index 74a150c6e3cd0..308b9e4bd23c7 100644
--- a/tests/baselines/reference/jsdocTemplateTag.errors.txt
+++ b/tests/baselines/reference/jsdocTemplateTag.errors.txt
@@ -1,4 +1,4 @@
-forgot.js(23,1): error TS2322: Type '(keyframes: any[]) => void' is not assignable to type '(keyframes: Keyframe[] | PropertyIndexedKeyframes, options?: number | KeyframeAnimationOptions) => Animation'.
+forgot.js(23,1): error TS2322: Type '(keyframes: Array) => void' is not assignable to type '(keyframes: Keyframe[] | PropertyIndexedKeyframes, options?: number | KeyframeAnimationOptions) => Animation'.
Type 'void' is not assignable to type 'Animation'.
@@ -27,6 +27,6 @@ forgot.js(23,1): error TS2322: Type '(keyframes: any[]) => void' is not assignab
*/
Element.prototype.animate = function(keyframes) {};
~~~~~~~~~~~~~~~~~~~~~~~~~
-!!! error TS2322: Type '(keyframes: any[]) => void' is not assignable to type '(keyframes: Keyframe[] | PropertyIndexedKeyframes, options?: number | KeyframeAnimationOptions) => Animation'.
+!!! error TS2322: Type '(keyframes: Array) => void' is not assignable to type '(keyframes: Keyframe[] | PropertyIndexedKeyframes, options?: number | KeyframeAnimationOptions) => Animation'.
!!! error TS2322: Type 'void' is not assignable to type 'Animation'.
\ No newline at end of file
diff --git a/tests/baselines/reference/redefineArray.errors.txt b/tests/baselines/reference/redefineArray.errors.txt
index 26fe0e4693d77..6f1129f6b5d87 100644
--- a/tests/baselines/reference/redefineArray.errors.txt
+++ b/tests/baselines/reference/redefineArray.errors.txt
@@ -1,8 +1,8 @@
-redefineArray.ts(1,1): error TS2741: Property 'isArray' is missing in type '(n: number, s: string) => number' but required in type 'ArrayConstructor'.
+redefineArray.ts(1,1): error TS2741: Property 'isArray' is missing in type '(n: number, s: string) => number' but required in type 'ArrayConstructor'.
==== redefineArray.ts (1 errors) ====
Array = function (n:number, s:string) {return n;};
~~~~~
-!!! error TS2741: Property 'isArray' is missing in type '(n: number, s: string) => number' but required in type 'ArrayConstructor'.
+!!! error TS2741: Property 'isArray' is missing in type '(n: number, s: string) => number' but required in type 'ArrayConstructor'.
!!! related TS2728 lib.es5.d.ts:--:--: 'isArray' is declared here.
\ No newline at end of file
diff --git a/tests/baselines/reference/redefineArray.types b/tests/baselines/reference/redefineArray.types
index d4df39d46b393..221d20711fa31 100644
--- a/tests/baselines/reference/redefineArray.types
+++ b/tests/baselines/reference/redefineArray.types
@@ -2,12 +2,12 @@
=== redefineArray.ts ===
Array = function (n:number, s:string) {return n;};
->Array = function (n:number, s:string) {return n;} : (n: number, s: string) => number
-> : ^ ^^ ^^ ^^ ^^ ^^^^^^^^^^^
+>Array = function (n:number, s:string) {return n;} : (n: number, s: string) => number
+> : ^ ^^ ^^ ^^ ^^^^^^^^^^^
>Array : ArrayConstructor
> : ^^^^^^^^^^^^^^^^
->function (n:number, s:string) {return n;} : (n: number, s: string) => number
-> : ^ ^^ ^^ ^^ ^^ ^^^^^^^^^^^
+>function (n:number, s:string) {return n;} : (n: number, s: string) => number
+> : ^ ^^ ^^ ^^ ^^^^^^^^^^^
>n : number
> : ^^^^^^
>s : string
diff --git a/tests/baselines/reference/thisTypeInFunctions.types b/tests/baselines/reference/thisTypeInFunctions.types
index 1f704de6562eb..26dbe2202d918 100644
--- a/tests/baselines/reference/thisTypeInFunctions.types
+++ b/tests/baselines/reference/thisTypeInFunctions.types
@@ -203,8 +203,8 @@ function implicitThis(n: number): number {
let impl: I = {
>impl : I
> : ^
->{ a: 12, explicitVoid2: () => this.a, // ok, this: any because it refers to some outer object (window?) explicitVoid1() { return 12; }, explicitStructural() { return this.a; }, explicitInterface() { return this.a; }, explicitThis() { return this.a; },} : { a: number; explicitVoid2: () => any; explicitVoid1(this: void): number; explicitStructural(this: { a: number; }): number; explicitInterface(this: I): number; explicitThis(this: I): number; }
-> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^
+>{ a: 12, explicitVoid2: () => this.a, // ok, this: any because it refers to some outer object (window?) explicitVoid1() { return 12; }, explicitStructural() { return this.a; }, explicitInterface() { return this.a; }, explicitThis() { return this.a; },} : { a: number; explicitVoid2: () => any; explicitVoid1(): number; explicitStructural(this: { a: number; }): number; explicitInterface(this: I): number; explicitThis(this: I): number; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^
a: 12,
>a : number
@@ -225,8 +225,8 @@ let impl: I = {
> : ^^^
explicitVoid1() { return 12; },
->explicitVoid1 : (this: void) => number
-> : ^ ^^ ^^^^^^^^^^^
+>explicitVoid1 : () => number
+> : ^^^^^^^^^^^^
>12 : 12
> : ^^
@@ -271,16 +271,16 @@ let impl: I = {
},
}
impl.explicitVoid1 = function () { return 12; };
->impl.explicitVoid1 = function () { return 12; } : (this: void) => number
-> : ^ ^^ ^^^^^^^^^^^
+>impl.explicitVoid1 = function () { return 12; } : () => number
+> : ^^^^^^^^^^^^
>impl.explicitVoid1 : (this: void) => number
> : ^ ^^ ^^^^^
>impl : I
> : ^
>explicitVoid1 : (this: void) => number
> : ^ ^^ ^^^^^
->function () { return 12; } : (this: void) => number
-> : ^ ^^ ^^^^^^^^^^^
+>function () { return 12; } : () => number
+> : ^^^^^^^^^^^^
>12 : 12
> : ^^
@@ -736,8 +736,8 @@ let anyToSpecified: (this: { y: number }, x: number) => number = function(x: num
> : ^^^^^^
>x : number
> : ^^^^^^
->function(x: number): number { return x + 12; } : (this: { y: number; }, x: number) => number
-> : ^ ^^ ^^ ^^ ^^^^^
+>function(x: number): number { return x + 12; } : (x: number) => number
+> : ^ ^^ ^^^^^
>x : number
> : ^^^^^^
>x + 12 : number
diff --git a/tests/baselines/reference/thislessFunctionsNotContextSensitive1.errors.txt b/tests/baselines/reference/thislessFunctionsNotContextSensitive1.errors.txt
new file mode 100644
index 0000000000000..f3ad16d09ea13
--- /dev/null
+++ b/tests/baselines/reference/thislessFunctionsNotContextSensitive1.errors.txt
@@ -0,0 +1,252 @@
+thislessFunctionsNotContextSensitive1.ts(25,3): error TS2345: Argument of type 'false' is not assignable to parameter of type 'true'.
+thislessFunctionsNotContextSensitive1.ts(143,13): error TS2345: Argument of type '"value"' is not assignable to parameter of type 'never'.
+thislessFunctionsNotContextSensitive1.ts(176,3): error TS2820: Type '"$test6"' is not assignable to type 'ExtractFields<{ target: "$test6"; data1: { $test1: number; $test2: null; }; data2: { $test3: {}; $test4: () => void; $test5(): void; }; }> | undefined'. Did you mean '"$test4"'?
+
+
+==== thislessFunctionsNotContextSensitive1.ts (3 errors) ====
+ // https://github.com/microsoft/TypeScript/issues/62204
+
+ declare function TestConfig(
+ config: TConfig,
+ test: keyof Omit extends never ? true : false,
+ ): void;
+
+ TestConfig(
+ {
+ a: "hello",
+ b: function () {
+ return 123;
+ },
+ },
+ true,
+ );
+
+ TestConfig(
+ {
+ a: "hello",
+ b: function () {
+ return 123;
+ },
+ },
+ false, // error
+ ~~~~~
+!!! error TS2345: Argument of type 'false' is not assignable to parameter of type 'true'.
+ );
+
+ // https://github.com/microsoft/TypeScript/issues/60986
+ interface SubscribeFieldOptions {
+ subscribe: () => Event;
+ resolve: (event: Event) => number;
+ }
+
+ declare function defineOptions(
+ options: SubscribeFieldOptions,
+ ): void;
+
+ defineOptions({
+ resolve: (event) => event, // number
+ subscribe() {
+ return 123;
+ },
+ });
+
+ defineOptions({
+ resolve: (event) => event, // number
+ subscribe: function () {
+ return 123;
+ },
+ });
+
+ // https://github.com/microsoft/TypeScript/issues/58630
+
+ export type StateFunction = (s: State, ...args: any[]) => any;
+
+ export type VuexStoreOptions = {
+ state?: State | (() => State) | { (): State };
+ mutations?: Record>;
+ modules?: {
+ [k in keyof Modules]: VuexStoreOptions;
+ };
+ };
+
+ export function createStore<
+ State extends Record,
+ Modules extends Record>,
+ >(options: VuexStoreOptions) {}
+
+ const store = createStore({
+ state() {
+ return { bar2: 1 };
+ },
+ mutations: { inc: (state123) => state123.bar2++ },
+ modules: {
+ foo: {
+ state() {
+ return { bar2: 1 };
+ },
+ mutations: { inc: (state) => state.bar2++ },
+ },
+ },
+ });
+
+ // https://github.com/microsoft/TypeScript/issues/57572
+
+ type C = void>(options: {
+ methods: Methods;
+ attached: Attached;
+ }) => any;
+
+ var Component: C = () => {};
+
+ Component({
+ attached(methods) {
+ methods.bbb(); // ok
+ },
+ methods: {
+ bbb() {},
+ },
+ });
+
+ Component({
+ attached(methods) {
+ methods.bbb(); // ok
+ },
+ methods: {
+ bbb: () => {},
+ },
+ });
+
+ // https://github.com/microsoft/TypeScript/issues/56067
+
+ declare function create56067<
+ State extends Record,
+ Data extends Record,
+ Actions extends (state: State, data: Data) => Record,
+ >(args: { getState: () => State; actions: Actions; getData: () => Data }): void;
+
+ create56067({
+ getState() {
+ return { a: 1 };
+ },
+ getData: () => {
+ return { b: 2 };
+ },
+ actions(state, data) {
+ state // { a: number }
+ data; // { b: number }
+ return {
+ z: 1,
+ };
+ },
+ });
+
+ // https://github.com/microsoft/TypeScript/issues/55489
+ type NonStringIterable =
+ T extends string ? never : T extends Iterable ? T : never;
+
+ declare function doSomething(value: NonStringIterable): T;
+
+ const o = { foo() {} };
+
+ doSomething('value'); // error
+ ~~~~~~~
+!!! error TS2345: Argument of type '"value"' is not assignable to parameter of type 'never'.
+ doSomething(['v']); // ok
+ doSomething([o]); // ok
+ doSomething([{ foo() {} }]); // ok
+
+ // https://github.com/microsoft/TypeScript/issues/55124
+ type Values = T[keyof T];
+ type ExtractFields = Values<{
+ [K in keyof Options]: Options[K] extends object ? keyof Options[K] : never;
+ }>;
+ type SetType = {
+ [key: string]: any;
+ target?: ExtractFields;
+ };
+
+ declare function test55124>(
+ options: OptionsData,
+ ): void;
+
+ test55124({
+ target: "$test4", // ok
+ data1: {
+ $test1: 111,
+ $test2: null,
+ },
+ data2: {
+ $test3: {},
+ $test4: () => {},
+ $test5() {},
+ },
+ });
+
+ test55124({
+ target: "$test6", // error
+ ~~~~~~
+!!! error TS2820: Type '"$test6"' is not assignable to type 'ExtractFields<{ target: "$test6"; data1: { $test1: number; $test2: null; }; data2: { $test3: {}; $test4: () => void; $test5(): void; }; }> | undefined'. Did you mean '"$test4"'?
+!!! related TS6500 thislessFunctionsNotContextSensitive1.ts:155:3: The expected type comes from property 'target' which is declared here on type 'SetType<{ target: "$test6"; data1: { $test1: number; $test2: null; }; data2: { $test3: {}; $test4: () => void; $test5(): void; }; }>'
+ data1: {
+ $test1: 111,
+ $test2: null,
+ },
+ data2: {
+ $test3: {},
+ $test4: () => {},
+ $test5() {},
+ },
+ });
+
+ // https://github.com/microsoft/TypeScript/issues/53924
+ function test53924(options: { a: (c: T) => void; b: () => T }) {}
+
+ test53924({
+ a: (c) => {
+ c; // number;
+ },
+ b: () => 123,
+ });
+
+ test53924({
+ b: () => 123,
+ a: (c) => {
+ return c; // number
+ },
+ });
+
+ test53924({
+ b() {
+ return 123;
+ },
+ a(c) {
+ return c; // number
+ },
+ });
+
+ test53924({
+ a(c) {
+ return c; // number
+ },
+ b() {
+ return 123;
+ },
+ });
+
+ // https://github.com/microsoft/TypeScript/issues/50258
+ declare function monitor any>(
+ extractor: (...args: Parameters) => Record,
+ executor: T,
+ ): (...args: Parameters) => ReturnType;
+
+ monitor(
+ (p) => ({ p }), // { p: number }
+ (p: number) => p,
+ );
+ monitor(
+ (p) => ({ p }), // { p: number }
+ function (p: number) {
+ return p;
+ },
+ );
+
\ No newline at end of file
diff --git a/tests/baselines/reference/thislessFunctionsNotContextSensitive1.symbols b/tests/baselines/reference/thislessFunctionsNotContextSensitive1.symbols
new file mode 100644
index 0000000000000..133cc720cbab1
--- /dev/null
+++ b/tests/baselines/reference/thislessFunctionsNotContextSensitive1.symbols
@@ -0,0 +1,621 @@
+//// [tests/cases/compiler/thislessFunctionsNotContextSensitive1.ts] ////
+
+=== thislessFunctionsNotContextSensitive1.ts ===
+// https://github.com/microsoft/TypeScript/issues/62204
+
+declare function TestConfig(
+>TestConfig : Symbol(TestConfig, Decl(thislessFunctionsNotContextSensitive1.ts, 0, 0))
+>TConfig : Symbol(TConfig, Decl(thislessFunctionsNotContextSensitive1.ts, 2, 28))
+>a : Symbol(a, Decl(thislessFunctionsNotContextSensitive1.ts, 2, 51))
+>b : Symbol(b, Decl(thislessFunctionsNotContextSensitive1.ts, 2, 60))
+>c : Symbol(c, Decl(thislessFunctionsNotContextSensitive1.ts, 2, 69))
+
+ config: TConfig,
+>config : Symbol(config, Decl(thislessFunctionsNotContextSensitive1.ts, 2, 81))
+>TConfig : Symbol(TConfig, Decl(thislessFunctionsNotContextSensitive1.ts, 2, 28))
+
+ test: keyof Omit extends never ? true : false,
+>test : Symbol(test, Decl(thislessFunctionsNotContextSensitive1.ts, 3, 18))
+>Omit : Symbol(Omit, Decl(lib.es5.d.ts, --, --))
+>TConfig : Symbol(TConfig, Decl(thislessFunctionsNotContextSensitive1.ts, 2, 28))
+
+): void;
+
+TestConfig(
+>TestConfig : Symbol(TestConfig, Decl(thislessFunctionsNotContextSensitive1.ts, 0, 0))
+ {
+ a: "hello",
+>a : Symbol(a, Decl(thislessFunctionsNotContextSensitive1.ts, 8, 3))
+
+ b: function () {
+>b : Symbol(b, Decl(thislessFunctionsNotContextSensitive1.ts, 9, 15))
+
+ return 123;
+ },
+ },
+ true,
+);
+
+TestConfig(
+>TestConfig : Symbol(TestConfig, Decl(thislessFunctionsNotContextSensitive1.ts, 0, 0))
+ {
+ a: "hello",
+>a : Symbol(a, Decl(thislessFunctionsNotContextSensitive1.ts, 18, 3))
+
+ b: function () {
+>b : Symbol(b, Decl(thislessFunctionsNotContextSensitive1.ts, 19, 15))
+
+ return 123;
+ },
+ },
+ false, // error
+);
+
+// https://github.com/microsoft/TypeScript/issues/60986
+interface SubscribeFieldOptions {
+>SubscribeFieldOptions : Symbol(SubscribeFieldOptions, Decl(thislessFunctionsNotContextSensitive1.ts, 25, 2))
+>Event : Symbol(Event, Decl(thislessFunctionsNotContextSensitive1.ts, 28, 32))
+
+ subscribe: () => Event;
+>subscribe : Symbol(SubscribeFieldOptions.subscribe, Decl(thislessFunctionsNotContextSensitive1.ts, 28, 40))
+>Event : Symbol(Event, Decl(thislessFunctionsNotContextSensitive1.ts, 28, 32))
+
+ resolve: (event: Event) => number;
+>resolve : Symbol(SubscribeFieldOptions.resolve, Decl(thislessFunctionsNotContextSensitive1.ts, 29, 25))
+>event : Symbol(event, Decl(thislessFunctionsNotContextSensitive1.ts, 30, 12))
+>Event : Symbol(Event, Decl(thislessFunctionsNotContextSensitive1.ts, 28, 32))
+}
+
+declare function defineOptions(
+>defineOptions : Symbol(defineOptions, Decl(thislessFunctionsNotContextSensitive1.ts, 31, 1))
+>Event : Symbol(Event, Decl(thislessFunctionsNotContextSensitive1.ts, 33, 31))
+
+ options: SubscribeFieldOptions,
+>options : Symbol(options, Decl(thislessFunctionsNotContextSensitive1.ts, 33, 38))
+>SubscribeFieldOptions : Symbol(SubscribeFieldOptions, Decl(thislessFunctionsNotContextSensitive1.ts, 25, 2))
+>Event : Symbol(Event, Decl(thislessFunctionsNotContextSensitive1.ts, 33, 31))
+
+): void;
+
+defineOptions({
+>defineOptions : Symbol(defineOptions, Decl(thislessFunctionsNotContextSensitive1.ts, 31, 1))
+
+ resolve: (event) => event, // number
+>resolve : Symbol(resolve, Decl(thislessFunctionsNotContextSensitive1.ts, 37, 15))
+>event : Symbol(event, Decl(thislessFunctionsNotContextSensitive1.ts, 38, 12))
+>event : Symbol(event, Decl(thislessFunctionsNotContextSensitive1.ts, 38, 12))
+
+ subscribe() {
+>subscribe : Symbol(subscribe, Decl(thislessFunctionsNotContextSensitive1.ts, 38, 28))
+
+ return 123;
+ },
+});
+
+defineOptions({
+>defineOptions : Symbol(defineOptions, Decl(thislessFunctionsNotContextSensitive1.ts, 31, 1))
+
+ resolve: (event) => event, // number
+>resolve : Symbol(resolve, Decl(thislessFunctionsNotContextSensitive1.ts, 44, 15))
+>event : Symbol(event, Decl(thislessFunctionsNotContextSensitive1.ts, 45, 12))
+>event : Symbol(event, Decl(thislessFunctionsNotContextSensitive1.ts, 45, 12))
+
+ subscribe: function () {
+>subscribe : Symbol(subscribe, Decl(thislessFunctionsNotContextSensitive1.ts, 45, 28))
+
+ return 123;
+ },
+});
+
+// https://github.com/microsoft/TypeScript/issues/58630
+
+export type StateFunction = (s: State, ...args: any[]) => any;
+>StateFunction : Symbol(StateFunction, Decl(thislessFunctionsNotContextSensitive1.ts, 49, 3))
+>State : Symbol(State, Decl(thislessFunctionsNotContextSensitive1.ts, 53, 26))
+>s : Symbol(s, Decl(thislessFunctionsNotContextSensitive1.ts, 53, 36))
+>State : Symbol(State, Decl(thislessFunctionsNotContextSensitive1.ts, 53, 26))
+>args : Symbol(args, Decl(thislessFunctionsNotContextSensitive1.ts, 53, 45))
+
+export type VuexStoreOptions = {
+>VuexStoreOptions : Symbol(VuexStoreOptions, Decl(thislessFunctionsNotContextSensitive1.ts, 53, 69))
+>State : Symbol(State, Decl(thislessFunctionsNotContextSensitive1.ts, 55, 29))
+>Modules : Symbol(Modules, Decl(thislessFunctionsNotContextSensitive1.ts, 55, 35))
+
+ state?: State | (() => State) | { (): State };
+>state : Symbol(state, Decl(thislessFunctionsNotContextSensitive1.ts, 55, 48))
+>State : Symbol(State, Decl(thislessFunctionsNotContextSensitive1.ts, 55, 29))
+>State : Symbol(State, Decl(thislessFunctionsNotContextSensitive1.ts, 55, 29))
+>State : Symbol(State, Decl(thislessFunctionsNotContextSensitive1.ts, 55, 29))
+
+ mutations?: Record>;
+>mutations : Symbol(mutations, Decl(thislessFunctionsNotContextSensitive1.ts, 56, 48))
+>Record : Symbol(Record, Decl(lib.es5.d.ts, --, --))
+>StateFunction : Symbol(StateFunction, Decl(thislessFunctionsNotContextSensitive1.ts, 49, 3))
+>State : Symbol(State, Decl(thislessFunctionsNotContextSensitive1.ts, 55, 29))
+
+ modules?: {
+>modules : Symbol(modules, Decl(thislessFunctionsNotContextSensitive1.ts, 57, 51))
+
+ [k in keyof Modules]: VuexStoreOptions;
+>k : Symbol(k, Decl(thislessFunctionsNotContextSensitive1.ts, 59, 5))
+>Modules : Symbol(Modules, Decl(thislessFunctionsNotContextSensitive1.ts, 55, 35))
+>VuexStoreOptions : Symbol(VuexStoreOptions, Decl(thislessFunctionsNotContextSensitive1.ts, 53, 69))
+>Modules : Symbol(Modules, Decl(thislessFunctionsNotContextSensitive1.ts, 55, 35))
+>k : Symbol(k, Decl(thislessFunctionsNotContextSensitive1.ts, 59, 5))
+
+ };
+};
+
+export function createStore<
+>createStore : Symbol(createStore, Decl(thislessFunctionsNotContextSensitive1.ts, 61, 2))
+
+ State extends Record,
+>State : Symbol(State, Decl(thislessFunctionsNotContextSensitive1.ts, 63, 28))
+>Record : Symbol(Record, Decl(lib.es5.d.ts, --, --))
+
+ Modules extends Record>,
+>Modules : Symbol(Modules, Decl(thislessFunctionsNotContextSensitive1.ts, 64, 40))
+>Record : Symbol(Record, Decl(lib.es5.d.ts, --, --))
+>Record : Symbol(Record, Decl(lib.es5.d.ts, --, --))
+
+>(options: VuexStoreOptions) {}
+>options : Symbol(options, Decl(thislessFunctionsNotContextSensitive1.ts, 66, 2))
+>VuexStoreOptions : Symbol(VuexStoreOptions, Decl(thislessFunctionsNotContextSensitive1.ts, 53, 69))
+>State : Symbol(State, Decl(thislessFunctionsNotContextSensitive1.ts, 63, 28))
+>Modules : Symbol(Modules, Decl(thislessFunctionsNotContextSensitive1.ts, 64, 40))
+
+const store = createStore({
+>store : Symbol(store, Decl(thislessFunctionsNotContextSensitive1.ts, 68, 5))
+>createStore : Symbol(createStore, Decl(thislessFunctionsNotContextSensitive1.ts, 61, 2))
+
+ state() {
+>state : Symbol(state, Decl(thislessFunctionsNotContextSensitive1.ts, 68, 27))
+
+ return { bar2: 1 };
+>bar2 : Symbol(bar2, Decl(thislessFunctionsNotContextSensitive1.ts, 70, 12))
+
+ },
+ mutations: { inc: (state123) => state123.bar2++ },
+>mutations : Symbol(mutations, Decl(thislessFunctionsNotContextSensitive1.ts, 71, 4))
+>inc : Symbol(inc, Decl(thislessFunctionsNotContextSensitive1.ts, 72, 14))
+>state123 : Symbol(state123, Decl(thislessFunctionsNotContextSensitive1.ts, 72, 21))
+>state123.bar2 : Symbol(bar2, Decl(thislessFunctionsNotContextSensitive1.ts, 70, 12))
+>state123 : Symbol(state123, Decl(thislessFunctionsNotContextSensitive1.ts, 72, 21))
+>bar2 : Symbol(bar2, Decl(thislessFunctionsNotContextSensitive1.ts, 70, 12))
+
+ modules: {
+>modules : Symbol(modules, Decl(thislessFunctionsNotContextSensitive1.ts, 72, 52))
+
+ foo: {
+>foo : Symbol(foo, Decl(thislessFunctionsNotContextSensitive1.ts, 73, 12))
+
+ state() {
+>state : Symbol(state, Decl(thislessFunctionsNotContextSensitive1.ts, 74, 10))
+
+ return { bar2: 1 };
+>bar2 : Symbol(bar2, Decl(thislessFunctionsNotContextSensitive1.ts, 76, 16))
+
+ },
+ mutations: { inc: (state) => state.bar2++ },
+>mutations : Symbol(mutations, Decl(thislessFunctionsNotContextSensitive1.ts, 77, 8))
+>inc : Symbol(inc, Decl(thislessFunctionsNotContextSensitive1.ts, 78, 18))
+>state : Symbol(state, Decl(thislessFunctionsNotContextSensitive1.ts, 78, 25))
+>state.bar2 : Symbol(bar2, Decl(thislessFunctionsNotContextSensitive1.ts, 76, 16))
+>state : Symbol(state, Decl(thislessFunctionsNotContextSensitive1.ts, 78, 25))
+>bar2 : Symbol(bar2, Decl(thislessFunctionsNotContextSensitive1.ts, 76, 16))
+
+ },
+ },
+});
+
+// https://github.com/microsoft/TypeScript/issues/57572
+
+type C = void>(options: {
+>C : Symbol(C, Decl(thislessFunctionsNotContextSensitive1.ts, 81, 3))
+>Methods : Symbol(Methods, Decl(thislessFunctionsNotContextSensitive1.ts, 85, 10))
+>Attached : Symbol(Attached, Decl(thislessFunctionsNotContextSensitive1.ts, 85, 18))
+>methods : Symbol(methods, Decl(thislessFunctionsNotContextSensitive1.ts, 85, 31))
+>Methods : Symbol(Methods, Decl(thislessFunctionsNotContextSensitive1.ts, 85, 10))
+>options : Symbol(options, Decl(thislessFunctionsNotContextSensitive1.ts, 85, 58))
+
+ methods: Methods;
+>methods : Symbol(methods, Decl(thislessFunctionsNotContextSensitive1.ts, 85, 68))
+>Methods : Symbol(Methods, Decl(thislessFunctionsNotContextSensitive1.ts, 85, 10))
+
+ attached: Attached;
+>attached : Symbol(attached, Decl(thislessFunctionsNotContextSensitive1.ts, 86, 19))
+>Attached : Symbol(Attached, Decl(thislessFunctionsNotContextSensitive1.ts, 85, 18))
+
+}) => any;
+
+var Component: C = () => {};
+>Component : Symbol(Component, Decl(thislessFunctionsNotContextSensitive1.ts, 90, 3))
+>C : Symbol(C, Decl(thislessFunctionsNotContextSensitive1.ts, 81, 3))
+
+Component({
+>Component : Symbol(Component, Decl(thislessFunctionsNotContextSensitive1.ts, 90, 3))
+
+ attached(methods) {
+>attached : Symbol(attached, Decl(thislessFunctionsNotContextSensitive1.ts, 92, 11))
+>methods : Symbol(methods, Decl(thislessFunctionsNotContextSensitive1.ts, 93, 11))
+
+ methods.bbb(); // ok
+>methods.bbb : Symbol(bbb, Decl(thislessFunctionsNotContextSensitive1.ts, 96, 12))
+>methods : Symbol(methods, Decl(thislessFunctionsNotContextSensitive1.ts, 93, 11))
+>bbb : Symbol(bbb, Decl(thislessFunctionsNotContextSensitive1.ts, 96, 12))
+
+ },
+ methods: {
+>methods : Symbol(methods, Decl(thislessFunctionsNotContextSensitive1.ts, 95, 4))
+
+ bbb() {},
+>bbb : Symbol(bbb, Decl(thislessFunctionsNotContextSensitive1.ts, 96, 12))
+
+ },
+});
+
+Component({
+>Component : Symbol(Component, Decl(thislessFunctionsNotContextSensitive1.ts, 90, 3))
+
+ attached(methods) {
+>attached : Symbol(attached, Decl(thislessFunctionsNotContextSensitive1.ts, 101, 11))
+>methods : Symbol(methods, Decl(thislessFunctionsNotContextSensitive1.ts, 102, 11))
+
+ methods.bbb(); // ok
+>methods.bbb : Symbol(bbb, Decl(thislessFunctionsNotContextSensitive1.ts, 105, 12))
+>methods : Symbol(methods, Decl(thislessFunctionsNotContextSensitive1.ts, 102, 11))
+>bbb : Symbol(bbb, Decl(thislessFunctionsNotContextSensitive1.ts, 105, 12))
+
+ },
+ methods: {
+>methods : Symbol(methods, Decl(thislessFunctionsNotContextSensitive1.ts, 104, 4))
+
+ bbb: () => {},
+>bbb : Symbol(bbb, Decl(thislessFunctionsNotContextSensitive1.ts, 105, 12))
+
+ },
+});
+
+// https://github.com/microsoft/TypeScript/issues/56067
+
+declare function create56067<
+>create56067 : Symbol(create56067, Decl(thislessFunctionsNotContextSensitive1.ts, 108, 3))
+
+ State extends Record,
+>State : Symbol(State, Decl(thislessFunctionsNotContextSensitive1.ts, 112, 29))
+>Record : Symbol(Record, Decl(lib.es5.d.ts, --, --))
+
+ Data extends Record,
+>Data : Symbol(Data, Decl(thislessFunctionsNotContextSensitive1.ts, 113, 36))
+>Record : Symbol(Record, Decl(lib.es5.d.ts, --, --))
+
+ Actions extends (state: State, data: Data) => Record,
+>Actions : Symbol(Actions, Decl(thislessFunctionsNotContextSensitive1.ts, 114, 35))
+>state : Symbol(state, Decl(thislessFunctionsNotContextSensitive1.ts, 115, 19))
+>State : Symbol(State, Decl(thislessFunctionsNotContextSensitive1.ts, 112, 29))
+>data : Symbol(data, Decl(thislessFunctionsNotContextSensitive1.ts, 115, 32))
+>Data : Symbol(Data, Decl(thislessFunctionsNotContextSensitive1.ts, 113, 36))
+>Record : Symbol(Record, Decl(lib.es5.d.ts, --, --))
+
+>(args: { getState: () => State; actions: Actions; getData: () => Data }): void;
+>args : Symbol(args, Decl(thislessFunctionsNotContextSensitive1.ts, 116, 2))
+>getState : Symbol(getState, Decl(thislessFunctionsNotContextSensitive1.ts, 116, 9))
+>State : Symbol(State, Decl(thislessFunctionsNotContextSensitive1.ts, 112, 29))
+>actions : Symbol(actions, Decl(thislessFunctionsNotContextSensitive1.ts, 116, 32))
+>Actions : Symbol(Actions, Decl(thislessFunctionsNotContextSensitive1.ts, 114, 35))
+>getData : Symbol(getData, Decl(thislessFunctionsNotContextSensitive1.ts, 116, 50))
+>Data : Symbol(Data, Decl(thislessFunctionsNotContextSensitive1.ts, 113, 36))
+
+create56067({
+>create56067 : Symbol(create56067, Decl(thislessFunctionsNotContextSensitive1.ts, 108, 3))
+
+ getState() {
+>getState : Symbol(getState, Decl(thislessFunctionsNotContextSensitive1.ts, 118, 13))
+
+ return { a: 1 };
+>a : Symbol(a, Decl(thislessFunctionsNotContextSensitive1.ts, 120, 12))
+
+ },
+ getData: () => {
+>getData : Symbol(getData, Decl(thislessFunctionsNotContextSensitive1.ts, 121, 4))
+
+ return { b: 2 };
+>b : Symbol(b, Decl(thislessFunctionsNotContextSensitive1.ts, 123, 12))
+
+ },
+ actions(state, data) {
+>actions : Symbol(actions, Decl(thislessFunctionsNotContextSensitive1.ts, 124, 4))
+>state : Symbol(state, Decl(thislessFunctionsNotContextSensitive1.ts, 125, 10))
+>data : Symbol(data, Decl(thislessFunctionsNotContextSensitive1.ts, 125, 16))
+
+ state // { a: number }
+>state : Symbol(state, Decl(thislessFunctionsNotContextSensitive1.ts, 125, 10))
+
+ data; // { b: number }
+>data : Symbol(data, Decl(thislessFunctionsNotContextSensitive1.ts, 125, 16))
+
+ return {
+ z: 1,
+>z : Symbol(z, Decl(thislessFunctionsNotContextSensitive1.ts, 128, 12))
+
+ };
+ },
+});
+
+// https://github.com/microsoft/TypeScript/issues/55489
+type NonStringIterable =
+>NonStringIterable : Symbol(NonStringIterable, Decl(thislessFunctionsNotContextSensitive1.ts, 132, 3))
+>T : Symbol(T, Decl(thislessFunctionsNotContextSensitive1.ts, 135, 23))
+
+ T extends string ? never : T extends Iterable ? T : never;
+>T : Symbol(T, Decl(thislessFunctionsNotContextSensitive1.ts, 135, 23))
+>T : Symbol(T, Decl(thislessFunctionsNotContextSensitive1.ts, 135, 23))
+>Iterable : Symbol(Iterable, Decl(lib.es2015.iterable.d.ts, --, --))
+>T : Symbol(T, Decl(thislessFunctionsNotContextSensitive1.ts, 135, 23))
+
+declare function doSomething(value: NonStringIterable): T;
+>doSomething : Symbol(doSomething, Decl(thislessFunctionsNotContextSensitive1.ts, 136, 65))
+>T : Symbol(T, Decl(thislessFunctionsNotContextSensitive1.ts, 138, 29))
+>value : Symbol(value, Decl(thislessFunctionsNotContextSensitive1.ts, 138, 32))
+>NonStringIterable : Symbol(NonStringIterable, Decl(thislessFunctionsNotContextSensitive1.ts, 132, 3))
+>T : Symbol(T, Decl(thislessFunctionsNotContextSensitive1.ts, 138, 29))
+>T : Symbol(T, Decl(thislessFunctionsNotContextSensitive1.ts, 138, 29))
+
+const o = { foo() {} };
+>o : Symbol(o, Decl(thislessFunctionsNotContextSensitive1.ts, 140, 5))
+>foo : Symbol(foo, Decl(thislessFunctionsNotContextSensitive1.ts, 140, 11))
+
+doSomething('value'); // error
+>doSomething : Symbol(doSomething, Decl(thislessFunctionsNotContextSensitive1.ts, 136, 65))
+
+doSomething(['v']); // ok
+>doSomething : Symbol(doSomething, Decl(thislessFunctionsNotContextSensitive1.ts, 136, 65))
+
+doSomething([o]); // ok
+>doSomething : Symbol(doSomething, Decl(thislessFunctionsNotContextSensitive1.ts, 136, 65))
+>o : Symbol(o, Decl(thislessFunctionsNotContextSensitive1.ts, 140, 5))
+
+doSomething([{ foo() {} }]); // ok
+>doSomething : Symbol(doSomething, Decl(thislessFunctionsNotContextSensitive1.ts, 136, 65))
+>foo : Symbol(foo, Decl(thislessFunctionsNotContextSensitive1.ts, 145, 14))
+
+// https://github.com/microsoft/TypeScript/issues/55124
+type Values = T[keyof T];
+>Values : Symbol(Values, Decl(thislessFunctionsNotContextSensitive1.ts, 145, 28))
+>T : Symbol(T, Decl(thislessFunctionsNotContextSensitive1.ts, 148, 12))
+>T : Symbol(T, Decl(thislessFunctionsNotContextSensitive1.ts, 148, 12))
+>T : Symbol(T, Decl(thislessFunctionsNotContextSensitive1.ts, 148, 12))
+
+type ExtractFields = Values<{
+>ExtractFields : Symbol(ExtractFields, Decl(thislessFunctionsNotContextSensitive1.ts, 148, 28))
+>Options : Symbol(Options, Decl(thislessFunctionsNotContextSensitive1.ts, 149, 19))
+>Values : Symbol(Values, Decl(thislessFunctionsNotContextSensitive1.ts, 145, 28))
+
+ [K in keyof Options]: Options[K] extends object ? keyof Options[K] : never;
+>K : Symbol(K, Decl(thislessFunctionsNotContextSensitive1.ts, 150, 3))
+>Options : Symbol(Options, Decl(thislessFunctionsNotContextSensitive1.ts, 149, 19))
+>Options : Symbol(Options, Decl(thislessFunctionsNotContextSensitive1.ts, 149, 19))
+>K : Symbol(K, Decl(thislessFunctionsNotContextSensitive1.ts, 150, 3))
+>Options : Symbol(Options, Decl(thislessFunctionsNotContextSensitive1.ts, 149, 19))
+>K : Symbol(K, Decl(thislessFunctionsNotContextSensitive1.ts, 150, 3))
+
+}>;
+type SetType = {
+>SetType : Symbol(SetType, Decl(thislessFunctionsNotContextSensitive1.ts, 151, 3))
+>Options : Symbol(Options, Decl(thislessFunctionsNotContextSensitive1.ts, 152, 13))
+
+ [key: string]: any;
+>key : Symbol(key, Decl(thislessFunctionsNotContextSensitive1.ts, 153, 3))
+
+ target?: ExtractFields;
+>target : Symbol(target, Decl(thislessFunctionsNotContextSensitive1.ts, 153, 21))
+>ExtractFields : Symbol(ExtractFields, Decl(thislessFunctionsNotContextSensitive1.ts, 148, 28))
+>Options : Symbol(Options, Decl(thislessFunctionsNotContextSensitive1.ts, 152, 13))
+
+};
+
+declare function test55124>(
+>test55124 : Symbol(test55124, Decl(thislessFunctionsNotContextSensitive1.ts, 155, 2))
+>OptionsData : Symbol(OptionsData, Decl(thislessFunctionsNotContextSensitive1.ts, 157, 27))
+>SetType : Symbol(SetType, Decl(thislessFunctionsNotContextSensitive1.ts, 151, 3))
+>OptionsData : Symbol(OptionsData, Decl(thislessFunctionsNotContextSensitive1.ts, 157, 27))
+
+ options: OptionsData,
+>options : Symbol(options, Decl(thislessFunctionsNotContextSensitive1.ts, 157, 69))
+>OptionsData : Symbol(OptionsData, Decl(thislessFunctionsNotContextSensitive1.ts, 157, 27))
+
+): void;
+
+test55124({
+>test55124 : Symbol(test55124, Decl(thislessFunctionsNotContextSensitive1.ts, 155, 2))
+
+ target: "$test4", // ok
+>target : Symbol(target, Decl(thislessFunctionsNotContextSensitive1.ts, 161, 11))
+
+ data1: {
+>data1 : Symbol(data1, Decl(thislessFunctionsNotContextSensitive1.ts, 162, 19))
+
+ $test1: 111,
+>$test1 : Symbol($test1, Decl(thislessFunctionsNotContextSensitive1.ts, 163, 10))
+
+ $test2: null,
+>$test2 : Symbol($test2, Decl(thislessFunctionsNotContextSensitive1.ts, 164, 16))
+
+ },
+ data2: {
+>data2 : Symbol(data2, Decl(thislessFunctionsNotContextSensitive1.ts, 166, 4))
+
+ $test3: {},
+>$test3 : Symbol($test3, Decl(thislessFunctionsNotContextSensitive1.ts, 167, 10))
+
+ $test4: () => {},
+>$test4 : Symbol($test4, Decl(thislessFunctionsNotContextSensitive1.ts, 168, 15))
+
+ $test5() {},
+>$test5 : Symbol($test5, Decl(thislessFunctionsNotContextSensitive1.ts, 169, 21))
+
+ },
+});
+
+test55124({
+>test55124 : Symbol(test55124, Decl(thislessFunctionsNotContextSensitive1.ts, 155, 2))
+
+ target: "$test6", // error
+>target : Symbol(target, Decl(thislessFunctionsNotContextSensitive1.ts, 174, 11))
+
+ data1: {
+>data1 : Symbol(data1, Decl(thislessFunctionsNotContextSensitive1.ts, 175, 19))
+
+ $test1: 111,
+>$test1 : Symbol($test1, Decl(thislessFunctionsNotContextSensitive1.ts, 176, 10))
+
+ $test2: null,
+>$test2 : Symbol($test2, Decl(thislessFunctionsNotContextSensitive1.ts, 177, 16))
+
+ },
+ data2: {
+>data2 : Symbol(data2, Decl(thislessFunctionsNotContextSensitive1.ts, 179, 4))
+
+ $test3: {},
+>$test3 : Symbol($test3, Decl(thislessFunctionsNotContextSensitive1.ts, 180, 10))
+
+ $test4: () => {},
+>$test4 : Symbol($test4, Decl(thislessFunctionsNotContextSensitive1.ts, 181, 15))
+
+ $test5() {},
+>$test5 : Symbol($test5, Decl(thislessFunctionsNotContextSensitive1.ts, 182, 21))
+
+ },
+});
+
+// https://github.com/microsoft/TypeScript/issues/53924
+function test53924(options: { a: (c: T) => void; b: () => T }) {}
+>test53924 : Symbol(test53924, Decl(thislessFunctionsNotContextSensitive1.ts, 185, 3))
+>T : Symbol(T, Decl(thislessFunctionsNotContextSensitive1.ts, 188, 19))
+>options : Symbol(options, Decl(thislessFunctionsNotContextSensitive1.ts, 188, 32))
+>a : Symbol(a, Decl(thislessFunctionsNotContextSensitive1.ts, 188, 42))
+>c : Symbol(c, Decl(thislessFunctionsNotContextSensitive1.ts, 188, 47))
+>T : Symbol(T, Decl(thislessFunctionsNotContextSensitive1.ts, 188, 19))
+>b : Symbol(b, Decl(thislessFunctionsNotContextSensitive1.ts, 188, 61))
+>T : Symbol(T, Decl(thislessFunctionsNotContextSensitive1.ts, 188, 19))
+
+test53924({
+>test53924 : Symbol(test53924, Decl(thislessFunctionsNotContextSensitive1.ts, 185, 3))
+
+ a: (c) => {
+>a : Symbol(a, Decl(thislessFunctionsNotContextSensitive1.ts, 190, 11))
+>c : Symbol(c, Decl(thislessFunctionsNotContextSensitive1.ts, 191, 6))
+
+ c; // number;
+>c : Symbol(c, Decl(thislessFunctionsNotContextSensitive1.ts, 191, 6))
+
+ },
+ b: () => 123,
+>b : Symbol(b, Decl(thislessFunctionsNotContextSensitive1.ts, 193, 4))
+
+});
+
+test53924({
+>test53924 : Symbol(test53924, Decl(thislessFunctionsNotContextSensitive1.ts, 185, 3))
+
+ b: () => 123,
+>b : Symbol(b, Decl(thislessFunctionsNotContextSensitive1.ts, 197, 11))
+
+ a: (c) => {
+>a : Symbol(a, Decl(thislessFunctionsNotContextSensitive1.ts, 198, 15))
+>c : Symbol(c, Decl(thislessFunctionsNotContextSensitive1.ts, 199, 6))
+
+ return c; // number
+>c : Symbol(c, Decl(thislessFunctionsNotContextSensitive1.ts, 199, 6))
+
+ },
+});
+
+test53924({
+>test53924 : Symbol(test53924, Decl(thislessFunctionsNotContextSensitive1.ts, 185, 3))
+
+ b() {
+>b : Symbol(b, Decl(thislessFunctionsNotContextSensitive1.ts, 204, 11))
+
+ return 123;
+ },
+ a(c) {
+>a : Symbol(a, Decl(thislessFunctionsNotContextSensitive1.ts, 207, 4))
+>c : Symbol(c, Decl(thislessFunctionsNotContextSensitive1.ts, 208, 4))
+
+ return c; // number
+>c : Symbol(c, Decl(thislessFunctionsNotContextSensitive1.ts, 208, 4))
+
+ },
+});
+
+test53924({
+>test53924 : Symbol(test53924, Decl(thislessFunctionsNotContextSensitive1.ts, 185, 3))
+
+ a(c) {
+>a : Symbol(a, Decl(thislessFunctionsNotContextSensitive1.ts, 213, 11))
+>c : Symbol(c, Decl(thislessFunctionsNotContextSensitive1.ts, 214, 4))
+
+ return c; // number
+>c : Symbol(c, Decl(thislessFunctionsNotContextSensitive1.ts, 214, 4))
+
+ },
+ b() {
+>b : Symbol(b, Decl(thislessFunctionsNotContextSensitive1.ts, 216, 4))
+
+ return 123;
+ },
+});
+
+// https://github.com/microsoft/TypeScript/issues/50258
+declare function monitor any>(
+>monitor : Symbol(monitor, Decl(thislessFunctionsNotContextSensitive1.ts, 220, 3))
+>T : Symbol(T, Decl(thislessFunctionsNotContextSensitive1.ts, 223, 25))
+>args : Symbol(args, Decl(thislessFunctionsNotContextSensitive1.ts, 223, 36))
+
+ extractor: (...args: Parameters) => Record,
+>extractor : Symbol(extractor, Decl(thislessFunctionsNotContextSensitive1.ts, 223, 58))
+>args : Symbol(args, Decl(thislessFunctionsNotContextSensitive1.ts, 224, 14))
+>Parameters : Symbol(Parameters, Decl(lib.es5.d.ts, --, --))
+>T : Symbol(T, Decl(thislessFunctionsNotContextSensitive1.ts, 223, 25))
+>Record : Symbol(Record, Decl(lib.es5.d.ts, --, --))
+
+ executor: T,
+>executor : Symbol(executor, Decl(thislessFunctionsNotContextSensitive1.ts, 224, 65))
+>T : Symbol(T, Decl(thislessFunctionsNotContextSensitive1.ts, 223, 25))
+
+): (...args: Parameters) => ReturnType;
+>args : Symbol(args, Decl(thislessFunctionsNotContextSensitive1.ts, 226, 4))
+>Parameters : Symbol(Parameters, Decl(lib.es5.d.ts, --, --))
+>T : Symbol(T, Decl(thislessFunctionsNotContextSensitive1.ts, 223, 25))
+>ReturnType : Symbol(ReturnType, Decl(lib.es5.d.ts, --, --))
+>T : Symbol(T, Decl(thislessFunctionsNotContextSensitive1.ts, 223, 25))
+
+monitor(
+>monitor : Symbol(monitor, Decl(thislessFunctionsNotContextSensitive1.ts, 220, 3))
+
+ (p) => ({ p }), // { p: number }
+>p : Symbol(p, Decl(thislessFunctionsNotContextSensitive1.ts, 229, 3))
+>p : Symbol(p, Decl(thislessFunctionsNotContextSensitive1.ts, 229, 11))
+
+ (p: number) => p,
+>p : Symbol(p, Decl(thislessFunctionsNotContextSensitive1.ts, 230, 3))
+>p : Symbol(p, Decl(thislessFunctionsNotContextSensitive1.ts, 230, 3))
+
+);
+monitor(
+>monitor : Symbol(monitor, Decl(thislessFunctionsNotContextSensitive1.ts, 220, 3))
+
+ (p) => ({ p }), // { p: number }
+>p : Symbol(p, Decl(thislessFunctionsNotContextSensitive1.ts, 233, 3))
+>p : Symbol(p, Decl(thislessFunctionsNotContextSensitive1.ts, 233, 11))
+
+ function (p: number) {
+>p : Symbol(p, Decl(thislessFunctionsNotContextSensitive1.ts, 234, 12))
+
+ return p;
+>p : Symbol(p, Decl(thislessFunctionsNotContextSensitive1.ts, 234, 12))
+
+ },
+);
+
diff --git a/tests/baselines/reference/thislessFunctionsNotContextSensitive1.types b/tests/baselines/reference/thislessFunctionsNotContextSensitive1.types
new file mode 100644
index 0000000000000..54eac35ad5070
--- /dev/null
+++ b/tests/baselines/reference/thislessFunctionsNotContextSensitive1.types
@@ -0,0 +1,926 @@
+//// [tests/cases/compiler/thislessFunctionsNotContextSensitive1.ts] ////
+
+=== thislessFunctionsNotContextSensitive1.ts ===
+// https://github.com/microsoft/TypeScript/issues/62204
+
+declare function TestConfig(
+>TestConfig : (config: TConfig, test: keyof Omit extends never ? true : false) => void
+> : ^^^^^^^ ^^^^^^^^^ ^^ ^^ ^^ ^^ ^^^^^
+>a : any
+> : ^^^
+>b : any
+> : ^^^
+>c : any
+> : ^^^
+
+ config: TConfig,
+>config : TConfig
+> : ^^^^^^^
+
+ test: keyof Omit extends never ? true : false,
+>test : Exclude extends never ? true : false
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>true : true
+> : ^^^^
+>false : false
+> : ^^^^^
+
+): void;
+
+TestConfig(
+>TestConfig( { a: "hello", b: function () { return 123; }, }, true,) : void
+> : ^^^^
+>TestConfig : (config: TConfig, test: keyof Omit extends never ? true : false) => void
+> : ^^^^^^^ ^^^^^^^^^ ^^ ^^ ^^ ^^ ^^^^^
+ {
+>{ a: "hello", b: function () { return 123; }, } : { a: "hello"; b: () => 123; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ a: "hello",
+>a : "hello"
+> : ^^^^^^^
+>"hello" : "hello"
+> : ^^^^^^^
+
+ b: function () {
+>b : () => 123
+> : ^^^^^^^^^
+>function () { return 123; } : () => 123
+> : ^^^^^^^^^
+
+ return 123;
+>123 : 123
+> : ^^^
+
+ },
+ },
+ true,
+>true : true
+> : ^^^^
+
+);
+
+TestConfig(
+>TestConfig( { a: "hello", b: function () { return 123; }, }, false, // error) : void
+> : ^^^^
+>TestConfig : (config: TConfig, test: keyof Omit extends never ? true : false) => void
+> : ^^^^^^^ ^^^^^^^^^ ^^ ^^ ^^ ^^ ^^^^^
+ {
+>{ a: "hello", b: function () { return 123; }, } : { a: "hello"; b: () => 123; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ a: "hello",
+>a : "hello"
+> : ^^^^^^^
+>"hello" : "hello"
+> : ^^^^^^^
+
+ b: function () {
+>b : () => 123
+> : ^^^^^^^^^
+>function () { return 123; } : () => 123
+> : ^^^^^^^^^
+
+ return 123;
+>123 : 123
+> : ^^^
+
+ },
+ },
+ false, // error
+>false : false
+> : ^^^^^
+
+);
+
+// https://github.com/microsoft/TypeScript/issues/60986
+interface SubscribeFieldOptions {
+ subscribe: () => Event;
+>subscribe : () => Event
+> : ^^^^^^
+
+ resolve: (event: Event) => number;
+>resolve : (event: Event) => number
+> : ^ ^^ ^^^^^
+>event : Event
+> : ^^^^^
+}
+
+declare function defineOptions(
+>defineOptions : (options: SubscribeFieldOptions) => void
+> : ^ ^^ ^^ ^^^^^
+
+ options: SubscribeFieldOptions,
+>options : SubscribeFieldOptions
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+): void;
+
+defineOptions({
+>defineOptions({ resolve: (event) => event, // number subscribe() { return 123; },}) : void
+> : ^^^^
+>defineOptions : (options: SubscribeFieldOptions) => void
+> : ^ ^^ ^^ ^^^^^
+>{ resolve: (event) => event, // number subscribe() { return 123; },} : { resolve: (event: number) => number; subscribe(): number; }
+> : ^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ resolve: (event) => event, // number
+>resolve : (event: number) => number
+> : ^ ^^^^^^^^^^^^^^^^^^^
+>(event) => event : (event: number) => number
+> : ^ ^^^^^^^^^^^^^^^^^^^
+>event : number
+> : ^^^^^^
+>event : number
+> : ^^^^^^
+
+ subscribe() {
+>subscribe : () => number
+> : ^^^^^^^^^^^^
+
+ return 123;
+>123 : 123
+> : ^^^
+
+ },
+});
+
+defineOptions({
+>defineOptions({ resolve: (event) => event, // number subscribe: function () { return 123; },}) : void
+> : ^^^^
+>defineOptions : (options: SubscribeFieldOptions) => void
+> : ^ ^^ ^^ ^^^^^
+>{ resolve: (event) => event, // number subscribe: function () { return 123; },} : { resolve: (event: number) => number; subscribe: () => number; }
+> : ^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ resolve: (event) => event, // number
+>resolve : (event: number) => number
+> : ^ ^^^^^^^^^^^^^^^^^^^
+>(event) => event : (event: number) => number
+> : ^ ^^^^^^^^^^^^^^^^^^^
+>event : number
+> : ^^^^^^
+>event : number
+> : ^^^^^^
+
+ subscribe: function () {
+>subscribe : () => number
+> : ^^^^^^^^^^^^
+>function () { return 123; } : () => number
+> : ^^^^^^^^^^^^
+
+ return 123;
+>123 : 123
+> : ^^^
+
+ },
+});
+
+// https://github.com/microsoft/TypeScript/issues/58630
+
+export type StateFunction = (s: State, ...args: any[]) => any;
+>StateFunction : StateFunction
+> : ^^^^^^^^^^^^^^^^^^^^
+>s : State
+> : ^^^^^
+>args : any[]
+> : ^^^^^
+
+export type VuexStoreOptions = {
+>VuexStoreOptions : VuexStoreOptions
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ state?: State | (() => State) | { (): State };
+>state : State | (() => State) | (() => State) | undefined
+> : ^^^^^^^^^^^^^^^ ^^^^^^^^^^^ ^^^^^^^^^^^^^
+
+ mutations?: Record>;
+>mutations : Record> | undefined
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ modules?: {
+>modules : { [k in keyof Modules]: VuexStoreOptions; } | undefined
+> : ^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ [k in keyof Modules]: VuexStoreOptions;
+ };
+};
+
+export function createStore<
+>createStore : , Modules extends Record>>(options: VuexStoreOptions) => void
+> : ^ ^^^^^^^^^ ^^ ^^^^^^^^^ ^^ ^^ ^^^^^^^^^
+
+ State extends Record,
+ Modules extends Record>,
+>(options: VuexStoreOptions) {}
+>options : VuexStoreOptions
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+const store = createStore({
+>store : void
+> : ^^^^
+>createStore({ state() { return { bar2: 1 }; }, mutations: { inc: (state123) => state123.bar2++ }, modules: { foo: { state() { return { bar2: 1 }; }, mutations: { inc: (state) => state.bar2++ }, }, },}) : void
+> : ^^^^
+>createStore : , Modules extends Record>>(options: VuexStoreOptions) => void
+> : ^ ^^^^^^^^^ ^^ ^^^^^^^^^ ^^ ^^ ^^^^^^^^^
+>{ state() { return { bar2: 1 }; }, mutations: { inc: (state123) => state123.bar2++ }, modules: { foo: { state() { return { bar2: 1 }; }, mutations: { inc: (state) => state.bar2++ }, }, },} : { state(): { bar2: number; }; mutations: { inc: (state123: { bar2: number; }) => number; }; modules: { foo: { state(): { bar2: number; }; mutations: { inc: (state: { bar2: number; }) => number; }; }; }; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ state() {
+>state : () => { bar2: number; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^
+
+ return { bar2: 1 };
+>{ bar2: 1 } : { bar2: number; }
+> : ^^^^^^^^^^^^^^^^^
+>bar2 : number
+> : ^^^^^^
+>1 : 1
+> : ^
+
+ },
+ mutations: { inc: (state123) => state123.bar2++ },
+>mutations : { inc: (state123: { bar2: number; }) => number; }
+> : ^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>{ inc: (state123) => state123.bar2++ } : { inc: (state123: { bar2: number; }) => number; }
+> : ^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>inc : (state123: { bar2: number; }) => number
+> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>(state123) => state123.bar2++ : (state123: { bar2: number; }) => number
+> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>state123 : { bar2: number; }
+> : ^^^^^^^^^^^^^^^^^
+>state123.bar2++ : number
+> : ^^^^^^
+>state123.bar2 : number
+> : ^^^^^^
+>state123 : { bar2: number; }
+> : ^^^^^^^^^^^^^^^^^
+>bar2 : number
+> : ^^^^^^
+
+ modules: {
+>modules : { foo: { state(): { bar2: number; }; mutations: { inc: (state: { bar2: number; }) => number; }; }; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>{ foo: { state() { return { bar2: 1 }; }, mutations: { inc: (state) => state.bar2++ }, }, } : { foo: { state(): { bar2: number; }; mutations: { inc: (state: { bar2: number; }) => number; }; }; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ foo: {
+>foo : { state(): { bar2: number; }; mutations: { inc: (state: { bar2: number; }) => number; }; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>{ state() { return { bar2: 1 }; }, mutations: { inc: (state) => state.bar2++ }, } : { state(): { bar2: number; }; mutations: { inc: (state: { bar2: number; }) => number; }; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ state() {
+>state : () => { bar2: number; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^
+
+ return { bar2: 1 };
+>{ bar2: 1 } : { bar2: number; }
+> : ^^^^^^^^^^^^^^^^^
+>bar2 : number
+> : ^^^^^^
+>1 : 1
+> : ^
+
+ },
+ mutations: { inc: (state) => state.bar2++ },
+>mutations : { inc: (state: { bar2: number; }) => number; }
+> : ^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>{ inc: (state) => state.bar2++ } : { inc: (state: { bar2: number; }) => number; }
+> : ^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>inc : (state: { bar2: number; }) => number
+> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>(state) => state.bar2++ : (state: { bar2: number; }) => number
+> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>state : { bar2: number; }
+> : ^^^^^^^^^^^^^^^^^
+>state.bar2++ : number
+> : ^^^^^^
+>state.bar2 : number
+> : ^^^^^^
+>state : { bar2: number; }
+> : ^^^^^^^^^^^^^^^^^
+>bar2 : number
+> : ^^^^^^
+
+ },
+ },
+});
+
+// https://github.com/microsoft/TypeScript/issues/57572
+
+type C = void>(options: {
+>C : C
+> : ^
+>methods : Methods
+> : ^^^^^^^
+>options : { methods: Methods; attached: Attached; }
+> : ^^^^^^^^^^^ ^^^^^^^^^^^^ ^^^
+
+ methods: Methods;
+>methods : Methods
+> : ^^^^^^^
+
+ attached: Attached;
+>attached : Attached
+> : ^^^^^^^^
+
+}) => any;
+
+var Component: C = () => {};
+>Component : C
+> : ^
+>() => {} : () => void
+> : ^^^^^^^^^^
+
+Component({
+>Component({ attached(methods) { methods.bbb(); // ok }, methods: { bbb() {}, },}) : any
+> : ^^^
+>Component : C
+> : ^
+>{ attached(methods) { methods.bbb(); // ok }, methods: { bbb() {}, },} : { attached(methods: { bbb(): void; }): void; methods: { bbb(): void; }; }
+> : ^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ attached(methods) {
+>attached : (methods: { bbb(): void; }) => void
+> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>methods : { bbb(): void; }
+> : ^^^^^^^^^^^^^^^^
+
+ methods.bbb(); // ok
+>methods.bbb() : void
+> : ^^^^
+>methods.bbb : () => void
+> : ^^^^^^^^^^
+>methods : { bbb(): void; }
+> : ^^^^^^^^^^^^^^^^
+>bbb : () => void
+> : ^^^^^^^^^^
+
+ },
+ methods: {
+>methods : { bbb(): void; }
+> : ^^^^^^^^^^^^^^^^
+>{ bbb() {}, } : { bbb(): void; }
+> : ^^^^^^^^^^^^^^^^
+
+ bbb() {},
+>bbb : () => void
+> : ^^^^^^^^^^
+
+ },
+});
+
+Component({
+>Component({ attached(methods) { methods.bbb(); // ok }, methods: { bbb: () => {}, },}) : any
+> : ^^^
+>Component : C
+> : ^
+>{ attached(methods) { methods.bbb(); // ok }, methods: { bbb: () => {}, },} : { attached(methods: { bbb: () => void; }): void; methods: { bbb: () => void; }; }
+> : ^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ attached(methods) {
+>attached : (methods: { bbb: () => void; }) => void
+> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>methods : { bbb: () => void; }
+> : ^^^^^^^^^^^^^^^^^^^^
+
+ methods.bbb(); // ok
+>methods.bbb() : void
+> : ^^^^
+>methods.bbb : () => void
+> : ^^^^^^^^^^
+>methods : { bbb: () => void; }
+> : ^^^^^^^^^^^^^^^^^^^^
+>bbb : () => void
+> : ^^^^^^^^^^
+
+ },
+ methods: {
+>methods : { bbb: () => void; }
+> : ^^^^^^^^^^^^^^^^^^^^
+>{ bbb: () => {}, } : { bbb: () => void; }
+> : ^^^^^^^^^^^^^^^^^^^^
+
+ bbb: () => {},
+>bbb : () => void
+> : ^^^^^^^^^^
+>() => {} : () => void
+> : ^^^^^^^^^^
+
+ },
+});
+
+// https://github.com/microsoft/TypeScript/issues/56067
+
+declare function create56067<
+>create56067 : , Data extends Record, Actions extends (state: State, data: Data) => Record>(args: { getState: () => State; actions: Actions; getData: () => Data; }) => void
+> : ^ ^^^^^^^^^ ^^ ^^^^^^^^^ ^^ ^^^^^^^^^ ^^ ^^ ^^^^^
+
+ State extends Record,
+ Data extends Record,
+ Actions extends (state: State, data: Data) => Record,
+>state : State
+> : ^^^^^
+>data : Data
+> : ^^^^
+
+>(args: { getState: () => State; actions: Actions; getData: () => Data }): void;
+>args : { getState: () => State; actions: Actions; getData: () => Data; }
+> : ^^^^^^^^^^^^ ^^^^^^^^^^^ ^^^^^^^^^^^ ^^^
+>getState : () => State
+> : ^^^^^^
+>actions : Actions
+> : ^^^^^^^
+>getData : () => Data
+> : ^^^^^^
+
+create56067({
+>create56067({ getState() { return { a: 1 }; }, getData: () => { return { b: 2 }; }, actions(state, data) { state // { a: number } data; // { b: number } return { z: 1, }; },}) : void
+> : ^^^^
+>create56067 : , Data extends Record, Actions extends (state: State, data: Data) => Record>(args: { getState: () => State; actions: Actions; getData: () => Data; }) => void
+> : ^ ^^^^^^^^^ ^^ ^^^^^^^^^ ^^ ^^^^^^^^^ ^^ ^^ ^^^^^
+>{ getState() { return { a: 1 }; }, getData: () => { return { b: 2 }; }, actions(state, data) { state // { a: number } data; // { b: number } return { z: 1, }; },} : { getState(): { a: number; }; getData: () => { b: number; }; actions(state: { a: number; }, data: { b: number; }): { z: number; }; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ getState() {
+>getState : () => { a: number; }
+> : ^^^^^^^^^^^^^^^^^^^^
+
+ return { a: 1 };
+>{ a: 1 } : { a: number; }
+> : ^^^^^^^^^^^^^^
+>a : number
+> : ^^^^^^
+>1 : 1
+> : ^
+
+ },
+ getData: () => {
+>getData : () => { b: number; }
+> : ^^^^^^^^^^^^^^^^^^^^
+>() => { return { b: 2 }; } : () => { b: number; }
+> : ^^^^^^^^^^^^^^^^^^^^
+
+ return { b: 2 };
+>{ b: 2 } : { b: number; }
+> : ^^^^^^^^^^^^^^
+>b : number
+> : ^^^^^^
+>2 : 2
+> : ^
+
+ },
+ actions(state, data) {
+>actions : (state: { a: number; }, data: { b: number; }) => { z: number; }
+> : ^ ^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>state : { a: number; }
+> : ^^^^^^^^^^^^^^
+>data : { b: number; }
+> : ^^^^^^^^^^^^^^
+
+ state // { a: number }
+>state : { a: number; }
+> : ^^^^^^^^^^^^^^
+
+ data; // { b: number }
+>data : { b: number; }
+> : ^^^^^^^^^^^^^^
+
+ return {
+>{ z: 1, } : { z: number; }
+> : ^^^^^^^^^^^^^^
+
+ z: 1,
+>z : number
+> : ^^^^^^
+>1 : 1
+> : ^
+
+ };
+ },
+});
+
+// https://github.com/microsoft/TypeScript/issues/55489
+type NonStringIterable =
+>NonStringIterable : NonStringIterable
+> : ^^^^^^^^^^^^^^^^^^^^
+
+ T extends string ? never : T extends Iterable ? T : never;
+
+declare function doSomething(value: NonStringIterable): T;
+>doSomething : (value: NonStringIterable) => T
+> : ^ ^^ ^^ ^^^^^
+>value : NonStringIterable
+> : ^^^^^^^^^^^^^^^^^^^^
+
+const o = { foo() {} };
+>o : { foo(): void; }
+> : ^^^^^^^^^^^^^^^^
+>{ foo() {} } : { foo(): void; }
+> : ^^^^^^^^^^^^^^^^
+>foo : () => void
+> : ^^^^^^^^^^
+
+doSomething('value'); // error
+>doSomething('value') : "value"
+> : ^^^^^^^
+>doSomething : (value: NonStringIterable) => T
+> : ^ ^^ ^^ ^^^^^
+>'value' : "value"
+> : ^^^^^^^
+
+doSomething(['v']); // ok
+>doSomething(['v']) : string[]
+> : ^^^^^^^^
+>doSomething : (value: NonStringIterable) => T
+> : ^ ^^ ^^ ^^^^^
+>['v'] : string[]
+> : ^^^^^^^^
+>'v' : "v"
+> : ^^^
+
+doSomething([o]); // ok
+>doSomething([o]) : { foo(): void; }[]
+> : ^^^^^^^^^^^^^^^^^^
+>doSomething : (value: NonStringIterable) => T
+> : ^ ^^ ^^ ^^^^^
+>[o] : { foo(): void; }[]
+> : ^^^^^^^^^^^^^^^^^^
+>o : { foo(): void; }
+> : ^^^^^^^^^^^^^^^^
+
+doSomething([{ foo() {} }]); // ok
+>doSomething([{ foo() {} }]) : { foo(): void; }[]
+> : ^^^^^^^^^^^^^^^^^^
+>doSomething : (value: NonStringIterable) => T
+> : ^ ^^ ^^ ^^^^^
+>[{ foo() {} }] : { foo(): void; }[]
+> : ^^^^^^^^^^^^^^^^^^
+>{ foo() {} } : { foo(): void; }
+> : ^^^^^^^^^^^^^^^^
+>foo : () => void
+> : ^^^^^^^^^^
+
+// https://github.com/microsoft/TypeScript/issues/55124
+type Values = T[keyof T];
+>Values : Values
+> : ^^^^^^^^^
+
+type ExtractFields = Values<{
+>ExtractFields : ExtractFields
+> : ^^^^^^^^^^^^^^^^^^^^^^
+
+ [K in keyof Options]: Options[K] extends object ? keyof Options[K] : never;
+}>;
+type SetType = {
+>SetType : SetType
+> : ^^^^^^^^^^^^^^^^
+
+ [key: string]: any;
+>key : string
+> : ^^^^^^
+
+ target?: ExtractFields;
+>target : ExtractFields | undefined
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+};
+
+declare function test55124>(
+>test55124 : >(options: OptionsData) => void
+> : ^ ^^^^^^^^^ ^^ ^^ ^^^^^
+
+ options: OptionsData,
+>options : OptionsData
+> : ^^^^^^^^^^^
+
+): void;
+
+test55124({
+>test55124({ target: "$test4", // ok data1: { $test1: 111, $test2: null, }, data2: { $test3: {}, $test4: () => {}, $test5() {}, },}) : void
+> : ^^^^
+>test55124 : >(options: OptionsData) => void
+> : ^ ^^^^^^^^^ ^^ ^^ ^^^^^
+>{ target: "$test4", // ok data1: { $test1: 111, $test2: null, }, data2: { $test3: {}, $test4: () => {}, $test5() {}, },} : { target: "$test4"; data1: { $test1: number; $test2: null; }; data2: { $test3: {}; $test4: () => void; $test5(): void; }; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ target: "$test4", // ok
+>target : "$test4"
+> : ^^^^^^^^
+>"$test4" : "$test4"
+> : ^^^^^^^^
+
+ data1: {
+>data1 : { $test1: number; $test2: null; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>{ $test1: 111, $test2: null, } : { $test1: number; $test2: null; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ $test1: 111,
+>$test1 : number
+> : ^^^^^^
+>111 : 111
+> : ^^^
+
+ $test2: null,
+>$test2 : null
+> : ^^^^
+
+ },
+ data2: {
+>data2 : { $test3: {}; $test4: () => void; $test5(): void; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>{ $test3: {}, $test4: () => {}, $test5() {}, } : { $test3: {}; $test4: () => void; $test5(): void; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ $test3: {},
+>$test3 : {}
+> : ^^
+>{} : {}
+> : ^^
+
+ $test4: () => {},
+>$test4 : () => void
+> : ^^^^^^^^^^
+>() => {} : () => void
+> : ^^^^^^^^^^
+
+ $test5() {},
+>$test5 : () => void
+> : ^^^^^^^^^^
+
+ },
+});
+
+test55124({
+>test55124({ target: "$test6", // error data1: { $test1: 111, $test2: null, }, data2: { $test3: {}, $test4: () => {}, $test5() {}, },}) : void
+> : ^^^^
+>test55124 : >(options: OptionsData) => void
+> : ^ ^^^^^^^^^ ^^ ^^ ^^^^^
+>{ target: "$test6", // error data1: { $test1: 111, $test2: null, }, data2: { $test3: {}, $test4: () => {}, $test5() {}, },} : { target: "$test6"; data1: { $test1: number; $test2: null; }; data2: { $test3: {}; $test4: () => void; $test5(): void; }; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ target: "$test6", // error
+>target : "$test6"
+> : ^^^^^^^^
+>"$test6" : "$test6"
+> : ^^^^^^^^
+
+ data1: {
+>data1 : { $test1: number; $test2: null; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>{ $test1: 111, $test2: null, } : { $test1: number; $test2: null; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ $test1: 111,
+>$test1 : number
+> : ^^^^^^
+>111 : 111
+> : ^^^
+
+ $test2: null,
+>$test2 : null
+> : ^^^^
+
+ },
+ data2: {
+>data2 : { $test3: {}; $test4: () => void; $test5(): void; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>{ $test3: {}, $test4: () => {}, $test5() {}, } : { $test3: {}; $test4: () => void; $test5(): void; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ $test3: {},
+>$test3 : {}
+> : ^^
+>{} : {}
+> : ^^
+
+ $test4: () => {},
+>$test4 : () => void
+> : ^^^^^^^^^^
+>() => {} : () => void
+> : ^^^^^^^^^^
+
+ $test5() {},
+>$test5 : () => void
+> : ^^^^^^^^^^
+
+ },
+});
+
+// https://github.com/microsoft/TypeScript/issues/53924
+function test53924(options: { a: (c: T) => void; b: () => T }) {}
+>test53924 : (options: { a: (c: T) => void; b: () => T; }) => void
+> : ^ ^^^^^^^^^^^^ ^^ ^^^^^^^^^
+>options : { a: (c: T) => void; b: () => T; }
+> : ^^^^^ ^^^^^ ^^^
+>a : (c: T) => void
+> : ^ ^^ ^^^^^
+>c : T
+> : ^
+>b : () => T
+> : ^^^^^^
+
+test53924({
+>test53924({ a: (c) => { c; // number; }, b: () => 123,}) : void
+> : ^^^^
+>test53924 : (options: { a: (c: T) => void; b: () => T; }) => void
+> : ^ ^^^^^^^^^^^^ ^^ ^^^^^^^^^
+>{ a: (c) => { c; // number; }, b: () => 123,} : { a: (c: number) => void; b: () => number; }
+> : ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ a: (c) => {
+>a : (c: number) => void
+> : ^ ^^^^^^^^^^^^^^^^^
+>(c) => { c; // number; } : (c: number) => void
+> : ^ ^^^^^^^^^^^^^^^^^
+>c : number
+> : ^^^^^^
+
+ c; // number;
+>c : number
+> : ^^^^^^
+
+ },
+ b: () => 123,
+>b : () => number
+> : ^^^^^^^^^^^^
+>() => 123 : () => number
+> : ^^^^^^^^^^^^
+>123 : 123
+> : ^^^
+
+});
+
+test53924({
+>test53924({ b: () => 123, a: (c) => { return c; // number },}) : void
+> : ^^^^
+>test53924 : (options: { a: (c: T) => void; b: () => T; }) => void
+> : ^ ^^^^^^^^^^^^ ^^ ^^^^^^^^^
+>{ b: () => 123, a: (c) => { return c; // number },} : { b: () => number; a: (c: number) => number; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^
+
+ b: () => 123,
+>b : () => number
+> : ^^^^^^^^^^^^
+>() => 123 : () => number
+> : ^^^^^^^^^^^^
+>123 : 123
+> : ^^^
+
+ a: (c) => {
+>a : (c: number) => number
+> : ^ ^^^^^^^^^^^^^^^^^^^
+>(c) => { return c; // number } : (c: number) => number
+> : ^ ^^^^^^^^^^^^^^^^^^^
+>c : number
+> : ^^^^^^
+
+ return c; // number
+>c : number
+> : ^^^^^^
+
+ },
+});
+
+test53924({
+>test53924({ b() { return 123; }, a(c) { return c; // number },}) : void
+> : ^^^^
+>test53924 : (options: { a: (c: T) => void; b: () => T; }) => void
+> : ^ ^^^^^^^^^^^^ ^^ ^^^^^^^^^
+>{ b() { return 123; }, a(c) { return c; // number },} : { b(): number; a(c: number): number; }
+> : ^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^
+
+ b() {
+>b : () => number
+> : ^^^^^^^^^^^^
+
+ return 123;
+>123 : 123
+> : ^^^
+
+ },
+ a(c) {
+>a : (c: number) => number
+> : ^ ^^^^^^^^^^^^^^^^^^^
+>c : number
+> : ^^^^^^
+
+ return c; // number
+>c : number
+> : ^^^^^^
+
+ },
+});
+
+test53924({
+>test53924({ a(c) { return c; // number }, b() { return 123; },}) : void
+> : ^^^^
+>test53924 : (options: { a: (c: T) => void; b: () => T; }) => void
+> : ^ ^^^^^^^^^^^^ ^^ ^^^^^^^^^
+>{ a(c) { return c; // number }, b() { return 123; },} : { a(c: number): number; b(): number; }
+> : ^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ a(c) {
+>a : (c: number) => number
+> : ^ ^^^^^^^^^^^^^^^^^^^
+>c : number
+> : ^^^^^^
+
+ return c; // number
+>c : number
+> : ^^^^^^
+
+ },
+ b() {
+>b : () => number
+> : ^^^^^^^^^^^^
+
+ return 123;
+>123 : 123
+> : ^^^
+
+ },
+});
+
+// https://github.com/microsoft/TypeScript/issues/50258
+declare function monitor any>(
+>monitor : any>(extractor: (...args: Parameters) => Record, executor: T) => (...args: Parameters) => ReturnType
+> : ^ ^^^^^^^^^ ^^ ^^ ^^ ^^ ^^^^^
+>args : any
+> : ^^^
+
+ extractor: (...args: Parameters) => Record,
+>extractor : (...args: Parameters) => Record
+> : ^^^^ ^^ ^^^^^
+>args : Parameters
+> : ^^^^^^^^^^^^^
+
+ executor: T,
+>executor : T
+> : ^
+
+): (...args: Parameters) => ReturnType;
+>args : Parameters
+> : ^^^^^^^^^^^^^
+
+monitor(
+>monitor( (p) => ({ p }), // { p: number } (p: number) => p,) : (p: number) => number
+> : ^^^^^^^^^^^^^^^^^^^^^
+>monitor : any>(extractor: (...args: Parameters) => Record, executor: T) => (...args: Parameters) => ReturnType
+> : ^ ^^^^^^^^^ ^^ ^^ ^^ ^^ ^^^^^
+
+ (p) => ({ p }), // { p: number }
+>(p) => ({ p }) : (p: number) => { p: number; }
+> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>p : number
+> : ^^^^^^
+>({ p }) : { p: number; }
+> : ^^^^^^^^^^^^^^
+>{ p } : { p: number; }
+> : ^^^^^^^^^^^^^^
+>p : number
+> : ^^^^^^
+
+ (p: number) => p,
+>(p: number) => p : (p: number) => number
+> : ^ ^^ ^^^^^^^^^^^
+>p : number
+> : ^^^^^^
+>p : number
+> : ^^^^^^
+
+);
+monitor(
+>monitor( (p) => ({ p }), // { p: number } function (p: number) { return p; },) : (p: number) => number
+> : ^^^^^^^^^^^^^^^^^^^^^
+>monitor : any>(extractor: (...args: Parameters) => Record, executor: T) => (...args: Parameters) => ReturnType
+> : ^ ^^^^^^^^^ ^^ ^^ ^^ ^^ ^^^^^
+
+ (p) => ({ p }), // { p: number }
+>(p) => ({ p }) : (p: number) => { p: number; }
+> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>p : number
+> : ^^^^^^
+>({ p }) : { p: number; }
+> : ^^^^^^^^^^^^^^
+>{ p } : { p: number; }
+> : ^^^^^^^^^^^^^^
+>p : number
+> : ^^^^^^
+
+ function (p: number) {
+>function (p: number) { return p; } : (p: number) => number
+> : ^ ^^ ^^^^^^^^^^^
+>p : number
+> : ^^^^^^
+
+ return p;
+>p : number
+> : ^^^^^^
+
+ },
+);
+
diff --git a/tests/baselines/reference/thislessFunctionsNotContextSensitive2.errors.txt b/tests/baselines/reference/thislessFunctionsNotContextSensitive2.errors.txt
new file mode 100644
index 0000000000000..299f833b65a1b
--- /dev/null
+++ b/tests/baselines/reference/thislessFunctionsNotContextSensitive2.errors.txt
@@ -0,0 +1,132 @@
+thislessFunctionsNotContextSensitive2.ts(52,14): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation.
+thislessFunctionsNotContextSensitive2.ts(83,12): error TS7041: The containing arrow function captures the global value of 'this'.
+
+
+==== thislessFunctionsNotContextSensitive2.ts (2 errors) ====
+ interface Options {
+ context: Context;
+ produce(this: Context): Data;
+ consume(this: Context, data: Data): void;
+ }
+
+ declare function defineOptions(
+ options: Options,
+ ): [Context, Data];
+
+ const result1 = defineOptions({
+ context: { tag: "A", value: 1 },
+ consume(_data) {},
+ produce() {
+ return 42;
+ },
+ });
+
+ const result2 = defineOptions({
+ context: { tag: "B", value: 2 },
+ consume(_data) {},
+ produce() {
+ return this.value;
+ },
+ });
+
+ const result3 = defineOptions({
+ context: { tag: "C", value: 3 },
+ consume(_data) {},
+ produce: () => 123,
+ });
+
+ const result4 = defineOptions({
+ context: { tag: "D", value: 4 },
+ consume(_data) {},
+ produce() {
+ class Local {
+ value = 'foo';
+ get() {
+ return this.value;
+ }
+ }
+ return new Local().get();;
+ },
+ });
+
+ const result5 = defineOptions({
+ context: { tag: "E", value: 5 },
+ consume(_data) {},
+ produce() {
+ function inner() {
+ return this;
+ ~~~~
+!!! error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation.
+!!! related TS2738 thislessFunctionsNotContextSensitive2.ts:51:14: An outer value of 'this' is shadowed by this container.
+ }
+ return inner();
+ },
+ });
+
+ const result6 = defineOptions({
+ context: { tag: "F", value: 6 },
+ consume(_data) {},
+ produce() {
+ const arrow = () => this.value;
+ return arrow();
+ },
+ });
+
+ const result7 = defineOptions({
+ context: { tag: "G", value: 7 },
+ consume(_data) {},
+ produce() {
+ const self = this;
+ function inner() {
+ return self.value;
+ }
+ return inner();
+ },
+ });
+
+ const result8 = defineOptions({
+ context: { tag: "H", value: 8 },
+ consume(_data) {},
+ produce: () => {
+ return this;
+ ~~~~
+!!! error TS7041: The containing arrow function captures the global value of 'this'.
+ },
+ });
+
+ const result9 = defineOptions({
+ context: { tag: "I", value: 9 },
+ consume(_data) {},
+ produce() {
+ const obj = {
+ value: 'foo',
+ get() {
+ return this.value;
+ },
+ };
+ return obj.get();
+ },
+ });
+
+ const result10 = defineOptions({
+ context: { tag: "I", value: 9 },
+ consume(_data) {},
+ produce() {
+ interface Foo {
+ prop: this;
+ }
+ return {} as Foo;
+ },
+ });
+
+ const result11 = defineOptions({
+ context: { tag: "I", value: 9 },
+ consume(_data) {},
+ produce() {
+ function fn(this: { prop: string }) {
+ return this.prop;
+ }
+ return fn;
+ },
+ });
+
\ No newline at end of file
diff --git a/tests/baselines/reference/thislessFunctionsNotContextSensitive2.symbols b/tests/baselines/reference/thislessFunctionsNotContextSensitive2.symbols
new file mode 100644
index 0000000000000..29d0c190d417f
--- /dev/null
+++ b/tests/baselines/reference/thislessFunctionsNotContextSensitive2.symbols
@@ -0,0 +1,353 @@
+//// [tests/cases/compiler/thislessFunctionsNotContextSensitive2.ts] ////
+
+=== thislessFunctionsNotContextSensitive2.ts ===
+interface Options {
+>Options : Symbol(Options, Decl(thislessFunctionsNotContextSensitive2.ts, 0, 0))
+>Context : Symbol(Context, Decl(thislessFunctionsNotContextSensitive2.ts, 0, 18))
+>Data : Symbol(Data, Decl(thislessFunctionsNotContextSensitive2.ts, 0, 26))
+
+ context: Context;
+>context : Symbol(Options.context, Decl(thislessFunctionsNotContextSensitive2.ts, 0, 34))
+>Context : Symbol(Context, Decl(thislessFunctionsNotContextSensitive2.ts, 0, 18))
+
+ produce(this: Context): Data;
+>produce : Symbol(Options.produce, Decl(thislessFunctionsNotContextSensitive2.ts, 1, 19))
+>this : Symbol(this, Decl(thislessFunctionsNotContextSensitive2.ts, 2, 10))
+>Context : Symbol(Context, Decl(thislessFunctionsNotContextSensitive2.ts, 0, 18))
+>Data : Symbol(Data, Decl(thislessFunctionsNotContextSensitive2.ts, 0, 26))
+
+ consume(this: Context, data: Data): void;
+>consume : Symbol(Options.consume, Decl(thislessFunctionsNotContextSensitive2.ts, 2, 31))
+>this : Symbol(this, Decl(thislessFunctionsNotContextSensitive2.ts, 3, 10))
+>Context : Symbol(Context, Decl(thislessFunctionsNotContextSensitive2.ts, 0, 18))
+>data : Symbol(data, Decl(thislessFunctionsNotContextSensitive2.ts, 3, 24))
+>Data : Symbol(Data, Decl(thislessFunctionsNotContextSensitive2.ts, 0, 26))
+}
+
+declare function defineOptions(
+>defineOptions : Symbol(defineOptions, Decl(thislessFunctionsNotContextSensitive2.ts, 4, 1))
+>Context : Symbol(Context, Decl(thislessFunctionsNotContextSensitive2.ts, 6, 31))
+>Data : Symbol(Data, Decl(thislessFunctionsNotContextSensitive2.ts, 6, 39))
+
+ options: Options,
+>options : Symbol(options, Decl(thislessFunctionsNotContextSensitive2.ts, 6, 46))
+>Options : Symbol(Options, Decl(thislessFunctionsNotContextSensitive2.ts, 0, 0))
+>Context : Symbol(Context, Decl(thislessFunctionsNotContextSensitive2.ts, 6, 31))
+>Data : Symbol(Data, Decl(thislessFunctionsNotContextSensitive2.ts, 6, 39))
+
+): [Context, Data];
+>Context : Symbol(Context, Decl(thislessFunctionsNotContextSensitive2.ts, 6, 31))
+>Data : Symbol(Data, Decl(thislessFunctionsNotContextSensitive2.ts, 6, 39))
+
+const result1 = defineOptions({
+>result1 : Symbol(result1, Decl(thislessFunctionsNotContextSensitive2.ts, 10, 5))
+>defineOptions : Symbol(defineOptions, Decl(thislessFunctionsNotContextSensitive2.ts, 4, 1))
+
+ context: { tag: "A", value: 1 },
+>context : Symbol(context, Decl(thislessFunctionsNotContextSensitive2.ts, 10, 31))
+>tag : Symbol(tag, Decl(thislessFunctionsNotContextSensitive2.ts, 11, 12))
+>value : Symbol(value, Decl(thislessFunctionsNotContextSensitive2.ts, 11, 22))
+
+ consume(_data) {},
+>consume : Symbol(consume, Decl(thislessFunctionsNotContextSensitive2.ts, 11, 34))
+>_data : Symbol(_data, Decl(thislessFunctionsNotContextSensitive2.ts, 12, 10))
+
+ produce() {
+>produce : Symbol(produce, Decl(thislessFunctionsNotContextSensitive2.ts, 12, 20))
+
+ return 42;
+ },
+});
+
+const result2 = defineOptions({
+>result2 : Symbol(result2, Decl(thislessFunctionsNotContextSensitive2.ts, 18, 5))
+>defineOptions : Symbol(defineOptions, Decl(thislessFunctionsNotContextSensitive2.ts, 4, 1))
+
+ context: { tag: "B", value: 2 },
+>context : Symbol(context, Decl(thislessFunctionsNotContextSensitive2.ts, 18, 31))
+>tag : Symbol(tag, Decl(thislessFunctionsNotContextSensitive2.ts, 19, 12))
+>value : Symbol(value, Decl(thislessFunctionsNotContextSensitive2.ts, 19, 22))
+
+ consume(_data) {},
+>consume : Symbol(consume, Decl(thislessFunctionsNotContextSensitive2.ts, 19, 34))
+>_data : Symbol(_data, Decl(thislessFunctionsNotContextSensitive2.ts, 20, 10))
+
+ produce() {
+>produce : Symbol(produce, Decl(thislessFunctionsNotContextSensitive2.ts, 20, 20))
+
+ return this.value;
+>this.value : Symbol(value, Decl(thislessFunctionsNotContextSensitive2.ts, 19, 22))
+>this : Symbol(this, Decl(thislessFunctionsNotContextSensitive2.ts, 2, 10))
+>value : Symbol(value, Decl(thislessFunctionsNotContextSensitive2.ts, 19, 22))
+
+ },
+});
+
+const result3 = defineOptions({
+>result3 : Symbol(result3, Decl(thislessFunctionsNotContextSensitive2.ts, 26, 5))
+>defineOptions : Symbol(defineOptions, Decl(thislessFunctionsNotContextSensitive2.ts, 4, 1))
+
+ context: { tag: "C", value: 3 },
+>context : Symbol(context, Decl(thislessFunctionsNotContextSensitive2.ts, 26, 31))
+>tag : Symbol(tag, Decl(thislessFunctionsNotContextSensitive2.ts, 27, 12))
+>value : Symbol(value, Decl(thislessFunctionsNotContextSensitive2.ts, 27, 22))
+
+ consume(_data) {},
+>consume : Symbol(consume, Decl(thislessFunctionsNotContextSensitive2.ts, 27, 34))
+>_data : Symbol(_data, Decl(thislessFunctionsNotContextSensitive2.ts, 28, 10))
+
+ produce: () => 123,
+>produce : Symbol(produce, Decl(thislessFunctionsNotContextSensitive2.ts, 28, 20))
+
+});
+
+const result4 = defineOptions({
+>result4 : Symbol(result4, Decl(thislessFunctionsNotContextSensitive2.ts, 32, 5))
+>defineOptions : Symbol(defineOptions, Decl(thislessFunctionsNotContextSensitive2.ts, 4, 1))
+
+ context: { tag: "D", value: 4 },
+>context : Symbol(context, Decl(thislessFunctionsNotContextSensitive2.ts, 32, 31))
+>tag : Symbol(tag, Decl(thislessFunctionsNotContextSensitive2.ts, 33, 12))
+>value : Symbol(value, Decl(thislessFunctionsNotContextSensitive2.ts, 33, 22))
+
+ consume(_data) {},
+>consume : Symbol(consume, Decl(thislessFunctionsNotContextSensitive2.ts, 33, 34))
+>_data : Symbol(_data, Decl(thislessFunctionsNotContextSensitive2.ts, 34, 10))
+
+ produce() {
+>produce : Symbol(produce, Decl(thislessFunctionsNotContextSensitive2.ts, 34, 20))
+
+ class Local {
+>Local : Symbol(Local, Decl(thislessFunctionsNotContextSensitive2.ts, 35, 13))
+
+ value = 'foo';
+>value : Symbol(Local.value, Decl(thislessFunctionsNotContextSensitive2.ts, 36, 17))
+
+ get() {
+>get : Symbol(Local.get, Decl(thislessFunctionsNotContextSensitive2.ts, 37, 20))
+
+ return this.value;
+>this.value : Symbol(Local.value, Decl(thislessFunctionsNotContextSensitive2.ts, 36, 17))
+>this : Symbol(Local, Decl(thislessFunctionsNotContextSensitive2.ts, 35, 13))
+>value : Symbol(Local.value, Decl(thislessFunctionsNotContextSensitive2.ts, 36, 17))
+ }
+ }
+ return new Local().get();;
+>new Local().get : Symbol(Local.get, Decl(thislessFunctionsNotContextSensitive2.ts, 37, 20))
+>Local : Symbol(Local, Decl(thislessFunctionsNotContextSensitive2.ts, 35, 13))
+>get : Symbol(Local.get, Decl(thislessFunctionsNotContextSensitive2.ts, 37, 20))
+
+ },
+});
+
+const result5 = defineOptions({
+>result5 : Symbol(result5, Decl(thislessFunctionsNotContextSensitive2.ts, 46, 5))
+>defineOptions : Symbol(defineOptions, Decl(thislessFunctionsNotContextSensitive2.ts, 4, 1))
+
+ context: { tag: "E", value: 5 },
+>context : Symbol(context, Decl(thislessFunctionsNotContextSensitive2.ts, 46, 31))
+>tag : Symbol(tag, Decl(thislessFunctionsNotContextSensitive2.ts, 47, 12))
+>value : Symbol(value, Decl(thislessFunctionsNotContextSensitive2.ts, 47, 22))
+
+ consume(_data) {},
+>consume : Symbol(consume, Decl(thislessFunctionsNotContextSensitive2.ts, 47, 34))
+>_data : Symbol(_data, Decl(thislessFunctionsNotContextSensitive2.ts, 48, 10))
+
+ produce() {
+>produce : Symbol(produce, Decl(thislessFunctionsNotContextSensitive2.ts, 48, 20))
+
+ function inner() {
+>inner : Symbol(inner, Decl(thislessFunctionsNotContextSensitive2.ts, 49, 13))
+
+ return this;
+ }
+ return inner();
+>inner : Symbol(inner, Decl(thislessFunctionsNotContextSensitive2.ts, 49, 13))
+
+ },
+});
+
+const result6 = defineOptions({
+>result6 : Symbol(result6, Decl(thislessFunctionsNotContextSensitive2.ts, 57, 5))
+>defineOptions : Symbol(defineOptions, Decl(thislessFunctionsNotContextSensitive2.ts, 4, 1))
+
+ context: { tag: "F", value: 6 },
+>context : Symbol(context, Decl(thislessFunctionsNotContextSensitive2.ts, 57, 31))
+>tag : Symbol(tag, Decl(thislessFunctionsNotContextSensitive2.ts, 58, 12))
+>value : Symbol(value, Decl(thislessFunctionsNotContextSensitive2.ts, 58, 22))
+
+ consume(_data) {},
+>consume : Symbol(consume, Decl(thislessFunctionsNotContextSensitive2.ts, 58, 34))
+>_data : Symbol(_data, Decl(thislessFunctionsNotContextSensitive2.ts, 59, 10))
+
+ produce() {
+>produce : Symbol(produce, Decl(thislessFunctionsNotContextSensitive2.ts, 59, 20))
+
+ const arrow = () => this.value;
+>arrow : Symbol(arrow, Decl(thislessFunctionsNotContextSensitive2.ts, 61, 9))
+>this.value : Symbol(value, Decl(thislessFunctionsNotContextSensitive2.ts, 58, 22))
+>this : Symbol(this, Decl(thislessFunctionsNotContextSensitive2.ts, 2, 10))
+>value : Symbol(value, Decl(thislessFunctionsNotContextSensitive2.ts, 58, 22))
+
+ return arrow();
+>arrow : Symbol(arrow, Decl(thislessFunctionsNotContextSensitive2.ts, 61, 9))
+
+ },
+});
+
+const result7 = defineOptions({
+>result7 : Symbol(result7, Decl(thislessFunctionsNotContextSensitive2.ts, 66, 5))
+>defineOptions : Symbol(defineOptions, Decl(thislessFunctionsNotContextSensitive2.ts, 4, 1))
+
+ context: { tag: "G", value: 7 },
+>context : Symbol(context, Decl(thislessFunctionsNotContextSensitive2.ts, 66, 31))
+>tag : Symbol(tag, Decl(thislessFunctionsNotContextSensitive2.ts, 67, 12))
+>value : Symbol(value, Decl(thislessFunctionsNotContextSensitive2.ts, 67, 22))
+
+ consume(_data) {},
+>consume : Symbol(consume, Decl(thislessFunctionsNotContextSensitive2.ts, 67, 34))
+>_data : Symbol(_data, Decl(thislessFunctionsNotContextSensitive2.ts, 68, 10))
+
+ produce() {
+>produce : Symbol(produce, Decl(thislessFunctionsNotContextSensitive2.ts, 68, 20))
+
+ const self = this;
+>self : Symbol(self, Decl(thislessFunctionsNotContextSensitive2.ts, 70, 9))
+>this : Symbol(this, Decl(thislessFunctionsNotContextSensitive2.ts, 2, 10))
+
+ function inner() {
+>inner : Symbol(inner, Decl(thislessFunctionsNotContextSensitive2.ts, 70, 22))
+
+ return self.value;
+>self.value : Symbol(value, Decl(thislessFunctionsNotContextSensitive2.ts, 67, 22))
+>self : Symbol(self, Decl(thislessFunctionsNotContextSensitive2.ts, 70, 9))
+>value : Symbol(value, Decl(thislessFunctionsNotContextSensitive2.ts, 67, 22))
+ }
+ return inner();
+>inner : Symbol(inner, Decl(thislessFunctionsNotContextSensitive2.ts, 70, 22))
+
+ },
+});
+
+const result8 = defineOptions({
+>result8 : Symbol(result8, Decl(thislessFunctionsNotContextSensitive2.ts, 78, 5))
+>defineOptions : Symbol(defineOptions, Decl(thislessFunctionsNotContextSensitive2.ts, 4, 1))
+
+ context: { tag: "H", value: 8 },
+>context : Symbol(context, Decl(thislessFunctionsNotContextSensitive2.ts, 78, 31))
+>tag : Symbol(tag, Decl(thislessFunctionsNotContextSensitive2.ts, 79, 12))
+>value : Symbol(value, Decl(thislessFunctionsNotContextSensitive2.ts, 79, 22))
+
+ consume(_data) {},
+>consume : Symbol(consume, Decl(thislessFunctionsNotContextSensitive2.ts, 79, 34))
+>_data : Symbol(_data, Decl(thislessFunctionsNotContextSensitive2.ts, 80, 10))
+
+ produce: () => {
+>produce : Symbol(produce, Decl(thislessFunctionsNotContextSensitive2.ts, 80, 20))
+
+ return this;
+>this : Symbol(globalThis)
+
+ },
+});
+
+const result9 = defineOptions({
+>result9 : Symbol(result9, Decl(thislessFunctionsNotContextSensitive2.ts, 86, 5))
+>defineOptions : Symbol(defineOptions, Decl(thislessFunctionsNotContextSensitive2.ts, 4, 1))
+
+ context: { tag: "I", value: 9 },
+>context : Symbol(context, Decl(thislessFunctionsNotContextSensitive2.ts, 86, 31))
+>tag : Symbol(tag, Decl(thislessFunctionsNotContextSensitive2.ts, 87, 12))
+>value : Symbol(value, Decl(thislessFunctionsNotContextSensitive2.ts, 87, 22))
+
+ consume(_data) {},
+>consume : Symbol(consume, Decl(thislessFunctionsNotContextSensitive2.ts, 87, 34))
+>_data : Symbol(_data, Decl(thislessFunctionsNotContextSensitive2.ts, 88, 10))
+
+ produce() {
+>produce : Symbol(produce, Decl(thislessFunctionsNotContextSensitive2.ts, 88, 20))
+
+ const obj = {
+>obj : Symbol(obj, Decl(thislessFunctionsNotContextSensitive2.ts, 90, 9))
+
+ value: 'foo',
+>value : Symbol(value, Decl(thislessFunctionsNotContextSensitive2.ts, 90, 17))
+
+ get() {
+>get : Symbol(get, Decl(thislessFunctionsNotContextSensitive2.ts, 91, 19))
+
+ return this.value;
+>this.value : Symbol(value, Decl(thislessFunctionsNotContextSensitive2.ts, 90, 17))
+>this : Symbol(obj, Decl(thislessFunctionsNotContextSensitive2.ts, 90, 15))
+>value : Symbol(value, Decl(thislessFunctionsNotContextSensitive2.ts, 90, 17))
+
+ },
+ };
+ return obj.get();
+>obj.get : Symbol(get, Decl(thislessFunctionsNotContextSensitive2.ts, 91, 19))
+>obj : Symbol(obj, Decl(thislessFunctionsNotContextSensitive2.ts, 90, 9))
+>get : Symbol(get, Decl(thislessFunctionsNotContextSensitive2.ts, 91, 19))
+
+ },
+});
+
+const result10 = defineOptions({
+>result10 : Symbol(result10, Decl(thislessFunctionsNotContextSensitive2.ts, 100, 5))
+>defineOptions : Symbol(defineOptions, Decl(thislessFunctionsNotContextSensitive2.ts, 4, 1))
+
+ context: { tag: "I", value: 9 },
+>context : Symbol(context, Decl(thislessFunctionsNotContextSensitive2.ts, 100, 32))
+>tag : Symbol(tag, Decl(thislessFunctionsNotContextSensitive2.ts, 101, 12))
+>value : Symbol(value, Decl(thislessFunctionsNotContextSensitive2.ts, 101, 22))
+
+ consume(_data) {},
+>consume : Symbol(consume, Decl(thislessFunctionsNotContextSensitive2.ts, 101, 34))
+>_data : Symbol(_data, Decl(thislessFunctionsNotContextSensitive2.ts, 102, 10))
+
+ produce() {
+>produce : Symbol(produce, Decl(thislessFunctionsNotContextSensitive2.ts, 102, 20))
+
+ interface Foo {
+>Foo : Symbol(Foo, Decl(thislessFunctionsNotContextSensitive2.ts, 103, 13))
+
+ prop: this;
+>prop : Symbol(Foo.prop, Decl(thislessFunctionsNotContextSensitive2.ts, 104, 19))
+ }
+ return {} as Foo;
+>Foo : Symbol(Foo, Decl(thislessFunctionsNotContextSensitive2.ts, 103, 13))
+
+ },
+});
+
+const result11 = defineOptions({
+>result11 : Symbol(result11, Decl(thislessFunctionsNotContextSensitive2.ts, 111, 5))
+>defineOptions : Symbol(defineOptions, Decl(thislessFunctionsNotContextSensitive2.ts, 4, 1))
+
+ context: { tag: "I", value: 9 },
+>context : Symbol(context, Decl(thislessFunctionsNotContextSensitive2.ts, 111, 32))
+>tag : Symbol(tag, Decl(thislessFunctionsNotContextSensitive2.ts, 112, 12))
+>value : Symbol(value, Decl(thislessFunctionsNotContextSensitive2.ts, 112, 22))
+
+ consume(_data) {},
+>consume : Symbol(consume, Decl(thislessFunctionsNotContextSensitive2.ts, 112, 34))
+>_data : Symbol(_data, Decl(thislessFunctionsNotContextSensitive2.ts, 113, 10))
+
+ produce() {
+>produce : Symbol(produce, Decl(thislessFunctionsNotContextSensitive2.ts, 113, 20))
+
+ function fn(this: { prop: string }) {
+>fn : Symbol(fn, Decl(thislessFunctionsNotContextSensitive2.ts, 114, 13))
+>this : Symbol(this, Decl(thislessFunctionsNotContextSensitive2.ts, 115, 16))
+>prop : Symbol(prop, Decl(thislessFunctionsNotContextSensitive2.ts, 115, 23))
+
+ return this.prop;
+>this.prop : Symbol(prop, Decl(thislessFunctionsNotContextSensitive2.ts, 115, 23))
+>this : Symbol(this, Decl(thislessFunctionsNotContextSensitive2.ts, 115, 16))
+>prop : Symbol(prop, Decl(thislessFunctionsNotContextSensitive2.ts, 115, 23))
+ }
+ return fn;
+>fn : Symbol(fn, Decl(thislessFunctionsNotContextSensitive2.ts, 114, 13))
+
+ },
+});
+
diff --git a/tests/baselines/reference/thislessFunctionsNotContextSensitive2.types b/tests/baselines/reference/thislessFunctionsNotContextSensitive2.types
new file mode 100644
index 0000000000000..9d035d78b6451
--- /dev/null
+++ b/tests/baselines/reference/thislessFunctionsNotContextSensitive2.types
@@ -0,0 +1,619 @@
+//// [tests/cases/compiler/thislessFunctionsNotContextSensitive2.ts] ////
+
+=== thislessFunctionsNotContextSensitive2.ts ===
+interface Options {
+ context: Context;
+>context : Context
+> : ^^^^^^^
+
+ produce(this: Context): Data;
+>produce : (this: Context) => Data
+> : ^ ^^ ^^^^^
+>this : Context
+> : ^^^^^^^
+
+ consume(this: Context, data: Data): void;
+>consume : (this: Context, data: Data) => void
+> : ^ ^^ ^^ ^^ ^^^^^
+>this : Context
+> : ^^^^^^^
+>data : Data
+> : ^^^^
+}
+
+declare function defineOptions(
+>defineOptions : (options: Options) => [Context, Data]
+> : ^ ^^ ^^ ^^ ^^^^^
+
+ options: Options,
+>options : Options
+> : ^^^^^^^^^^^^^^^^^^^^^^
+
+): [Context, Data];
+
+const result1 = defineOptions({
+>result1 : [{ tag: string; value: number; }, number]
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>defineOptions({ context: { tag: "A", value: 1 }, consume(_data) {}, produce() { return 42; },}) : [{ tag: string; value: number; }, number]
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>defineOptions : (options: Options) => [Context, Data]
+> : ^ ^^ ^^ ^^ ^^^^^
+>{ context: { tag: "A", value: 1 }, consume(_data) {}, produce() { return 42; },} : { context: { tag: string; value: number; }; consume(this: { tag: string; value: number; }, _data: number): void; produce(): number; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ context: { tag: "A", value: 1 },
+>context : { tag: string; value: number; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>{ tag: "A", value: 1 } : { tag: string; value: number; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>tag : string
+> : ^^^^^^
+>"A" : "A"
+> : ^^^
+>value : number
+> : ^^^^^^
+>1 : 1
+> : ^
+
+ consume(_data) {},
+>consume : (this: { tag: string; value: number; }, _data: number) => void
+> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^
+>_data : number
+> : ^^^^^^
+
+ produce() {
+>produce : () => number
+> : ^^^^^^^^^^^^
+
+ return 42;
+>42 : 42
+> : ^^
+
+ },
+});
+
+const result2 = defineOptions({
+>result2 : [{ tag: string; value: number; }, unknown]
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>defineOptions({ context: { tag: "B", value: 2 }, consume(_data) {}, produce() { return this.value; },}) : [{ tag: string; value: number; }, unknown]
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>defineOptions : (options: Options) => [Context, Data]
+> : ^ ^^ ^^ ^^ ^^^^^
+>{ context: { tag: "B", value: 2 }, consume(_data) {}, produce() { return this.value; },} : { context: { tag: string; value: number; }; consume(this: { tag: string; value: number; }, _data: unknown): void; produce(this: { tag: string; value: number; }): number; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ context: { tag: "B", value: 2 },
+>context : { tag: string; value: number; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>{ tag: "B", value: 2 } : { tag: string; value: number; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>tag : string
+> : ^^^^^^
+>"B" : "B"
+> : ^^^
+>value : number
+> : ^^^^^^
+>2 : 2
+> : ^
+
+ consume(_data) {},
+>consume : (this: { tag: string; value: number; }, _data: unknown) => void
+> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^
+>_data : unknown
+> : ^^^^^^^
+
+ produce() {
+>produce : (this: { tag: string; value: number; }) => number
+> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ return this.value;
+>this.value : number
+> : ^^^^^^
+>this : { tag: string; value: number; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>value : number
+> : ^^^^^^
+
+ },
+});
+
+const result3 = defineOptions({
+>result3 : [{ tag: string; value: number; }, number]
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>defineOptions({ context: { tag: "C", value: 3 }, consume(_data) {}, produce: () => 123,}) : [{ tag: string; value: number; }, number]
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>defineOptions : (options: Options) => [Context, Data]
+> : ^ ^^ ^^ ^^ ^^^^^
+>{ context: { tag: "C", value: 3 }, consume(_data) {}, produce: () => 123,} : { context: { tag: string; value: number; }; consume(this: { tag: string; value: number; }, _data: number): void; produce: () => number; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ context: { tag: "C", value: 3 },
+>context : { tag: string; value: number; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>{ tag: "C", value: 3 } : { tag: string; value: number; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>tag : string
+> : ^^^^^^
+>"C" : "C"
+> : ^^^
+>value : number
+> : ^^^^^^
+>3 : 3
+> : ^
+
+ consume(_data) {},
+>consume : (this: { tag: string; value: number; }, _data: number) => void
+> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^
+>_data : number
+> : ^^^^^^
+
+ produce: () => 123,
+>produce : () => number
+> : ^^^^^^^^^^^^
+>() => 123 : () => number
+> : ^^^^^^^^^^^^
+>123 : 123
+> : ^^^
+
+});
+
+const result4 = defineOptions({
+>result4 : [{ tag: string; value: number; }, string]
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>defineOptions({ context: { tag: "D", value: 4 }, consume(_data) {}, produce() { class Local { value = 'foo'; get() { return this.value; } } return new Local().get();; },}) : [{ tag: string; value: number; }, string]
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>defineOptions : (options: Options) => [Context, Data]
+> : ^ ^^ ^^ ^^ ^^^^^
+>{ context: { tag: "D", value: 4 }, consume(_data) {}, produce() { class Local { value = 'foo'; get() { return this.value; } } return new Local().get();; },} : { context: { tag: string; value: number; }; consume(this: { tag: string; value: number; }, _data: string): void; produce(): string; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ context: { tag: "D", value: 4 },
+>context : { tag: string; value: number; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>{ tag: "D", value: 4 } : { tag: string; value: number; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>tag : string
+> : ^^^^^^
+>"D" : "D"
+> : ^^^
+>value : number
+> : ^^^^^^
+>4 : 4
+> : ^
+
+ consume(_data) {},
+>consume : (this: { tag: string; value: number; }, _data: string) => void
+> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^
+>_data : string
+> : ^^^^^^
+
+ produce() {
+>produce : () => string
+> : ^^^^^^^^^^^^
+
+ class Local {
+>Local : Local
+> : ^^^^^
+
+ value = 'foo';
+>value : string
+> : ^^^^^^
+>'foo' : "foo"
+> : ^^^^^
+
+ get() {
+>get : () => string
+> : ^^^^^^^^^^^^
+
+ return this.value;
+>this.value : string
+> : ^^^^^^
+>this : this
+> : ^^^^
+>value : string
+> : ^^^^^^
+ }
+ }
+ return new Local().get();;
+>new Local().get() : string
+> : ^^^^^^
+>new Local().get : () => string
+> : ^^^^^^^^^^^^
+>new Local() : Local
+> : ^^^^^
+>Local : typeof Local
+> : ^^^^^^^^^^^^
+>get : () => string
+> : ^^^^^^^^^^^^
+
+ },
+});
+
+const result5 = defineOptions({
+>result5 : [{ tag: string; value: number; }, any]
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>defineOptions({ context: { tag: "E", value: 5 }, consume(_data) {}, produce() { function inner() { return this; } return inner(); },}) : [{ tag: string; value: number; }, any]
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>defineOptions : (options: Options) => [Context, Data]
+> : ^ ^^ ^^ ^^ ^^^^^
+>{ context: { tag: "E", value: 5 }, consume(_data) {}, produce() { function inner() { return this; } return inner(); },} : { context: { tag: string; value: number; }; consume(this: { tag: string; value: number; }, _data: any): void; produce(): any; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ context: { tag: "E", value: 5 },
+>context : { tag: string; value: number; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>{ tag: "E", value: 5 } : { tag: string; value: number; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>tag : string
+> : ^^^^^^
+>"E" : "E"
+> : ^^^
+>value : number
+> : ^^^^^^
+>5 : 5
+> : ^
+
+ consume(_data) {},
+>consume : (this: { tag: string; value: number; }, _data: any) => void
+> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^
+>_data : any
+> : ^^^
+
+ produce() {
+>produce : () => any
+> : ^^^^^^^^^
+
+ function inner() {
+>inner : () => any
+> : ^^^^^^^^^
+
+ return this;
+>this : any
+> : ^^^
+ }
+ return inner();
+>inner() : any
+> : ^^^
+>inner : () => any
+> : ^^^^^^^^^
+
+ },
+});
+
+const result6 = defineOptions({
+>result6 : [{ tag: string; value: number; }, unknown]
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>defineOptions({ context: { tag: "F", value: 6 }, consume(_data) {}, produce() { const arrow = () => this.value; return arrow(); },}) : [{ tag: string; value: number; }, unknown]
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>defineOptions : (options: Options) => [Context, Data]
+> : ^ ^^ ^^ ^^ ^^^^^
+>{ context: { tag: "F", value: 6 }, consume(_data) {}, produce() { const arrow = () => this.value; return arrow(); },} : { context: { tag: string; value: number; }; consume(this: { tag: string; value: number; }, _data: unknown): void; produce(this: { tag: string; value: number; }): number; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ context: { tag: "F", value: 6 },
+>context : { tag: string; value: number; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>{ tag: "F", value: 6 } : { tag: string; value: number; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>tag : string
+> : ^^^^^^
+>"F" : "F"
+> : ^^^
+>value : number
+> : ^^^^^^
+>6 : 6
+> : ^
+
+ consume(_data) {},
+>consume : (this: { tag: string; value: number; }, _data: unknown) => void
+> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^
+>_data : unknown
+> : ^^^^^^^
+
+ produce() {
+>produce : (this: { tag: string; value: number; }) => number
+> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ const arrow = () => this.value;
+>arrow : () => number
+> : ^^^^^^^^^^^^
+>() => this.value : () => number
+> : ^^^^^^^^^^^^
+>this.value : number
+> : ^^^^^^
+>this : { tag: string; value: number; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>value : number
+> : ^^^^^^
+
+ return arrow();
+>arrow() : number
+> : ^^^^^^
+>arrow : () => number
+> : ^^^^^^^^^^^^
+
+ },
+});
+
+const result7 = defineOptions({
+>result7 : [{ tag: string; value: number; }, unknown]
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>defineOptions({ context: { tag: "G", value: 7 }, consume(_data) {}, produce() { const self = this; function inner() { return self.value; } return inner(); },}) : [{ tag: string; value: number; }, unknown]
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>defineOptions : (options: Options) => [Context, Data]
+> : ^ ^^ ^^ ^^ ^^^^^
+>{ context: { tag: "G", value: 7 }, consume(_data) {}, produce() { const self = this; function inner() { return self.value; } return inner(); },} : { context: { tag: string; value: number; }; consume(this: { tag: string; value: number; }, _data: unknown): void; produce(this: { tag: string; value: number; }): number; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ context: { tag: "G", value: 7 },
+>context : { tag: string; value: number; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>{ tag: "G", value: 7 } : { tag: string; value: number; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>tag : string
+> : ^^^^^^
+>"G" : "G"
+> : ^^^
+>value : number
+> : ^^^^^^
+>7 : 7
+> : ^
+
+ consume(_data) {},
+>consume : (this: { tag: string; value: number; }, _data: unknown) => void
+> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^
+>_data : unknown
+> : ^^^^^^^
+
+ produce() {
+>produce : (this: { tag: string; value: number; }) => number
+> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ const self = this;
+>self : { tag: string; value: number; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>this : { tag: string; value: number; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ function inner() {
+>inner : () => number
+> : ^^^^^^^^^^^^
+
+ return self.value;
+>self.value : number
+> : ^^^^^^
+>self : { tag: string; value: number; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>value : number
+> : ^^^^^^
+ }
+ return inner();
+>inner() : number
+> : ^^^^^^
+>inner : () => number
+> : ^^^^^^^^^^^^
+
+ },
+});
+
+const result8 = defineOptions({
+>result8 : [{ tag: string; value: number; }, typeof globalThis]
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>defineOptions({ context: { tag: "H", value: 8 }, consume(_data) {}, produce: () => { return this; },}) : [{ tag: string; value: number; }, typeof globalThis]
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>defineOptions : (options: Options) => [Context, Data]
+> : ^ ^^ ^^ ^^ ^^^^^
+>{ context: { tag: "H", value: 8 }, consume(_data) {}, produce: () => { return this; },} : { context: { tag: string; value: number; }; consume(this: { tag: string; value: number; }, _data: typeof globalThis): void; produce: () => typeof globalThis; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ context: { tag: "H", value: 8 },
+>context : { tag: string; value: number; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>{ tag: "H", value: 8 } : { tag: string; value: number; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>tag : string
+> : ^^^^^^
+>"H" : "H"
+> : ^^^
+>value : number
+> : ^^^^^^
+>8 : 8
+> : ^
+
+ consume(_data) {},
+>consume : (this: { tag: string; value: number; }, _data: typeof globalThis) => void
+> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>_data : typeof globalThis
+> : ^^^^^^^^^^^^^^^^^
+
+ produce: () => {
+>produce : () => typeof globalThis
+> : ^^^^^^^^^^^^^^^^^^^^^^^
+>() => { return this; } : () => typeof globalThis
+> : ^^^^^^^^^^^^^^^^^^^^^^^
+
+ return this;
+>this : typeof globalThis
+> : ^^^^^^^^^^^^^^^^^
+
+ },
+});
+
+const result9 = defineOptions({
+>result9 : [{ tag: string; value: number; }, string]
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>defineOptions({ context: { tag: "I", value: 9 }, consume(_data) {}, produce() { const obj = { value: 'foo', get() { return this.value; }, }; return obj.get(); },}) : [{ tag: string; value: number; }, string]
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>defineOptions : (options: Options) => [Context, Data]
+> : ^ ^^ ^^ ^^ ^^^^^
+>{ context: { tag: "I", value: 9 }, consume(_data) {}, produce() { const obj = { value: 'foo', get() { return this.value; }, }; return obj.get(); },} : { context: { tag: string; value: number; }; consume(this: { tag: string; value: number; }, _data: string): void; produce(): string; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ context: { tag: "I", value: 9 },
+>context : { tag: string; value: number; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>{ tag: "I", value: 9 } : { tag: string; value: number; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>tag : string
+> : ^^^^^^
+>"I" : "I"
+> : ^^^
+>value : number
+> : ^^^^^^
+>9 : 9
+> : ^
+
+ consume(_data) {},
+>consume : (this: { tag: string; value: number; }, _data: string) => void
+> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^
+>_data : string
+> : ^^^^^^
+
+ produce() {
+>produce : () => string
+> : ^^^^^^^^^^^^
+
+ const obj = {
+>obj : { value: string; get(): string; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>{ value: 'foo', get() { return this.value; }, } : { value: string; get(): string; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ value: 'foo',
+>value : string
+> : ^^^^^^
+>'foo' : "foo"
+> : ^^^^^
+
+ get() {
+>get : () => string
+> : ^^^^^^^^^^^^
+
+ return this.value;
+>this.value : string
+> : ^^^^^^
+>this : { value: string; get(): string; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>value : string
+> : ^^^^^^
+
+ },
+ };
+ return obj.get();
+>obj.get() : string
+> : ^^^^^^
+>obj.get : () => string
+> : ^^^^^^^^^^^^
+>obj : { value: string; get(): string; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>get : () => string
+> : ^^^^^^^^^^^^
+
+ },
+});
+
+const result10 = defineOptions({
+>result10 : [{ tag: string; value: number; }, Foo]
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>defineOptions({ context: { tag: "I", value: 9 }, consume(_data) {}, produce() { interface Foo { prop: this; } return {} as Foo; },}) : [{ tag: string; value: number; }, Foo]
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>defineOptions : (options: Options) => [Context, Data]
+> : ^ ^^ ^^ ^^ ^^^^^
+>{ context: { tag: "I", value: 9 }, consume(_data) {}, produce() { interface Foo { prop: this; } return {} as Foo; },} : { context: { tag: string; value: number; }; consume(this: { tag: string; value: number; }, _data: Foo): void; produce(): Foo; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ context: { tag: "I", value: 9 },
+>context : { tag: string; value: number; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>{ tag: "I", value: 9 } : { tag: string; value: number; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>tag : string
+> : ^^^^^^
+>"I" : "I"
+> : ^^^
+>value : number
+> : ^^^^^^
+>9 : 9
+> : ^
+
+ consume(_data) {},
+>consume : (this: { tag: string; value: number; }, _data: Foo) => void
+> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^
+>_data : Foo
+> : ^^^
+
+ produce() {
+>produce : () => Foo
+> : ^^^^^^^^^
+
+ interface Foo {
+ prop: this;
+>prop : this
+> : ^^^^
+ }
+ return {} as Foo;
+>{} as Foo : Foo
+> : ^^^
+>{} : {}
+> : ^^
+
+ },
+});
+
+const result11 = defineOptions({
+>result11 : [{ tag: string; value: number; }, (this: { prop: string; }) => string]
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^^^^^^^^^^
+>defineOptions({ context: { tag: "I", value: 9 }, consume(_data) {}, produce() { function fn(this: { prop: string }) { return this.prop; } return fn; },}) : [{ tag: string; value: number; }, (this: { prop: string; }) => string]
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^^^^^^^^^^
+>defineOptions : (options: Options) => [Context, Data]
+> : ^ ^^ ^^ ^^ ^^^^^
+>{ context: { tag: "I", value: 9 }, consume(_data) {}, produce() { function fn(this: { prop: string }) { return this.prop; } return fn; },} : { context: { tag: string; value: number; }; consume(this: { tag: string; value: number; }, _data: (this: { prop: string; }) => string): void; produce(): (this: { prop: string; }) => string; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^^^^^^^^^^^^
+
+ context: { tag: "I", value: 9 },
+>context : { tag: string; value: number; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>{ tag: "I", value: 9 } : { tag: string; value: number; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>tag : string
+> : ^^^^^^
+>"I" : "I"
+> : ^^^
+>value : number
+> : ^^^^^^
+>9 : 9
+> : ^
+
+ consume(_data) {},
+>consume : (this: { tag: string; value: number; }, _data: (this: { prop: string; }) => string) => void
+> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^ ^^^^^^^^^^^^^^^^^^^^
+>_data : (this: { prop: string; }) => string
+> : ^ ^^ ^^^^^^^^^^^
+
+ produce() {
+>produce : () => (this: { prop: string; }) => string
+> : ^^^^^^^ ^^ ^^^^^^^^^^^
+
+ function fn(this: { prop: string }) {
+>fn : (this: { prop: string; }) => string
+> : ^ ^^ ^^^^^^^^^^^
+>this : { prop: string; }
+> : ^^^^^^^^ ^^^
+>prop : string
+> : ^^^^^^
+
+ return this.prop;
+>this.prop : string
+> : ^^^^^^
+>this : { prop: string; }
+> : ^^^^^^^^ ^^^
+>prop : string
+> : ^^^^^^
+ }
+ return fn;
+>fn : (this: { prop: string; }) => string
+> : ^ ^^ ^^^^^^^^^^^
+
+ },
+});
+
diff --git a/tests/baselines/reference/vueLikeDataAndPropsInference.types b/tests/baselines/reference/vueLikeDataAndPropsInference.types
index f71eba5d8bf66..84cb8efb7b79c 100644
--- a/tests/baselines/reference/vueLikeDataAndPropsInference.types
+++ b/tests/baselines/reference/vueLikeDataAndPropsInference.types
@@ -72,8 +72,8 @@ test({
> : ^^^^
>test : { (fn: ThisTypedOptions): void; (fn: Options): void; }
> : ^^^ ^^ ^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^
->{ props: { foo: '' }, data(): { bar: boolean } { return { bar: true } }, watch: { foo(newVal: string, oldVal: string): void { this.bar = false } }} : { props: { foo: string; }; data(this: Readonly<{ foo: string; }> & Instance): { bar: boolean; }; watch: { foo(newVal: string, oldVal: string): void; }; }
-> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ ^^ ^^ ^^ ^^^ ^^^^^^
+>{ props: { foo: '' }, data(): { bar: boolean } { return { bar: true } }, watch: { foo(newVal: string, oldVal: string): void { this.bar = false } }} : { props: { foo: string; }; data(): { bar: boolean; }; watch: { foo(newVal: string, oldVal: string): void; }; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ ^^ ^^ ^^ ^^^ ^^^^^^
props: {
>props : { foo: string; }
@@ -90,8 +90,8 @@ test({
},
data(): { bar: boolean } {
->data : (this: Readonly<{ foo: string; }> & Instance) => { bar: boolean; }
-> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>data : () => { bar: boolean; }
+> : ^^^^^^
>bar : boolean
> : ^^^^^^^
diff --git a/tests/baselines/reference/vueLikeDataAndPropsInference2.types b/tests/baselines/reference/vueLikeDataAndPropsInference2.types
index 206646398de17..ffacfe540217f 100644
--- a/tests/baselines/reference/vueLikeDataAndPropsInference2.types
+++ b/tests/baselines/reference/vueLikeDataAndPropsInference2.types
@@ -73,8 +73,8 @@ test({
> : ^^^^
>test : { (fn: ThisTypedOptions): void; (fn: Options): void; }
> : ^^^ ^^ ^^ ^^ ^^^ ^^^ ^^ ^^^ ^^^
->{ props: { foo: '' }, data(): { bar: boolean } { return { bar: true } }, watch: { foo(newVal: string, oldVal: string): void { this.bar = false } }} : { props: { foo: string; }; data(this: Readonly<{ foo: string; }> & Instance): { bar: boolean; }; watch: { foo(newVal: string, oldVal: string): void; }; }
-> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ ^^ ^^ ^^ ^^^ ^^^^^^
+>{ props: { foo: '' }, data(): { bar: boolean } { return { bar: true } }, watch: { foo(newVal: string, oldVal: string): void { this.bar = false } }} : { props: { foo: string; }; data(): { bar: boolean; }; watch: { foo(newVal: string, oldVal: string): void; }; }
+> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ ^^ ^^ ^^ ^^^ ^^^^^^
props: {
>props : { foo: string; }
@@ -91,8 +91,8 @@ test({
},
data(): { bar: boolean } {
->data : (this: Readonly<{ foo: string; }> & Instance) => { bar: boolean; }
-> : ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+>data : () => { bar: boolean; }
+> : ^^^^^^
>bar : boolean
> : ^^^^^^^
diff --git a/tests/cases/compiler/thislessFunctionsNotContextSensitive1.ts b/tests/cases/compiler/thislessFunctionsNotContextSensitive1.ts
new file mode 100644
index 0000000000000..e1c340544e72c
--- /dev/null
+++ b/tests/cases/compiler/thislessFunctionsNotContextSensitive1.ts
@@ -0,0 +1,242 @@
+// @strict: true
+// @target: esnext
+// @noEmit: true
+
+// https://github.com/microsoft/TypeScript/issues/62204
+
+declare function TestConfig(
+ config: TConfig,
+ test: keyof Omit extends never ? true : false,
+): void;
+
+TestConfig(
+ {
+ a: "hello",
+ b: function () {
+ return 123;
+ },
+ },
+ true,
+);
+
+TestConfig(
+ {
+ a: "hello",
+ b: function () {
+ return 123;
+ },
+ },
+ false, // error
+);
+
+// https://github.com/microsoft/TypeScript/issues/60986
+interface SubscribeFieldOptions {
+ subscribe: () => Event;
+ resolve: (event: Event) => number;
+}
+
+declare function defineOptions(
+ options: SubscribeFieldOptions,
+): void;
+
+defineOptions({
+ resolve: (event) => event, // number
+ subscribe() {
+ return 123;
+ },
+});
+
+defineOptions({
+ resolve: (event) => event, // number
+ subscribe: function () {
+ return 123;
+ },
+});
+
+// https://github.com/microsoft/TypeScript/issues/58630
+
+export type StateFunction = (s: State, ...args: any[]) => any;
+
+export type VuexStoreOptions = {
+ state?: State | (() => State) | { (): State };
+ mutations?: Record>;
+ modules?: {
+ [k in keyof Modules]: VuexStoreOptions;
+ };
+};
+
+export function createStore<
+ State extends Record,
+ Modules extends Record>,
+>(options: VuexStoreOptions) {}
+
+const store = createStore({
+ state() {
+ return { bar2: 1 };
+ },
+ mutations: { inc: (state123) => state123.bar2++ },
+ modules: {
+ foo: {
+ state() {
+ return { bar2: 1 };
+ },
+ mutations: { inc: (state) => state.bar2++ },
+ },
+ },
+});
+
+// https://github.com/microsoft/TypeScript/issues/57572
+
+type C = void>(options: {
+ methods: Methods;
+ attached: Attached;
+}) => any;
+
+var Component: C = () => {};
+
+Component({
+ attached(methods) {
+ methods.bbb(); // ok
+ },
+ methods: {
+ bbb() {},
+ },
+});
+
+Component({
+ attached(methods) {
+ methods.bbb(); // ok
+ },
+ methods: {
+ bbb: () => {},
+ },
+});
+
+// https://github.com/microsoft/TypeScript/issues/56067
+
+declare function create56067<
+ State extends Record,
+ Data extends Record,
+ Actions extends (state: State, data: Data) => Record,
+>(args: { getState: () => State; actions: Actions; getData: () => Data }): void;
+
+create56067({
+ getState() {
+ return { a: 1 };
+ },
+ getData: () => {
+ return { b: 2 };
+ },
+ actions(state, data) {
+ state // { a: number }
+ data; // { b: number }
+ return {
+ z: 1,
+ };
+ },
+});
+
+// https://github.com/microsoft/TypeScript/issues/55489
+type NonStringIterable =
+ T extends string ? never : T extends Iterable ? T : never;
+
+declare function doSomething(value: NonStringIterable): T;
+
+const o = { foo() {} };
+
+doSomething('value'); // error
+doSomething(['v']); // ok
+doSomething([o]); // ok
+doSomething([{ foo() {} }]); // ok
+
+// https://github.com/microsoft/TypeScript/issues/55124
+type Values = T[keyof T];
+type ExtractFields = Values<{
+ [K in keyof Options]: Options[K] extends object ? keyof Options[K] : never;
+}>;
+type SetType = {
+ [key: string]: any;
+ target?: ExtractFields;
+};
+
+declare function test55124>(
+ options: OptionsData,
+): void;
+
+test55124({
+ target: "$test4", // ok
+ data1: {
+ $test1: 111,
+ $test2: null,
+ },
+ data2: {
+ $test3: {},
+ $test4: () => {},
+ $test5() {},
+ },
+});
+
+test55124({
+ target: "$test6", // error
+ data1: {
+ $test1: 111,
+ $test2: null,
+ },
+ data2: {
+ $test3: {},
+ $test4: () => {},
+ $test5() {},
+ },
+});
+
+// https://github.com/microsoft/TypeScript/issues/53924
+function test53924(options: { a: (c: T) => void; b: () => T }) {}
+
+test53924({
+ a: (c) => {
+ c; // number;
+ },
+ b: () => 123,
+});
+
+test53924({
+ b: () => 123,
+ a: (c) => {
+ return c; // number
+ },
+});
+
+test53924({
+ b() {
+ return 123;
+ },
+ a(c) {
+ return c; // number
+ },
+});
+
+test53924({
+ a(c) {
+ return c; // number
+ },
+ b() {
+ return 123;
+ },
+});
+
+// https://github.com/microsoft/TypeScript/issues/50258
+declare function monitor any>(
+ extractor: (...args: Parameters) => Record,
+ executor: T,
+): (...args: Parameters