diff --git a/internal/ast/utilities.go b/internal/ast/utilities.go index 2cc3520e9a9..fbc59d31bac 100644 --- a/internal/ast/utilities.go +++ b/internal/ast/utilities.go @@ -3969,7 +3969,7 @@ func HasContextSensitiveParameters(node *Node) bool { // an implicit 'this' parameter which is subject to contextual typing. parameter := core.FirstOrNil(node.Parameters()) if parameter == nil || !IsThisParameter(parameter) { - return true + return node.Flags&NodeFlagsContainsThis != 0 } } } diff --git a/internal/binder/binder.go b/internal/binder/binder.go index f44ff210738..187c8e6a840 100644 --- a/internal/binder/binder.go +++ b/internal/binder/binder.go @@ -39,6 +39,7 @@ const ( ContainerFlagsIsInterface ContainerFlags = 1 << 6 ContainerFlagsIsObjectLiteralOrClassExpressionMethodOrAccessor ContainerFlags = 1 << 7 ContainerFlagsIsThisContainer ContainerFlags = 1 << 8 + ContainerFlagsPropagatesThisKeyword ContainerFlags = 1 << 9 ) type ExpandoAssignmentInfo struct { @@ -615,6 +616,9 @@ func (b *Binder) bind(node *ast.Node) bool { node.AsIdentifier().FlowNode = b.currentFlow b.checkContextualIdentifier(node) case ast.KindThisKeyword, ast.KindSuperKeyword: + if node.Kind == ast.KindThisKeyword { + b.seenThisKeyword = true + } node.AsKeywordExpression().FlowNode = b.currentFlow case ast.KindQualifiedName: if b.currentFlow != nil && ast.IsPartOfTypeQuery(node) { @@ -1520,6 +1524,7 @@ func (b *Binder) bindContainer(node *ast.Node, containerFlags ContainerFlags) { saveExceptionTarget := b.currentExceptionTarget saveActiveLabelList := b.activeLabelList saveHasExplicitReturn := b.hasExplicitReturn + saveSeenThisKeyword := b.seenThisKeyword isImmediatelyInvoked := (containerFlags&ContainerFlagsIsFunctionExpression != 0 && !ast.HasSyntacticModifier(node, ast.ModifierFlagsAsync) && !isGeneratorFunctionExpression(node) && @@ -1545,9 +1550,10 @@ func (b *Binder) bindContainer(node *ast.Node, containerFlags ContainerFlags) { b.currentContinueTarget = nil b.activeLabelList = nil b.hasExplicitReturn = false + b.seenThisKeyword = false b.bindChildren(node) - // Reset all reachability check related flags on node (for incremental scenarios) - node.Flags &= ^ast.NodeFlagsReachabilityCheckFlags + // Reset flags (for incremental scenarios) + node.Flags &= ^(ast.NodeFlagsReachabilityCheckFlags | ast.NodeFlagsContainsThis) if b.currentFlow.Flags&ast.FlowFlagsUnreachable == 0 && containerFlags&ContainerFlagsIsFunctionLike != 0 { bodyData := node.BodyData() if bodyData != nil && ast.NodeIsPresent(bodyData.Body) { @@ -1558,11 +1564,13 @@ func (b *Binder) bindContainer(node *ast.Node, containerFlags ContainerFlags) { bodyData.EndFlowNode = b.currentFlow } } + if b.seenThisKeyword { + node.Flags |= ast.NodeFlagsContainsThis + } if node.Kind == ast.KindSourceFile { node.Flags |= b.emitFlags node.AsSourceFile().EndFlowNode = b.currentFlow } - if b.currentReturnTarget != nil { b.addAntecedent(b.currentReturnTarget, b.currentFlow) b.currentFlow = b.finishFlowLabel(b.currentReturnTarget) @@ -1579,7 +1587,13 @@ func (b *Binder) bindContainer(node *ast.Node, containerFlags ContainerFlags) { b.currentExceptionTarget = saveExceptionTarget b.activeLabelList = saveActiveLabelList b.hasExplicitReturn = saveHasExplicitReturn + if containerFlags&ContainerFlagsPropagatesThisKeyword != 0 { + b.seenThisKeyword = saveSeenThisKeyword || b.seenThisKeyword + } else { + b.seenThisKeyword = saveSeenThisKeyword + } } else if containerFlags&ContainerFlagsIsInterface != 0 { + saveSeenThisKeyword := b.seenThisKeyword b.seenThisKeyword = false b.bindChildren(node) // ContainsThis cannot overlap with HasExtendedUnicodeEscape on Identifier @@ -1588,6 +1602,7 @@ func (b *Binder) bindContainer(node *ast.Node, containerFlags ContainerFlags) { } else { node.Flags &= ^ast.NodeFlagsContainsThis } + b.seenThisKeyword = saveSeenThisKeyword } else { b.bindChildren(node) } @@ -2525,16 +2540,14 @@ func GetContainerFlags(node *ast.Node) ContainerFlags { return ContainerFlagsIsContainer | ContainerFlagsIsControlFlowContainer | ContainerFlagsHasLocals | ContainerFlagsIsFunctionLike | ContainerFlagsIsObjectLiteralOrClassExpressionMethodOrAccessor | ContainerFlagsIsThisContainer } fallthrough - case ast.KindConstructor, ast.KindClassStaticBlockDeclaration: + case ast.KindConstructor, ast.KindFunctionDeclaration, ast.KindClassStaticBlockDeclaration: return ContainerFlagsIsContainer | ContainerFlagsIsControlFlowContainer | ContainerFlagsHasLocals | ContainerFlagsIsFunctionLike | ContainerFlagsIsThisContainer case ast.KindMethodSignature, ast.KindCallSignature, ast.KindFunctionType, ast.KindConstructSignature, ast.KindConstructorType: - return ContainerFlagsIsContainer | ContainerFlagsIsControlFlowContainer | ContainerFlagsHasLocals | ContainerFlagsIsFunctionLike - case ast.KindFunctionDeclaration: - return ContainerFlagsIsContainer | ContainerFlagsIsControlFlowContainer | ContainerFlagsHasLocals | ContainerFlagsIsFunctionLike | ContainerFlagsIsThisContainer + return ContainerFlagsIsContainer | ContainerFlagsIsControlFlowContainer | ContainerFlagsHasLocals | ContainerFlagsIsFunctionLike | ContainerFlagsPropagatesThisKeyword case ast.KindFunctionExpression: return ContainerFlagsIsContainer | ContainerFlagsIsControlFlowContainer | ContainerFlagsHasLocals | ContainerFlagsIsFunctionLike | ContainerFlagsIsFunctionExpression | ContainerFlagsIsThisContainer case ast.KindArrowFunction: - return ContainerFlagsIsContainer | ContainerFlagsIsControlFlowContainer | ContainerFlagsHasLocals | ContainerFlagsIsFunctionLike | ContainerFlagsIsFunctionExpression + return ContainerFlagsIsContainer | ContainerFlagsIsControlFlowContainer | ContainerFlagsHasLocals | ContainerFlagsIsFunctionLike | ContainerFlagsIsFunctionExpression | ContainerFlagsPropagatesThisKeyword case ast.KindModuleBlock: return ContainerFlagsIsControlFlowContainer case ast.KindPropertyDeclaration: diff --git a/internal/checker/checker.go b/internal/checker/checker.go index 96d1b4a1574..75503d12790 100644 --- a/internal/checker/checker.go +++ b/internal/checker/checker.go @@ -19849,10 +19849,10 @@ func mayReturnNever(fn *ast.Node) bool { func (c *Checker) checkAndAggregateYieldOperandTypes(fn *ast.Node, checkMode CheckMode) (yieldTypes []*Type, nextTypes []*Type) { isAsync := (getFunctionFlags(fn) & FunctionFlagsAsync) != 0 - forEachYieldExpression(fn.Body(), func(yieldExpr *ast.Node) { + forEachYieldExpression(fn.Body(), func(yieldExpr *ast.Node) bool { yieldExprType := c.undefinedWideningType if yieldExpr.Expression() != nil { - yieldExprType = c.checkExpressionEx(yieldExpr.Expression(), checkMode) + yieldExprType = c.checkExpressionEx(yieldExpr.Expression(), checkMode & ^CheckModeSkipGenericFunctions) } if yieldExpr.Expression() != nil && c.isConstContext(yieldExpr.Expression()) { yieldExprType = c.getRegularTypeOfLiteralType(yieldExprType) @@ -19868,6 +19868,7 @@ func (c *Checker) checkAndAggregateYieldOperandTypes(fn *ast.Node, checkMode Che if nextType != nil { nextTypes = core.AppendIfUnique(nextTypes, nextType) } + return false }) return yieldTypes, nextTypes } @@ -29953,7 +29954,10 @@ func (c *Checker) instantiateContextualType(contextualType *Type, node *ast.Node if contextFlags&ContextFlagsSignature != 0 && core.Some(inferenceContext.inferences, hasInferenceCandidatesOrDefault) { // For contextual signatures we incorporate all inferences made so far, e.g. from return // types as well as arguments to the left in a function call. - return c.instantiateInstantiableTypes(contextualType, inferenceContext.nonFixingMapper) + t := c.instantiateInstantiableTypes(contextualType, inferenceContext.nonFixingMapper) + if t.flags&TypeFlagsAnyOrUnknown == 0 { + return t + } } if inferenceContext.returnMapper != nil { // For other purposes (e.g. determining whether to produce literal types) we only @@ -29961,12 +29965,14 @@ func (c *Checker) instantiateContextualType(contextualType *Type, node *ast.Node // the 'boolean' type from the contextual type such that contextually typed boolean // literals actually end up widening to 'boolean' (see #48363). t := c.instantiateInstantiableTypes(contextualType, inferenceContext.returnMapper) - if t.flags&TypeFlagsUnion != 0 && containsType(t.Types(), c.regularFalseType) && containsType(t.Types(), c.regularTrueType) { - return c.filterType(t, func(t *Type) bool { - return t != c.regularFalseType && t != c.regularTrueType - }) + if t.flags&TypeFlagsAnyOrUnknown == 0 { + if t.flags&TypeFlagsUnion != 0 && containsType(t.Types(), c.regularFalseType) && containsType(t.Types(), c.regularTrueType) { + return c.filterType(t, func(t *Type) bool { + return t != c.regularFalseType && t != c.regularTrueType + }) + } + return t } - return t } } } @@ -30045,12 +30051,15 @@ func (c *Checker) isContextSensitive(node *ast.Node) bool { // It is possible to that node.expression is undefined (e.g
) expression := node.Expression() return expression != nil && c.isContextSensitive(expression) + case ast.KindYieldExpression: + expression := node.Expression() + return expression != nil && c.isContextSensitive(expression) } return false } func (c *Checker) isContextSensitiveFunctionLikeDeclaration(node *ast.Node) bool { - return ast.HasContextSensitiveParameters(node) || c.hasContextSensitiveReturnExpression(node) + return ast.HasContextSensitiveParameters(node) || c.hasContextSensitiveReturnExpression(node) || c.hasContextSensitiveYieldExpression(node) } func (c *Checker) hasContextSensitiveReturnExpression(node *ast.Node) bool { @@ -30069,6 +30078,10 @@ func (c *Checker) hasContextSensitiveReturnExpression(node *ast.Node) bool { }) } +func (c *Checker) hasContextSensitiveYieldExpression(node *ast.Node) bool { + return getFunctionFlags(node)&FunctionFlagsGenerator != 0 && node.Body() != nil && forEachYieldExpression(node.Body(), c.isContextSensitive) +} + func (c *Checker) pushInferenceContext(node *ast.Node, context *InferenceContext) { c.inferenceContextInfos = append(c.inferenceContextInfos, InferenceContextInfo{node, context}) } diff --git a/internal/checker/utilities.go b/internal/checker/utilities.go index 41c4901e661..873b1f76d23 100644 --- a/internal/checker/utilities.go +++ b/internal/checker/utilities.go @@ -1195,16 +1195,19 @@ func getSuperContainer(node *ast.Node, stopOnFunctions bool) *ast.Node { } } -func forEachYieldExpression(body *ast.Node, visitor func(expr *ast.Node)) { +func forEachYieldExpression(body *ast.Node, visitor func(expr *ast.Node) bool) bool { var traverse func(*ast.Node) bool traverse = func(node *ast.Node) bool { switch node.Kind { case ast.KindYieldExpression: - visitor(node) + if visitor(node) { + return true + } operand := node.Expression() - if operand != nil { - traverse(operand) + if operand == nil { + return false } + return traverse(operand) case ast.KindEnumDeclaration, ast.KindInterfaceDeclaration, ast.KindModuleDeclaration, ast.KindTypeAliasDeclaration: // These are not allowed inside a generator now, but eventually they may be allowed // as local types. Regardless, skip them to avoid the work. @@ -1213,17 +1216,17 @@ func forEachYieldExpression(body *ast.Node, visitor func(expr *ast.Node)) { if node.Name() != nil && ast.IsComputedPropertyName(node.Name()) { // 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 traverse(node.Name().Expression()) } } else if !ast.IsPartOfTypeNode(node) { // This is the general case, which should include mostly expressions and statements. // Also includes NodeArrays. - node.ForEachChild(traverse) + return node.ForEachChild(traverse) } } return false } - traverse(body) + return traverse(body) } func getEnclosingContainer(node *ast.Node) *ast.Node { diff --git a/testdata/baselines/reference/submodule/compiler/circularlySimplifyingConditionalTypesNoCrash.types b/testdata/baselines/reference/submodule/compiler/circularlySimplifyingConditionalTypesNoCrash.types index 69f8bc39df0..8179ec3240b 100644 --- a/testdata/baselines/reference/submodule/compiler/circularlySimplifyingConditionalTypesNoCrash.types +++ b/testdata/baselines/reference/submodule/compiler/circularlySimplifyingConditionalTypesNoCrash.types @@ -56,7 +56,7 @@ 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/testdata/baselines/reference/submodule/compiler/circularlySimplifyingConditionalTypesNoCrash.types.diff b/testdata/baselines/reference/submodule/compiler/circularlySimplifyingConditionalTypesNoCrash.types.diff deleted file mode 100644 index 345bfd9a479..00000000000 --- a/testdata/baselines/reference/submodule/compiler/circularlySimplifyingConditionalTypesNoCrash.types.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.circularlySimplifyingConditionalTypesNoCrash.types -+++ new.circularlySimplifyingConditionalTypesNoCrash.types -@@= skipped -55, +55 lines =@@ - - 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 \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/genericCallAtYieldExpressionInGenericCall1.errors.txt b/testdata/baselines/reference/submodule/compiler/genericCallAtYieldExpressionInGenericCall1.errors.txt index 9322654c015..7462751ad1a 100644 --- a/testdata/baselines/reference/submodule/compiler/genericCallAtYieldExpressionInGenericCall1.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/genericCallAtYieldExpressionInGenericCall1.errors.txt @@ -1,15 +1,11 @@ -genericCallAtYieldExpressionInGenericCall1.ts(13,25): error TS2488: Type 'never' must have a '[Symbol.iterator]()' method that returns an iterator. genericCallAtYieldExpressionInGenericCall1.ts(26,25): error TS2488: Type '() => T' must have a '[Symbol.iterator]()' method that returns an iterator. -genericCallAtYieldExpressionInGenericCall1.ts(26,25): error TS2488: Type 'never' must have a '[Symbol.iterator]()' method that returns an iterator. -genericCallAtYieldExpressionInGenericCall1.ts(42,10): error TS2488: Type 'never' must have a '[Symbol.iterator]()' method that returns an iterator. -genericCallAtYieldExpressionInGenericCall1.ts(56,8): error TS2345: Argument of type '(value: T) => Generator' is not assignable to parameter of type '(value: unknown) => Generator'. - Type 'Generator' is not assignable to type 'Generator'. +genericCallAtYieldExpressionInGenericCall1.ts(56,8): error TS2345: Argument of type '(value: T) => Generator' is not assignable to parameter of type '(value: unknown) => Generator'. + Type 'Generator' is not assignable to type 'Generator'. The types returned by 'next(...)' are incompatible between these types. - Type 'IteratorResult' is not assignable to type 'IteratorResult'. - Type 'IteratorYieldResult' is not assignable to type 'IteratorResult'. - Type 'IteratorYieldResult' is not assignable to type 'IteratorYieldResult'. - Type 'any' is not assignable to type 'never'. -genericCallAtYieldExpressionInGenericCall1.ts(57,10): error TS2488: Type 'never' must have a '[Symbol.iterator]()' method that returns an iterator. + Type 'IteratorResult' is not assignable to type 'IteratorResult'. + Type 'IteratorYieldResult' is not assignable to type 'IteratorResult'. + Type 'IteratorYieldResult' is not assignable to type 'IteratorYieldResult'. + Type 'number' is not assignable to type 'never'. genericCallAtYieldExpressionInGenericCall1.ts(61,8): error TS2345: Argument of type '(value: T) => Generator' is not assignable to parameter of type '(value: unknown) => Generator'. Type 'Generator' is not assignable to type 'Generator'. The types returned by 'next(...)' are incompatible between these types. @@ -19,7 +15,7 @@ genericCallAtYieldExpressionInGenericCall1.ts(61,8): error TS2345: Argument of t Type 'number' is not assignable to type 'never'. -==== genericCallAtYieldExpressionInGenericCall1.ts (7 errors) ==== +==== genericCallAtYieldExpressionInGenericCall1.ts (3 errors) ==== declare const inner: { (value: A): { (): A; @@ -33,8 +29,6 @@ genericCallAtYieldExpressionInGenericCall1.ts(61,8): error TS2345: Argument of t outer(function* (value: T) { const result = yield* inner(value); // ok - ~~~~~~~~~~~~ -!!! error TS2488: Type 'never' must have a '[Symbol.iterator]()' method that returns an iterator. }); outer(function* (value: T) { @@ -50,8 +44,6 @@ genericCallAtYieldExpressionInGenericCall1.ts(61,8): error TS2345: Argument of t const result = yield* inner2(value); // error ~~~~~~~~~~~~~ !!! error TS2488: Type '() => T' must have a '[Symbol.iterator]()' method that returns an iterator. - ~~~~~~~~~~~~~ -!!! error TS2488: Type 'never' must have a '[Symbol.iterator]()' method that returns an iterator. }); declare const inner3: { @@ -68,8 +60,6 @@ genericCallAtYieldExpressionInGenericCall1.ts(61,8): error TS2345: Argument of t // number const result1 = outer2(function* (value: T) { yield* inner3(value); - ~~~~~~~~~~~~~ -!!! error TS2488: Type 'never' must have a '[Symbol.iterator]()' method that returns an iterator. }); // number @@ -85,16 +75,14 @@ genericCallAtYieldExpressionInGenericCall1.ts(61,8): error TS2345: Argument of t // error outer3(function* (value: T) { ~~~~~~~~ -!!! error TS2345: Argument of type '(value: T) => Generator' is not assignable to parameter of type '(value: unknown) => Generator'. -!!! error TS2345: Type 'Generator' is not assignable to type 'Generator'. +!!! error TS2345: Argument of type '(value: T) => Generator' is not assignable to parameter of type '(value: unknown) => Generator'. +!!! error TS2345: Type 'Generator' is not assignable to type 'Generator'. !!! error TS2345: The types returned by 'next(...)' are incompatible between these types. -!!! error TS2345: Type 'IteratorResult' is not assignable to type 'IteratorResult'. -!!! error TS2345: Type 'IteratorYieldResult' is not assignable to type 'IteratorResult'. -!!! error TS2345: Type 'IteratorYieldResult' is not assignable to type 'IteratorYieldResult'. -!!! error TS2345: Type 'any' is not assignable to type 'never'. +!!! error TS2345: Type 'IteratorResult' is not assignable to type 'IteratorResult'. +!!! error TS2345: Type 'IteratorYieldResult' is not assignable to type 'IteratorResult'. +!!! error TS2345: Type 'IteratorYieldResult' is not assignable to type 'IteratorYieldResult'. +!!! error TS2345: Type 'number' is not assignable to type 'never'. yield* inner3(value); - ~~~~~~~~~~~~~ -!!! error TS2488: Type 'never' must have a '[Symbol.iterator]()' method that returns an iterator. }); // error diff --git a/testdata/baselines/reference/submodule/compiler/genericCallAtYieldExpressionInGenericCall1.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/genericCallAtYieldExpressionInGenericCall1.errors.txt.diff index b376a093e62..dd9c3f3c8ff 100644 --- a/testdata/baselines/reference/submodule/compiler/genericCallAtYieldExpressionInGenericCall1.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/genericCallAtYieldExpressionInGenericCall1.errors.txt.diff @@ -1,89 +1,31 @@ --- old.genericCallAtYieldExpressionInGenericCall1.errors.txt +++ new.genericCallAtYieldExpressionInGenericCall1.errors.txt @@= skipped -0, +0 lines =@@ -+genericCallAtYieldExpressionInGenericCall1.ts(13,25): error TS2488: Type 'never' must have a '[Symbol.iterator]()' method that returns an iterator. genericCallAtYieldExpressionInGenericCall1.ts(26,25): error TS2488: Type '() => T' must have a '[Symbol.iterator]()' method that returns an iterator. --genericCallAtYieldExpressionInGenericCall1.ts(56,8): error TS2345: Argument of type '(value: T) => Generator' is not assignable to parameter of type '(value: unknown) => Generator'. + genericCallAtYieldExpressionInGenericCall1.ts(56,8): error TS2345: Argument of type '(value: T) => Generator' is not assignable to parameter of type '(value: unknown) => Generator'. - Call signature return types 'Generator' and 'Generator' are incompatible. -+genericCallAtYieldExpressionInGenericCall1.ts(26,25): error TS2488: Type 'never' must have a '[Symbol.iterator]()' method that returns an iterator. -+genericCallAtYieldExpressionInGenericCall1.ts(42,10): error TS2488: Type 'never' must have a '[Symbol.iterator]()' method that returns an iterator. -+genericCallAtYieldExpressionInGenericCall1.ts(56,8): error TS2345: Argument of type '(value: T) => Generator' is not assignable to parameter of type '(value: unknown) => Generator'. -+ Type 'Generator' is not assignable to type 'Generator'. ++ Type 'Generator' is not assignable to type 'Generator'. The types returned by 'next(...)' are incompatible between these types. -- Type 'IteratorResult' is not assignable to type 'IteratorResult'. -- Type 'IteratorYieldResult' is not assignable to type 'IteratorResult'. -- Type 'IteratorYieldResult' is not assignable to type 'IteratorYieldResult'. -- Type 'number' is not assignable to type 'never'. -+ Type 'IteratorResult' is not assignable to type 'IteratorResult'. -+ Type 'IteratorYieldResult' is not assignable to type 'IteratorResult'. -+ Type 'IteratorYieldResult' is not assignable to type 'IteratorYieldResult'. -+ Type 'any' is not assignable to type 'never'. -+genericCallAtYieldExpressionInGenericCall1.ts(57,10): error TS2488: Type 'never' must have a '[Symbol.iterator]()' method that returns an iterator. + Type 'IteratorResult' is not assignable to type 'IteratorResult'. + Type 'IteratorYieldResult' is not assignable to type 'IteratorResult'. + Type 'IteratorYieldResult' is not assignable to type 'IteratorYieldResult'. + Type 'number' is not assignable to type 'never'. genericCallAtYieldExpressionInGenericCall1.ts(61,8): error TS2345: Argument of type '(value: T) => Generator' is not assignable to parameter of type '(value: unknown) => Generator'. - Call signature return types 'Generator' and 'Generator' are incompatible. + Type 'Generator' is not assignable to type 'Generator'. The types returned by 'next(...)' are incompatible between these types. Type 'IteratorResult' is not assignable to type 'IteratorResult'. Type 'IteratorYieldResult' is not assignable to type 'IteratorResult'. -@@= skipped -14, +18 lines =@@ - Type 'number' is not assignable to type 'never'. - - --==== genericCallAtYieldExpressionInGenericCall1.ts (3 errors) ==== -+==== genericCallAtYieldExpressionInGenericCall1.ts (7 errors) ==== - declare const inner: { - (value: A): { - (): A; -@@= skipped -14, +14 lines =@@ - - outer(function* (value: T) { - const result = yield* inner(value); // ok -+ ~~~~~~~~~~~~ -+!!! error TS2488: Type 'never' must have a '[Symbol.iterator]()' method that returns an iterator. - }); - - outer(function* (value: T) { -@@= skipped -15, +17 lines =@@ - const result = yield* inner2(value); // error - ~~~~~~~~~~~~~ - !!! error TS2488: Type '() => T' must have a '[Symbol.iterator]()' method that returns an iterator. -+ ~~~~~~~~~~~~~ -+!!! error TS2488: Type 'never' must have a '[Symbol.iterator]()' method that returns an iterator. - }); - - declare const inner3: { -@@= skipped -16, +18 lines =@@ - // number - const result1 = outer2(function* (value: T) { - yield* inner3(value); -+ ~~~~~~~~~~~~~ -+!!! error TS2488: Type 'never' must have a '[Symbol.iterator]()' method that returns an iterator. - }); - - // number -@@= skipped -15, +17 lines =@@ - // error +@@= skipped -75, +75 lines =@@ outer3(function* (value: T) { ~~~~~~~~ --!!! error TS2345: Argument of type '(value: T) => Generator' is not assignable to parameter of type '(value: unknown) => Generator'. + !!! error TS2345: Argument of type '(value: T) => Generator' is not assignable to parameter of type '(value: unknown) => Generator'. -!!! error TS2345: Call signature return types 'Generator' and 'Generator' are incompatible. -+!!! error TS2345: Argument of type '(value: T) => Generator' is not assignable to parameter of type '(value: unknown) => Generator'. -+!!! error TS2345: Type 'Generator' is not assignable to type 'Generator'. ++!!! error TS2345: Type 'Generator' is not assignable to type 'Generator'. !!! error TS2345: The types returned by 'next(...)' are incompatible between these types. --!!! error TS2345: Type 'IteratorResult' is not assignable to type 'IteratorResult'. --!!! error TS2345: Type 'IteratorYieldResult' is not assignable to type 'IteratorResult'. --!!! error TS2345: Type 'IteratorYieldResult' is not assignable to type 'IteratorYieldResult'. --!!! error TS2345: Type 'number' is not assignable to type 'never'. -+!!! error TS2345: Type 'IteratorResult' is not assignable to type 'IteratorResult'. -+!!! error TS2345: Type 'IteratorYieldResult' is not assignable to type 'IteratorResult'. -+!!! error TS2345: Type 'IteratorYieldResult' is not assignable to type 'IteratorYieldResult'. -+!!! error TS2345: Type 'any' is not assignable to type 'never'. - yield* inner3(value); -+ ~~~~~~~~~~~~~ -+!!! error TS2488: Type 'never' must have a '[Symbol.iterator]()' method that returns an iterator. - }); - - // error + !!! error TS2345: Type 'IteratorResult' is not assignable to type 'IteratorResult'. + !!! error TS2345: Type 'IteratorYieldResult' is not assignable to type 'IteratorResult'. +@@= skipped -13, +13 lines =@@ outer3(function* (value: T) { ~~~~~~~~ !!! error TS2345: Argument of type '(value: T) => Generator' is not assignable to parameter of type '(value: unknown) => Generator'. diff --git a/testdata/baselines/reference/submodule/compiler/genericCallAtYieldExpressionInGenericCall1.types b/testdata/baselines/reference/submodule/compiler/genericCallAtYieldExpressionInGenericCall1.types index d30d2bde20d..fc23bf05152 100644 --- a/testdata/baselines/reference/submodule/compiler/genericCallAtYieldExpressionInGenericCall1.types +++ b/testdata/baselines/reference/submodule/compiler/genericCallAtYieldExpressionInGenericCall1.types @@ -112,10 +112,10 @@ declare function outer2(body: (value: A) => Generator): Y; // number const result1 = outer2(function* (value: T) { ->result1 : any ->outer2(function* (value: T) { yield* inner3(value);}) : any +>result1 : number +>outer2(function* (value: T) { yield* inner3(value);}) : number >outer2 : (body: (value: A) => Generator) => Y ->function* (value: T) { yield* inner3(value);} : (value: T) => Generator +>function* (value: T) { yield* inner3(value);} : (value: T) => Generator >value : T yield* inner3(value); @@ -159,7 +159,7 @@ declare function outer3( outer3(function* (value: T) { >outer3(function* (value: T) { yield* inner3(value);}) : void >outer3 : (body: (value: A) => Generator) => void ->function* (value: T) { yield* inner3(value);} : (value: T) => Generator +>function* (value: T) { yield* inner3(value);} : (value: T) => Generator >value : T yield* inner3(value); diff --git a/testdata/baselines/reference/submodule/compiler/genericCallAtYieldExpressionInGenericCall1.types.diff b/testdata/baselines/reference/submodule/compiler/genericCallAtYieldExpressionInGenericCall1.types.diff index 8ca6f4b25ba..52406099d64 100644 --- a/testdata/baselines/reference/submodule/compiler/genericCallAtYieldExpressionInGenericCall1.types.diff +++ b/testdata/baselines/reference/submodule/compiler/genericCallAtYieldExpressionInGenericCall1.types.diff @@ -79,18 +79,7 @@ >args : readonly any[] }; -@@= skipped -27, +27 lines =@@ - - // number - const result1 = outer2(function* (value: T) { -->result1 : number -->outer2(function* (value: T) { yield* inner3(value);}) : number -+>result1 : any -+>outer2(function* (value: T) { yield* inner3(value);}) : any - >outer2 : (body: (value: A) => Generator) => Y -->function* (value: T) { yield* inner3(value);} : (value: T) => Generator -+>function* (value: T) { yield* inner3(value);} : (value: T) => Generator - >value : T +@@= skipped -35, +35 lines =@@ yield* inner3(value); >yield* inner3(value) : T @@ -101,7 +90,7 @@ >value : T }); -@@= skipped -23, +23 lines =@@ +@@= skipped -15, +15 lines =@@ >value : T const x = inner3(value); @@ -120,13 +109,7 @@ }); -@@= skipped -24, +24 lines =@@ - outer3(function* (value: T) { - >outer3(function* (value: T) { yield* inner3(value);}) : void - >outer3 : (body: (value: A) => Generator) => void -->function* (value: T) { yield* inner3(value);} : (value: T) => Generator -+>function* (value: T) { yield* inner3(value);} : (value: T) => Generator - >value : T +@@= skipped -29, +29 lines =@@ yield* inner3(value); >yield* inner3(value) : T @@ -137,7 +120,7 @@ >value : T }); -@@= skipped -19, +19 lines =@@ +@@= skipped -14, +14 lines =@@ >value : T const x = inner3(value); diff --git a/testdata/baselines/reference/submodule/compiler/genericCallAtYieldExpressionInGenericCall2.errors.txt b/testdata/baselines/reference/submodule/compiler/genericCallAtYieldExpressionInGenericCall2.errors.txt deleted file mode 100644 index da5db184e7e..00000000000 --- a/testdata/baselines/reference/submodule/compiler/genericCallAtYieldExpressionInGenericCall2.errors.txt +++ /dev/null @@ -1,34 +0,0 @@ -genericCallAtYieldExpressionInGenericCall2.ts(21,10): error TS2488: Type 'never' must have a '[Symbol.iterator]()' method that returns an iterator. - - -==== genericCallAtYieldExpressionInGenericCall2.ts (1 errors) ==== - interface Effect { - [Symbol.iterator](): { - next(...args: ReadonlyArray): IteratorResult; - }; - } - - interface Enqueue { - offer: (value: A) => Effect; - } - - declare const offer: { - (value: A): (self: Enqueue) => Effect; - (self: Enqueue, value: A): Effect; - }; - - declare function fn>( - body: (...args: Args) => Generator, - ): (...args: Args) => any; - - fn(function* (queue: Enqueue, value: T) { - yield* offer(queue, value); - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2488: Type 'never' must have a '[Symbol.iterator]()' method that returns an iterator. - }); - - fn(function* (queue: Enqueue, value: T) { - const x = offer(queue, value); - yield* x; - }); - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/genericCallAtYieldExpressionInGenericCall2.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/genericCallAtYieldExpressionInGenericCall2.errors.txt.diff deleted file mode 100644 index a754dea615b..00000000000 --- a/testdata/baselines/reference/submodule/compiler/genericCallAtYieldExpressionInGenericCall2.errors.txt.diff +++ /dev/null @@ -1,38 +0,0 @@ ---- old.genericCallAtYieldExpressionInGenericCall2.errors.txt -+++ new.genericCallAtYieldExpressionInGenericCall2.errors.txt -@@= skipped -0, +0 lines =@@ -- -+genericCallAtYieldExpressionInGenericCall2.ts(21,10): error TS2488: Type 'never' must have a '[Symbol.iterator]()' method that returns an iterator. -+ -+ -+==== genericCallAtYieldExpressionInGenericCall2.ts (1 errors) ==== -+ interface Effect { -+ [Symbol.iterator](): { -+ next(...args: ReadonlyArray): IteratorResult; -+ }; -+ } -+ -+ interface Enqueue { -+ offer: (value: A) => Effect; -+ } -+ -+ declare const offer: { -+ (value: A): (self: Enqueue) => Effect; -+ (self: Enqueue, value: A): Effect; -+ }; -+ -+ declare function fn>( -+ body: (...args: Args) => Generator, -+ ): (...args: Args) => any; -+ -+ fn(function* (queue: Enqueue, value: T) { -+ yield* offer(queue, value); -+ ~~~~~~~~~~~~~~~~~~~ -+!!! error TS2488: Type 'never' must have a '[Symbol.iterator]()' method that returns an iterator. -+ }); -+ -+ fn(function* (queue: Enqueue, value: T) { -+ const x = offer(queue, value); -+ yield* x; -+ }); -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/redefineArray.errors.txt b/testdata/baselines/reference/submodule/compiler/redefineArray.errors.txt index 87a448e677a..b831151ee79 100644 --- a/testdata/baselines/reference/submodule/compiler/redefineArray.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/redefineArray.errors.txt @@ -1,7 +1,7 @@ -redefineArray.ts(1,1): error TS2739: Type '(n: number, s: string) => number' is missing the following properties from type 'ArrayConstructor': isArray, from, of, [Symbol.species] +redefineArray.ts(1,1): error TS2739: Type '(n: number, s: string) => number' is missing the following properties from type 'ArrayConstructor': isArray, from, of, [Symbol.species] ==== redefineArray.ts (1 errors) ==== Array = function (n:number, s:string) {return n;}; ~~~~~ -!!! error TS2739: Type '(n: number, s: string) => number' is missing the following properties from type 'ArrayConstructor': isArray, from, of, [Symbol.species] \ No newline at end of file +!!! error TS2739: Type '(n: number, s: string) => number' is missing the following properties from type 'ArrayConstructor': isArray, from, of, [Symbol.species] \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/redefineArray.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/redefineArray.errors.txt.diff deleted file mode 100644 index 6bbd534f5df..00000000000 --- a/testdata/baselines/reference/submodule/compiler/redefineArray.errors.txt.diff +++ /dev/null @@ -1,12 +0,0 @@ ---- old.redefineArray.errors.txt -+++ new.redefineArray.errors.txt -@@= skipped -0, +0 lines =@@ --redefineArray.ts(1,1): error TS2739: Type '(n: number, s: string) => number' is missing the following properties from type 'ArrayConstructor': isArray, from, of, [Symbol.species] -+redefineArray.ts(1,1): error TS2739: Type '(n: number, s: string) => number' is missing the following properties from type 'ArrayConstructor': isArray, from, of, [Symbol.species] - - - ==== redefineArray.ts (1 errors) ==== - Array = function (n:number, s:string) {return n;}; - ~~~~~ --!!! error TS2739: Type '(n: number, s: string) => number' is missing the following properties from type 'ArrayConstructor': isArray, from, of, [Symbol.species] -+!!! error TS2739: Type '(n: number, s: string) => number' is missing the following properties from type 'ArrayConstructor': isArray, from, of, [Symbol.species] \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/redefineArray.types b/testdata/baselines/reference/submodule/compiler/redefineArray.types index e62f5031a7d..97dda4676b3 100644 --- a/testdata/baselines/reference/submodule/compiler/redefineArray.types +++ b/testdata/baselines/reference/submodule/compiler/redefineArray.types @@ -2,9 +2,9 @@ === 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 >n : number diff --git a/testdata/baselines/reference/submodule/compiler/redefineArray.types.diff b/testdata/baselines/reference/submodule/compiler/redefineArray.types.diff deleted file mode 100644 index b4b31301f56..00000000000 --- a/testdata/baselines/reference/submodule/compiler/redefineArray.types.diff +++ /dev/null @@ -1,14 +0,0 @@ ---- old.redefineArray.types -+++ new.redefineArray.types -@@= skipped -1, +1 lines =@@ - - === 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 - >n : number \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/returnTypeInferenceContextualTypeIgnoreAnyUnknown1.errors.txt b/testdata/baselines/reference/submodule/compiler/returnTypeInferenceContextualTypeIgnoreAnyUnknown1.errors.txt deleted file mode 100644 index f30e3c066a2..00000000000 --- a/testdata/baselines/reference/submodule/compiler/returnTypeInferenceContextualTypeIgnoreAnyUnknown1.errors.txt +++ /dev/null @@ -1,36 +0,0 @@ -returnTypeInferenceContextualTypeIgnoreAnyUnknown1.ts(9,17): error TS7006: Parameter 'arg' implicitly has an 'any' type. -returnTypeInferenceContextualTypeIgnoreAnyUnknown1.ts(21,17): error TS7006: Parameter 'arg' implicitly has an 'any' type. - - -==== returnTypeInferenceContextualTypeIgnoreAnyUnknown1.ts (2 errors) ==== - declare function outer1(arg: { prop: any }): void; - declare function outer2(arg: { prop: unknown }): void; - - declare function inner1 any>(arg: T): T; - - const result1 = inner1((arg) => arg); - - outer1({ - prop: inner1((arg) => arg), - ~~~ -!!! error TS7006: Parameter 'arg' implicitly has an 'any' type. - }); - - outer2({ - prop: inner1((arg) => arg), - }); - - declare function inner2(arg: T & ((arg: string) => any)): T; - - const result2 = inner2((arg) => arg); - - outer1({ - prop: inner2((arg) => arg), - ~~~ -!!! error TS7006: Parameter 'arg' implicitly has an 'any' type. - }); - - outer2({ - prop: inner2((arg) => arg), - }); - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/returnTypeInferenceContextualTypeIgnoreAnyUnknown1.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/returnTypeInferenceContextualTypeIgnoreAnyUnknown1.errors.txt.diff deleted file mode 100644 index c44ea695cf0..00000000000 --- a/testdata/baselines/reference/submodule/compiler/returnTypeInferenceContextualTypeIgnoreAnyUnknown1.errors.txt.diff +++ /dev/null @@ -1,40 +0,0 @@ ---- old.returnTypeInferenceContextualTypeIgnoreAnyUnknown1.errors.txt -+++ new.returnTypeInferenceContextualTypeIgnoreAnyUnknown1.errors.txt -@@= skipped -0, +0 lines =@@ -- -+returnTypeInferenceContextualTypeIgnoreAnyUnknown1.ts(9,17): error TS7006: Parameter 'arg' implicitly has an 'any' type. -+returnTypeInferenceContextualTypeIgnoreAnyUnknown1.ts(21,17): error TS7006: Parameter 'arg' implicitly has an 'any' type. -+ -+ -+==== returnTypeInferenceContextualTypeIgnoreAnyUnknown1.ts (2 errors) ==== -+ declare function outer1(arg: { prop: any }): void; -+ declare function outer2(arg: { prop: unknown }): void; -+ -+ declare function inner1 any>(arg: T): T; -+ -+ const result1 = inner1((arg) => arg); -+ -+ outer1({ -+ prop: inner1((arg) => arg), -+ ~~~ -+!!! error TS7006: Parameter 'arg' implicitly has an 'any' type. -+ }); -+ -+ outer2({ -+ prop: inner1((arg) => arg), -+ }); -+ -+ declare function inner2(arg: T & ((arg: string) => any)): T; -+ -+ const result2 = inner2((arg) => arg); -+ -+ outer1({ -+ prop: inner2((arg) => arg), -+ ~~~ -+!!! error TS7006: Parameter 'arg' implicitly has an 'any' type. -+ }); -+ -+ outer2({ -+ prop: inner2((arg) => arg), -+ }); -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/returnTypeInferenceContextualTypeIgnoreAnyUnknown1.types b/testdata/baselines/reference/submodule/compiler/returnTypeInferenceContextualTypeIgnoreAnyUnknown1.types index dfbb14d2e1a..61799982532 100644 --- a/testdata/baselines/reference/submodule/compiler/returnTypeInferenceContextualTypeIgnoreAnyUnknown1.types +++ b/testdata/baselines/reference/submodule/compiler/returnTypeInferenceContextualTypeIgnoreAnyUnknown1.types @@ -27,15 +27,15 @@ const result1 = inner1((arg) => arg); outer1({ >outer1({ prop: inner1((arg) => arg),}) : void >outer1 : (arg: { prop: any; }) => void ->{ prop: inner1((arg) => arg),} : { prop: (arg: any) => any; } +>{ prop: inner1((arg) => arg),} : { prop: (arg: string) => string; } prop: inner1((arg) => arg), ->prop : (arg: any) => any ->inner1((arg) => arg) : (arg: any) => any +>prop : (arg: string) => string +>inner1((arg) => arg) : (arg: string) => string >inner1 : any>(arg: T) => T ->(arg) => arg : (arg: any) => any ->arg : any ->arg : any +>(arg) => arg : (arg: string) => string +>arg : string +>arg : string }); @@ -70,15 +70,15 @@ const result2 = inner2((arg) => arg); outer1({ >outer1({ prop: inner2((arg) => arg),}) : void >outer1 : (arg: { prop: any; }) => void ->{ prop: inner2((arg) => arg),} : { prop: (arg: any) => any; } +>{ prop: inner2((arg) => arg),} : { prop: (arg: string) => string; } prop: inner2((arg) => arg), ->prop : (arg: any) => any ->inner2((arg) => arg) : (arg: any) => any +>prop : (arg: string) => string +>inner2((arg) => arg) : (arg: string) => string >inner2 : (arg: T & ((arg: string) => any)) => T ->(arg) => arg : (arg: any) => any ->arg : any ->arg : any +>(arg) => arg : (arg: string) => string +>arg : string +>arg : string }); diff --git a/testdata/baselines/reference/submodule/compiler/returnTypeInferenceContextualTypeIgnoreAnyUnknown1.types.diff b/testdata/baselines/reference/submodule/compiler/returnTypeInferenceContextualTypeIgnoreAnyUnknown1.types.diff deleted file mode 100644 index 2531a09bfae..00000000000 --- a/testdata/baselines/reference/submodule/compiler/returnTypeInferenceContextualTypeIgnoreAnyUnknown1.types.diff +++ /dev/null @@ -1,45 +0,0 @@ ---- old.returnTypeInferenceContextualTypeIgnoreAnyUnknown1.types -+++ new.returnTypeInferenceContextualTypeIgnoreAnyUnknown1.types -@@= skipped -26, +26 lines =@@ - outer1({ - >outer1({ prop: inner1((arg) => arg),}) : void - >outer1 : (arg: { prop: any; }) => void -->{ prop: inner1((arg) => arg),} : { prop: (arg: string) => string; } -+>{ prop: inner1((arg) => arg),} : { prop: (arg: any) => any; } - - prop: inner1((arg) => arg), -->prop : (arg: string) => string -->inner1((arg) => arg) : (arg: string) => string -+>prop : (arg: any) => any -+>inner1((arg) => arg) : (arg: any) => any - >inner1 : any>(arg: T) => T -->(arg) => arg : (arg: string) => string -->arg : string -->arg : string -+>(arg) => arg : (arg: any) => any -+>arg : any -+>arg : any - - }); - -@@= skipped -43, +43 lines =@@ - outer1({ - >outer1({ prop: inner2((arg) => arg),}) : void - >outer1 : (arg: { prop: any; }) => void -->{ prop: inner2((arg) => arg),} : { prop: (arg: string) => string; } -+>{ prop: inner2((arg) => arg),} : { prop: (arg: any) => any; } - - prop: inner2((arg) => arg), -->prop : (arg: string) => string -->inner2((arg) => arg) : (arg: string) => string -+>prop : (arg: any) => any -+>inner2((arg) => arg) : (arg: any) => any - >inner2 : (arg: T & ((arg: string) => any)) => T -->(arg) => arg : (arg: string) => string -->arg : string -->arg : string -+>(arg) => arg : (arg: any) => any -+>arg : any -+>arg : any - - }); diff --git a/testdata/baselines/reference/submodule/compiler/thislessFunctionsNotContextSensitive1.errors.txt b/testdata/baselines/reference/submodule/compiler/thislessFunctionsNotContextSensitive1.errors.txt index 64aad28f6b3..2d89af911e2 100644 --- a/testdata/baselines/reference/submodule/compiler/thislessFunctionsNotContextSensitive1.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/thislessFunctionsNotContextSensitive1.errors.txt @@ -1,16 +1,9 @@ -thislessFunctionsNotContextSensitive1.ts(15,3): error TS2345: Argument of type 'true' is not assignable to parameter of type 'false'. thislessFunctionsNotContextSensitive1.ts(25,3): error TS2345: Argument of type 'false' is not assignable to parameter of type 'true'. -thislessFunctionsNotContextSensitive1.ts(39,23): error TS2322: Type 'unknown' is not assignable to type 'number'. -thislessFunctionsNotContextSensitive1.ts(46,23): error TS2322: Type 'unknown' is not assignable to type 'number'. -thislessFunctionsNotContextSensitive1.ts(79,36): error TS18046: 'state.bar2' is of type 'unknown'. -thislessFunctionsNotContextSensitive1.ts(95,5): error TS18046: 'methods' is of type 'unknown'. thislessFunctionsNotContextSensitive1.ts(143,13): error TS2345: Argument of type '"value"' is not assignable to parameter of type 'never'. -thislessFunctionsNotContextSensitive1.ts(146,13): error TS2345: Argument of type '{ foo(): void; }[]' is not assignable to parameter of type 'never'. -thislessFunctionsNotContextSensitive1.ts(163,3): error TS2322: Type 'string' is not assignable to type 'undefined'. -thislessFunctionsNotContextSensitive1.ts(176,3): error TS2322: Type 'string' is not assignable to type 'undefined'. +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 '"$test1"'? -==== thislessFunctionsNotContextSensitive1.ts (10 errors) ==== +==== thislessFunctionsNotContextSensitive1.ts (3 errors) ==== // https://github.com/microsoft/TypeScript/issues/62204 declare function TestConfig( @@ -26,8 +19,6 @@ thislessFunctionsNotContextSensitive1.ts(176,3): error TS2322: Type 'string' is }, }, true, - ~~~~ -!!! error TS2345: Argument of type 'true' is not assignable to parameter of type 'false'. ); TestConfig( @@ -54,9 +45,6 @@ thislessFunctionsNotContextSensitive1.ts(176,3): error TS2322: Type 'string' is defineOptions({ resolve: (event) => event, // number - ~~~~~ -!!! error TS2322: Type 'unknown' is not assignable to type 'number'. -!!! related TS6502 thislessFunctionsNotContextSensitive1.ts:31:12: The expected type comes from the return type of this signature. subscribe() { return 123; }, @@ -64,9 +52,6 @@ thislessFunctionsNotContextSensitive1.ts(176,3): error TS2322: Type 'string' is defineOptions({ resolve: (event) => event, // number - ~~~~~ -!!! error TS2322: Type 'unknown' is not assignable to type 'number'. -!!! related TS6502 thislessFunctionsNotContextSensitive1.ts:31:12: The expected type comes from the return type of this signature. subscribe: function () { return 123; }, @@ -100,8 +85,6 @@ thislessFunctionsNotContextSensitive1.ts(176,3): error TS2322: Type 'string' is return { bar2: 1 }; }, mutations: { inc: (state) => state.bar2++ }, - ~~~~~~~~~~ -!!! error TS18046: 'state.bar2' is of type 'unknown'. }, }, }); @@ -118,8 +101,6 @@ thislessFunctionsNotContextSensitive1.ts(176,3): error TS2322: Type 'string' is Component({ attached(methods) { methods.bbb(); // ok - ~~~~~~~ -!!! error TS18046: 'methods' is of type 'unknown'. }, methods: { bbb() {}, @@ -173,8 +154,6 @@ thislessFunctionsNotContextSensitive1.ts(176,3): error TS2322: Type 'string' is doSomething(['v']); // ok doSomething([o]); // ok doSomething([{ foo() {} }]); // ok - ~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '{ foo(): void; }[]' is not assignable to parameter of type 'never'. // https://github.com/microsoft/TypeScript/issues/55124 type Values = T[keyof T]; @@ -192,9 +171,6 @@ thislessFunctionsNotContextSensitive1.ts(176,3): error TS2322: Type 'string' is test55124({ target: "$test4", // ok - ~~~~~~ -!!! error TS2322: Type 'string' is not assignable to type 'undefined'. -!!! related TS6500 thislessFunctionsNotContextSensitive1.ts:155:3: The expected type comes from property 'target' which is declared here on type 'SetType' data1: { $test1: 111, $test2: null, @@ -209,8 +185,8 @@ thislessFunctionsNotContextSensitive1.ts(176,3): error TS2322: Type 'string' is test55124({ target: "$test6", // error ~~~~~~ -!!! error TS2322: Type 'string' is not assignable to type 'undefined'. -!!! related TS6500 thislessFunctionsNotContextSensitive1.ts:155:3: The expected type comes from property 'target' which is declared here on type 'SetType' +!!! 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 '"$test1"'? +!!! 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, diff --git a/testdata/baselines/reference/submodule/compiler/thislessFunctionsNotContextSensitive1.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/thislessFunctionsNotContextSensitive1.errors.txt.diff deleted file mode 100644 index 816fdd36753..00000000000 --- a/testdata/baselines/reference/submodule/compiler/thislessFunctionsNotContextSensitive1.errors.txt.diff +++ /dev/null @@ -1,100 +0,0 @@ ---- old.thislessFunctionsNotContextSensitive1.errors.txt -+++ new.thislessFunctionsNotContextSensitive1.errors.txt -@@= skipped -0, +0 lines =@@ -+thislessFunctionsNotContextSensitive1.ts(15,3): error TS2345: Argument of type 'true' is not assignable to parameter of type 'false'. - thislessFunctionsNotContextSensitive1.ts(25,3): error TS2345: Argument of type 'false' is not assignable to parameter of type 'true'. -+thislessFunctionsNotContextSensitive1.ts(39,23): error TS2322: Type 'unknown' is not assignable to type 'number'. -+thislessFunctionsNotContextSensitive1.ts(46,23): error TS2322: Type 'unknown' is not assignable to type 'number'. -+thislessFunctionsNotContextSensitive1.ts(79,36): error TS18046: 'state.bar2' is of type 'unknown'. -+thislessFunctionsNotContextSensitive1.ts(95,5): error TS18046: 'methods' is of type 'unknown'. - 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 '"$test1"'? -- -- --==== thislessFunctionsNotContextSensitive1.ts (3 errors) ==== -+thislessFunctionsNotContextSensitive1.ts(146,13): error TS2345: Argument of type '{ foo(): void; }[]' is not assignable to parameter of type 'never'. -+thislessFunctionsNotContextSensitive1.ts(163,3): error TS2322: Type 'string' is not assignable to type 'undefined'. -+thislessFunctionsNotContextSensitive1.ts(176,3): error TS2322: Type 'string' is not assignable to type 'undefined'. -+ -+ -+==== thislessFunctionsNotContextSensitive1.ts (10 errors) ==== - // https://github.com/microsoft/TypeScript/issues/62204 - - declare function TestConfig( -@@= skipped -18, +25 lines =@@ - }, - }, - true, -+ ~~~~ -+!!! error TS2345: Argument of type 'true' is not assignable to parameter of type 'false'. - ); - - TestConfig( -@@= skipped -26, +28 lines =@@ - - defineOptions({ - resolve: (event) => event, // number -+ ~~~~~ -+!!! error TS2322: Type 'unknown' is not assignable to type 'number'. -+!!! related TS6502 thislessFunctionsNotContextSensitive1.ts:31:12: The expected type comes from the return type of this signature. - subscribe() { - return 123; - }, -@@= skipped -7, +10 lines =@@ - - defineOptions({ - resolve: (event) => event, // number -+ ~~~~~ -+!!! error TS2322: Type 'unknown' is not assignable to type 'number'. -+!!! related TS6502 thislessFunctionsNotContextSensitive1.ts:31:12: The expected type comes from the return type of this signature. - subscribe: function () { - return 123; - }, -@@= skipped -33, +36 lines =@@ - return { bar2: 1 }; - }, - mutations: { inc: (state) => state.bar2++ }, -+ ~~~~~~~~~~ -+!!! error TS18046: 'state.bar2' is of type 'unknown'. - }, - }, - }); -@@= skipped -16, +18 lines =@@ - Component({ - attached(methods) { - methods.bbb(); // ok -+ ~~~~~~~ -+!!! error TS18046: 'methods' is of type 'unknown'. - }, - methods: { - bbb() {}, -@@= skipped -53, +55 lines =@@ - doSomething(['v']); // ok - doSomething([o]); // ok - doSomething([{ foo() {} }]); // ok -+ ~~~~~~~~~~~~~~ -+!!! error TS2345: Argument of type '{ foo(): void; }[]' is not assignable to parameter of type 'never'. - - // https://github.com/microsoft/TypeScript/issues/55124 - type Values = T[keyof T]; -@@= skipped -17, +19 lines =@@ - - test55124({ - target: "$test4", // ok -+ ~~~~~~ -+!!! error TS2322: Type 'string' is not assignable to type 'undefined'. -+!!! related TS6500 thislessFunctionsNotContextSensitive1.ts:155:3: The expected type comes from property 'target' which is declared here on type 'SetType' - data1: { - $test1: 111, - $test2: null, -@@= skipped -14, +17 lines =@@ - 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 '"$test1"'? --!!! 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; }; }>' -+!!! error TS2322: Type 'string' is not assignable to type 'undefined'. -+!!! related TS6500 thislessFunctionsNotContextSensitive1.ts:155:3: The expected type comes from property 'target' which is declared here on type 'SetType' - data1: { - $test1: 111, - $test2: null, \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/thislessFunctionsNotContextSensitive1.symbols b/testdata/baselines/reference/submodule/compiler/thislessFunctionsNotContextSensitive1.symbols index b83a2588e53..133cc720cba 100644 --- a/testdata/baselines/reference/submodule/compiler/thislessFunctionsNotContextSensitive1.symbols +++ b/testdata/baselines/reference/submodule/compiler/thislessFunctionsNotContextSensitive1.symbols @@ -200,7 +200,9 @@ const store = createStore({ >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)) }, }, @@ -238,7 +240,9 @@ Component({ >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: { diff --git a/testdata/baselines/reference/submodule/compiler/thislessFunctionsNotContextSensitive1.symbols.diff b/testdata/baselines/reference/submodule/compiler/thislessFunctionsNotContextSensitive1.symbols.diff deleted file mode 100644 index e490526f631..00000000000 --- a/testdata/baselines/reference/submodule/compiler/thislessFunctionsNotContextSensitive1.symbols.diff +++ /dev/null @@ -1,22 +0,0 @@ ---- old.thislessFunctionsNotContextSensitive1.symbols -+++ new.thislessFunctionsNotContextSensitive1.symbols -@@= skipped -199, +199 lines =@@ - >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)) - - }, - }, -@@= skipped -40, +38 lines =@@ - >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: { \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/thislessFunctionsNotContextSensitive1.types b/testdata/baselines/reference/submodule/compiler/thislessFunctionsNotContextSensitive1.types index 7ad76e8fd48..d2eb243769f 100644 --- a/testdata/baselines/reference/submodule/compiler/thislessFunctionsNotContextSensitive1.types +++ b/testdata/baselines/reference/submodule/compiler/thislessFunctionsNotContextSensitive1.types @@ -23,15 +23,15 @@ TestConfig( >TestConfig( { a: "hello", b: function () { return 123; }, }, true,) : void >TestConfig : (config: TConfig, test: Exclude extends never ? true : false) => void { ->{ a: "hello", b: function () { return 123; }, } : { a: string; b: () => number; } +>{ a: "hello", b: function () { return 123; }, } : { a: "hello"; b: () => 123; } a: "hello", ->a : string +>a : "hello" >"hello" : "hello" b: function () { ->b : () => number ->function () { return 123; } : () => number +>b : () => 123 +>function () { return 123; } : () => 123 return 123; >123 : 123 @@ -47,15 +47,15 @@ TestConfig( >TestConfig( { a: "hello", b: function () { return 123; }, }, false, // error) : void >TestConfig : (config: TConfig, test: Exclude extends never ? true : false) => void { ->{ a: "hello", b: function () { return 123; }, } : { a: string; b: () => number; } +>{ a: "hello", b: function () { return 123; }, } : { a: "hello"; b: () => 123; } a: "hello", ->a : string +>a : "hello" >"hello" : "hello" b: function () { ->b : () => number ->function () { return 123; } : () => number +>b : () => 123 +>function () { return 123; } : () => 123 return 123; >123 : 123 @@ -88,13 +88,13 @@ declare function defineOptions( defineOptions({ >defineOptions({ resolve: (event) => event, // number subscribe() { return 123; },}) : void >defineOptions : (options: SubscribeFieldOptions) => void ->{ resolve: (event) => event, // number subscribe() { return 123; },} : { resolve: (event: unknown) => unknown; subscribe(): number; } +>{ resolve: (event) => event, // number subscribe() { return 123; },} : { resolve: (event: number) => number; subscribe(): number; } resolve: (event) => event, // number ->resolve : (event: unknown) => unknown ->(event) => event : (event: unknown) => unknown ->event : unknown ->event : unknown +>resolve : (event: number) => number +>(event) => event : (event: number) => number +>event : number +>event : number subscribe() { >subscribe : () => number @@ -108,13 +108,13 @@ defineOptions({ 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: unknown) => unknown; subscribe: () => number; } +>{ resolve: (event) => event, // number subscribe: function () { return 123; },} : { resolve: (event: number) => number; subscribe: () => number; } resolve: (event) => event, // number ->resolve : (event: unknown) => unknown ->(event) => event : (event: unknown) => unknown ->event : unknown ->event : unknown +>resolve : (event: number) => number +>(event) => event : (event: number) => number +>event : number +>event : number subscribe: function () { >subscribe : () => number @@ -161,7 +161,7 @@ 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: Record) => number; }; }; }; } +>{ 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; } @@ -184,12 +184,12 @@ const store = createStore({ >bar2 : number modules: { ->modules : { foo: { state(): { bar2: number; }; mutations: { inc: (state: Record) => number; }; }; } ->{ foo: { state() { return { bar2: 1 }; }, mutations: { inc: (state) => state.bar2++ }, }, } : { foo: { state(): { bar2: number; }; mutations: { inc: (state: Record) => number; }; }; } +>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: Record) => number; }; } ->{ state() { return { bar2: 1 }; }, mutations: { inc: (state) => state.bar2++ }, } : { state(): { bar2: number; }; mutations: { inc: (state: Record) => number; }; } +>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; } @@ -201,15 +201,15 @@ const store = createStore({ }, mutations: { inc: (state) => state.bar2++ }, ->mutations : { inc: (state: Record) => number; } ->{ inc: (state) => state.bar2++ } : { inc: (state: Record) => number; } ->inc : (state: Record) => number ->(state) => state.bar2++ : (state: Record) => number ->state : Record +>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 : unknown ->state : Record ->bar2 : unknown +>state.bar2 : number +>state : { bar2: number; } +>bar2 : number }, }, @@ -237,17 +237,17 @@ var Component: C = () => {}; Component({ >Component({ attached(methods) { methods.bbb(); // ok }, methods: { bbb() {}, },}) : any >Component : C ->{ attached(methods) { methods.bbb(); // ok }, methods: { bbb() {}, },} : { attached(methods: unknown): void; methods: { bbb(): void; }; } +>{ attached(methods) { methods.bbb(); // ok }, methods: { bbb() {}, },} : { attached(methods: { bbb(): void; }): void; methods: { bbb(): void; }; } attached(methods) { ->attached : (methods: unknown) => void ->methods : unknown +>attached : (methods: { bbb(): void; }) => void +>methods : { bbb(): void; } methods.bbb(); // ok ->methods.bbb() : any ->methods.bbb : any ->methods : unknown ->bbb : any +>methods.bbb() : void +>methods.bbb : () => void +>methods : { bbb(): void; } +>bbb : () => void }, methods: { @@ -307,7 +307,7 @@ declare function create56067< 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: Record, data: { b: number; }): { z: number; }; } +>{ 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; } @@ -329,12 +329,12 @@ create56067({ }, actions(state, data) { ->actions : (state: Record, data: { b: number; }) => { z: number; } ->state : Record +>actions : (state: { a: number; }, data: { b: number; }) => { z: number; } +>state : { a: number; } >data : { b: number; } state // { a: number } ->state : Record +>state : { a: number; } data; // { b: number } >data : { b: number; } @@ -383,7 +383,7 @@ doSomething([o]); // ok >o : { foo(): void; } doSomething([{ foo() {} }]); // ok ->doSomething([{ foo() {} }]) : unknown +>doSomething([{ foo() {} }]) : { foo(): void; }[] >doSomething : (value: NonStringIterable) => T >[{ foo() {} }] : { foo(): void; }[] >{ foo() {} } : { foo(): void; } @@ -420,10 +420,10 @@ declare function test55124>( 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: string; data1: { $test1: number; $test2: null; }; data2: { $test3: {}; $test4: () => void; $test5(): 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 : string +>target : "$test4" >"$test4" : "$test4" data1: { @@ -459,10 +459,10 @@ test55124({ 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: string; data1: { $test1: number; $test2: null; }; data2: { $test3: {}; $test4: () => void; $test5(): 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 : string +>target : "$test6" >"$test6" : "$test6" data1: { @@ -570,14 +570,14 @@ test53924({ 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: unknown): unknown; b(): number; } +>{ a(c) { return c; // number }, b() { return 123; },} : { a(c: number): number; b(): number; } a(c) { ->a : (c: unknown) => unknown ->c : unknown +>a : (c: number) => number +>c : number return c; // number ->c : unknown +>c : number }, b() { @@ -622,15 +622,15 @@ monitor( ); monitor( ->monitor( (p) => ({ p }), // { p: number } function (p: number) { return p; },) : (...args: any[]) => any +>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: any) => { p: any; } ->p : any ->({ p }) : { p: any; } ->{ p } : { p: any; } ->p : any +>(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 diff --git a/testdata/baselines/reference/submodule/compiler/thislessFunctionsNotContextSensitive1.types.diff b/testdata/baselines/reference/submodule/compiler/thislessFunctionsNotContextSensitive1.types.diff index dac78b0b2c6..84aa2bf485e 100644 --- a/testdata/baselines/reference/submodule/compiler/thislessFunctionsNotContextSensitive1.types.diff +++ b/testdata/baselines/reference/submodule/compiler/thislessFunctionsNotContextSensitive1.types.diff @@ -16,22 +16,8 @@ ->TestConfig : (config: TConfig, test: keyof Omit extends never ? true : false) => void +>TestConfig : (config: TConfig, test: Exclude extends never ? true : false) => void { -->{ a: "hello", b: function () { return 123; }, } : { a: "hello"; b: () => 123; } -+>{ a: "hello", b: function () { return 123; }, } : { a: string; b: () => number; } + >{ a: "hello", b: function () { return 123; }, } : { a: "hello"; b: () => 123; } - a: "hello", -->a : "hello" -+>a : string - >"hello" : "hello" - - b: function () { -->b : () => 123 -->function () { return 123; } : () => 123 -+>b : () => number -+>function () { return 123; } : () => number - - return 123; - >123 : 123 @@= skipped -24, +24 lines =@@ TestConfig( @@ -39,233 +25,4 @@ ->TestConfig : (config: TConfig, test: keyof Omit extends never ? true : false) => void +>TestConfig : (config: TConfig, test: Exclude extends never ? true : false) => void { -->{ a: "hello", b: function () { return 123; }, } : { a: "hello"; b: () => 123; } -+>{ a: "hello", b: function () { return 123; }, } : { a: string; b: () => number; } - - a: "hello", -->a : "hello" -+>a : string - >"hello" : "hello" - - b: function () { -->b : () => 123 -->function () { return 123; } : () => 123 -+>b : () => number -+>function () { return 123; } : () => number - - return 123; - >123 : 123 -@@= skipped -43, +43 lines =@@ - 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 subscribe() { return 123; },} : { resolve: (event: unknown) => unknown; subscribe(): number; } - - resolve: (event) => event, // number -->resolve : (event: number) => number -->(event) => event : (event: number) => number -->event : number -->event : number -+>resolve : (event: unknown) => unknown -+>(event) => event : (event: unknown) => unknown -+>event : unknown -+>event : unknown - - subscribe() { - >subscribe : () => number -@@= skipped -20, +20 lines =@@ - 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 subscribe: function () { return 123; },} : { resolve: (event: unknown) => unknown; subscribe: () => number; } - - resolve: (event) => event, // number -->resolve : (event: number) => number -->(event) => event : (event: number) => number -->event : number -->event : number -+>resolve : (event: unknown) => unknown -+>(event) => event : (event: unknown) => unknown -+>event : unknown -+>event : unknown - - subscribe: function () { - >subscribe : () => number -@@= skipped -53, +53 lines =@@ - >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() { 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: Record) => number; }; }; }; } - - state() { - >state : () => { bar2: number; } -@@= skipped -23, +23 lines =@@ - >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; }; }; } -+>modules : { foo: { state(): { bar2: number; }; mutations: { inc: (state: Record) => number; }; }; } -+>{ foo: { state() { return { bar2: 1 }; }, mutations: { inc: (state) => state.bar2++ }, }, } : { foo: { state(): { bar2: number; }; mutations: { inc: (state: Record) => 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; }; } -+>foo : { state(): { bar2: number; }; mutations: { inc: (state: Record) => number; }; } -+>{ state() { return { bar2: 1 }; }, mutations: { inc: (state) => state.bar2++ }, } : { state(): { bar2: number; }; mutations: { inc: (state: Record) => number; }; } - - state() { - >state : () => { bar2: number; } -@@= skipped -17, +17 lines =@@ - - }, - 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; } -+>mutations : { inc: (state: Record) => number; } -+>{ inc: (state) => state.bar2++ } : { inc: (state: Record) => number; } -+>inc : (state: Record) => number -+>(state) => state.bar2++ : (state: Record) => number -+>state : Record - >state.bar2++ : number -->state.bar2 : number -->state : { bar2: number; } -->bar2 : number -+>state.bar2 : unknown -+>state : Record -+>bar2 : unknown - - }, - }, -@@= skipped -36, +36 lines =@@ - 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) { methods.bbb(); // ok }, methods: { bbb() {}, },} : { attached(methods: unknown): void; methods: { bbb(): void; }; } - - attached(methods) { -->attached : (methods: { bbb(): void; }) => void -->methods : { bbb(): void; } -+>attached : (methods: unknown) => void -+>methods : unknown - - methods.bbb(); // ok -->methods.bbb() : void -->methods.bbb : () => void -->methods : { bbb(): void; } -->bbb : () => void -+>methods.bbb() : any -+>methods.bbb : any -+>methods : unknown -+>bbb : any - - }, - methods: { -@@= skipped -70, +70 lines =@@ - 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() { 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: Record, data: { b: number; }): { z: number; }; } - - getState() { - >getState : () => { a: number; } -@@= skipped -22, +22 lines =@@ - - }, - actions(state, data) { -->actions : (state: { a: number; }, data: { b: number; }) => { z: number; } -->state : { a: number; } -+>actions : (state: Record, data: { b: number; }) => { z: number; } -+>state : Record - >data : { b: number; } - - state // { a: number } -->state : { a: number; } -+>state : Record - - data; // { b: number } - >data : { b: number; } -@@= skipped -54, +54 lines =@@ - >o : { foo(): void; } - - doSomething([{ foo() {} }]); // ok -->doSomething([{ foo() {} }]) : { foo(): void; }[] -+>doSomething([{ foo() {} }]) : unknown - >doSomething : (value: NonStringIterable) => T - >[{ foo() {} }] : { foo(): void; }[] - >{ foo() {} } : { foo(): void; } -@@= skipped -37, +37 lines =@@ - 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 data1: { $test1: 111, $test2: null, }, data2: { $test3: {}, $test4: () => {}, $test5() {}, },} : { target: string; data1: { $test1: number; $test2: null; }; data2: { $test3: {}; $test4: () => void; $test5(): void; }; } - - target: "$test4", // ok -->target : "$test4" -+>target : string - >"$test4" : "$test4" - - data1: { -@@= skipped -39, +39 lines =@@ - 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 data1: { $test1: 111, $test2: null, }, data2: { $test3: {}, $test4: () => {}, $test5() {}, },} : { target: string; data1: { $test1: number; $test2: null; }; data2: { $test3: {}; $test4: () => void; $test5(): void; }; } - - target: "$test6", // error -->target : "$test6" -+>target : string - >"$test6" : "$test6" - - data1: { -@@= skipped -111, +111 lines =@@ - 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) { return c; // number }, b() { return 123; },} : { a(c: unknown): unknown; b(): number; } - - a(c) { -->a : (c: number) => number -->c : number -+>a : (c: unknown) => unknown -+>c : unknown - - return c; // number -->c : number -+>c : unknown - - }, - b() { -@@= skipped -52, +52 lines =@@ - - ); - monitor( -->monitor( (p) => ({ p }), // { p: number } function (p: number) { return p; },) : (p: number) => number -+>monitor( (p) => ({ p }), // { p: number } function (p: number) { return p; },) : (...args: any[]) => any - >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) => ({ p }) : (p: any) => { p: any; } -+>p : any -+>({ p }) : { p: any; } -+>{ p } : { p: any; } -+>p : any - - function (p: number) { - >function (p: number) { return p; } : (p: number) => number \ No newline at end of file + >{ a: "hello", b: function () { return 123; }, } : { a: "hello"; b: () => 123; } diff --git a/testdata/baselines/reference/submodule/compiler/thislessFunctionsNotContextSensitive2.types b/testdata/baselines/reference/submodule/compiler/thislessFunctionsNotContextSensitive2.types index 0c80a034235..7f7fd129161 100644 --- a/testdata/baselines/reference/submodule/compiler/thislessFunctionsNotContextSensitive2.types +++ b/testdata/baselines/reference/submodule/compiler/thislessFunctionsNotContextSensitive2.types @@ -24,10 +24,10 @@ declare function defineOptions( ): [Context, Data]; const result1 = defineOptions({ ->result1 : [{ tag: string; value: number; }, unknown] ->defineOptions({ context: { tag: "A", value: 1 }, consume(_data) {}, produce() { return 42; },}) : [{ tag: string; value: number; }, unknown] +>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: unknown): void; produce(this: { tag: string; value: number; }): number; } +>{ 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; } @@ -38,11 +38,11 @@ const result1 = defineOptions({ >1 : 1 consume(_data) {}, ->consume : (this: { tag: string; value: number; }, _data: unknown) => void ->_data : unknown +>consume : (this: { tag: string; value: number; }, _data: number) => void +>_data : number produce() { ->produce : (this: { tag: string; value: number; }) => number +>produce : () => number return 42; >42 : 42 @@ -105,10 +105,10 @@ const result3 = defineOptions({ }); const result4 = defineOptions({ ->result4 : [{ tag: string; value: number; }, unknown] ->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; }, unknown] +>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: unknown): void; produce(this: { tag: string; value: number; }): string; } +>{ 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; } @@ -119,11 +119,11 @@ const result4 = defineOptions({ >4 : 4 consume(_data) {}, ->consume : (this: { tag: string; value: number; }, _data: unknown) => void ->_data : unknown +>consume : (this: { tag: string; value: number; }, _data: string) => void +>_data : string produce() { ->produce : (this: { tag: string; value: number; }) => string +>produce : () => string class Local { >Local : Local @@ -152,10 +152,10 @@ const result4 = defineOptions({ }); const result5 = defineOptions({ ->result5 : [{ tag: string; value: number; }, unknown] ->defineOptions({ context: { tag: "E", value: 5 }, consume(_data) {}, produce() { function inner() { return this; } return inner(); },}) : [{ tag: string; value: number; }, unknown] +>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: unknown): void; produce(this: { tag: string; value: number; }): any; } +>{ 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; } @@ -166,11 +166,11 @@ const result5 = defineOptions({ >5 : 5 consume(_data) {}, ->consume : (this: { tag: string; value: number; }, _data: unknown) => void ->_data : unknown +>consume : (this: { tag: string; value: number; }, _data: any) => void +>_data : any produce() { ->produce : (this: { tag: string; value: number; }) => any +>produce : () => any function inner() { >inner : () => any @@ -289,10 +289,10 @@ const result8 = defineOptions({ }); const result9 = defineOptions({ ->result9 : [{ tag: string; value: number; }, unknown] ->defineOptions({ context: { tag: "I", value: 9 }, consume(_data) {}, produce() { const obj = { value: 'foo', get() { return this.value; }, }; return obj.get(); },}) : [{ tag: string; value: number; }, unknown] +>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: unknown): void; produce(this: { tag: string; value: number; }): string; } +>{ 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; } @@ -303,11 +303,11 @@ const result9 = defineOptions({ >9 : 9 consume(_data) {}, ->consume : (this: { tag: string; value: number; }, _data: unknown) => void ->_data : unknown +>consume : (this: { tag: string; value: number; }, _data: string) => void +>_data : string produce() { ->produce : (this: { tag: string; value: number; }) => string +>produce : () => string const obj = { >obj : { value: string; get(): string; } @@ -337,10 +337,10 @@ const result9 = defineOptions({ }); const result10 = defineOptions({ ->result10 : [{ tag: string; value: number; }, unknown] ->defineOptions({ context: { tag: "I", value: 9 }, consume(_data) {}, produce() { interface Foo { prop: this; } return {} as Foo; },}) : [{ tag: string; value: number; }, unknown] +>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: unknown): void; produce(this: { tag: string; value: number; }): Foo; } +>{ 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; } @@ -351,11 +351,11 @@ const result10 = defineOptions({ >9 : 9 consume(_data) {}, ->consume : (this: { tag: string; value: number; }, _data: unknown) => void ->_data : unknown +>consume : (this: { tag: string; value: number; }, _data: Foo) => void +>_data : Foo produce() { ->produce : (this: { tag: string; value: number; }) => Foo +>produce : () => Foo interface Foo { prop: this; @@ -369,10 +369,10 @@ const result10 = defineOptions({ }); const result11 = defineOptions({ ->result11 : [{ tag: string; value: number; }, unknown] ->defineOptions({ context: { tag: "I", value: 9 }, consume(_data) {}, produce() { function fn(this: { prop: string }) { return this.prop; } return fn; },}) : [{ tag: string; value: number; }, unknown] +>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: unknown): void; produce(this: { tag: string; value: number; }): (this: { prop: string; }) => string; } +>{ 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; } @@ -383,11 +383,11 @@ const result11 = defineOptions({ >9 : 9 consume(_data) {}, ->consume : (this: { tag: string; value: number; }, _data: unknown) => void ->_data : unknown +>consume : (this: { tag: string; value: number; }, _data: (this: { prop: string; }) => string) => void +>_data : (this: { prop: string; }) => string produce() { ->produce : (this: { tag: string; value: number; }) => (this: { prop: string; }) => string +>produce : () => (this: { prop: string; }) => string function fn(this: { prop: string }) { >fn : (this: { prop: string; }) => string diff --git a/testdata/baselines/reference/submodule/compiler/thislessFunctionsNotContextSensitive2.types.diff b/testdata/baselines/reference/submodule/compiler/thislessFunctionsNotContextSensitive2.types.diff deleted file mode 100644 index 561fad95182..00000000000 --- a/testdata/baselines/reference/submodule/compiler/thislessFunctionsNotContextSensitive2.types.diff +++ /dev/null @@ -1,176 +0,0 @@ ---- old.thislessFunctionsNotContextSensitive2.types -+++ new.thislessFunctionsNotContextSensitive2.types -@@= skipped -23, +23 lines =@@ - ): [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] -+>result1 : [{ tag: string; value: number; }, unknown] -+>defineOptions({ context: { tag: "A", value: 1 }, consume(_data) {}, produce() { return 42; },}) : [{ tag: string; value: number; }, unknown] - >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 }, consume(_data) {}, produce() { return 42; },} : { context: { tag: string; value: number; }; consume(this: { tag: string; value: number; }, _data: unknown): void; produce(this: { tag: string; value: number; }): number; } - - context: { tag: "A", value: 1 }, - >context : { tag: string; value: number; } -@@= skipped -14, +14 lines =@@ - >1 : 1 - - consume(_data) {}, -->consume : (this: { tag: string; value: number; }, _data: number) => void -->_data : number -+>consume : (this: { tag: string; value: number; }, _data: unknown) => void -+>_data : unknown - - produce() { -->produce : () => number -+>produce : (this: { tag: string; value: number; }) => number - - return 42; - >42 : 42 -@@= skipped -67, +67 lines =@@ - }); - - 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] -+>result4 : [{ tag: string; value: number; }, unknown] -+>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; }, unknown] - >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 }, 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: unknown): void; produce(this: { tag: string; value: number; }): string; } - - context: { tag: "D", value: 4 }, - >context : { tag: string; value: number; } -@@= skipped -14, +14 lines =@@ - >4 : 4 - - consume(_data) {}, -->consume : (this: { tag: string; value: number; }, _data: string) => void -->_data : string -+>consume : (this: { tag: string; value: number; }, _data: unknown) => void -+>_data : unknown - - produce() { -->produce : () => string -+>produce : (this: { tag: string; value: number; }) => string - - class Local { - >Local : Local -@@= skipped -33, +33 lines =@@ - }); - - 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] -+>result5 : [{ tag: string; value: number; }, unknown] -+>defineOptions({ context: { tag: "E", value: 5 }, consume(_data) {}, produce() { function inner() { return this; } return inner(); },}) : [{ tag: string; value: number; }, unknown] - >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 }, consume(_data) {}, produce() { function inner() { return this; } return inner(); },} : { context: { tag: string; value: number; }; consume(this: { tag: string; value: number; }, _data: unknown): void; produce(this: { tag: string; value: number; }): any; } - - context: { tag: "E", value: 5 }, - >context : { tag: string; value: number; } -@@= skipped -14, +14 lines =@@ - >5 : 5 - - consume(_data) {}, -->consume : (this: { tag: string; value: number; }, _data: any) => void -->_data : any -+>consume : (this: { tag: string; value: number; }, _data: unknown) => void -+>_data : unknown - - produce() { -->produce : () => any -+>produce : (this: { tag: string; value: number; }) => any - - function inner() { - >inner : () => any -@@= skipped -123, +123 lines =@@ - }); - - 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] -+>result9 : [{ tag: string; value: number; }, unknown] -+>defineOptions({ context: { tag: "I", value: 9 }, consume(_data) {}, produce() { const obj = { value: 'foo', get() { return this.value; }, }; return obj.get(); },}) : [{ tag: string; value: number; }, unknown] - >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 }, 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: unknown): void; produce(this: { tag: string; value: number; }): string; } - - context: { tag: "I", value: 9 }, - >context : { tag: string; value: number; } -@@= skipped -14, +14 lines =@@ - >9 : 9 - - consume(_data) {}, -->consume : (this: { tag: string; value: number; }, _data: string) => void -->_data : string -+>consume : (this: { tag: string; value: number; }, _data: unknown) => void -+>_data : unknown - - produce() { -->produce : () => string -+>produce : (this: { tag: string; value: number; }) => string - - const obj = { - >obj : { value: string; get(): string; } -@@= skipped -34, +34 lines =@@ - }); - - 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] -+>result10 : [{ tag: string; value: number; }, unknown] -+>defineOptions({ context: { tag: "I", value: 9 }, consume(_data) {}, produce() { interface Foo { prop: this; } return {} as Foo; },}) : [{ tag: string; value: number; }, unknown] - >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 }, consume(_data) {}, produce() { interface Foo { prop: this; } return {} as Foo; },} : { context: { tag: string; value: number; }; consume(this: { tag: string; value: number; }, _data: unknown): void; produce(this: { tag: string; value: number; }): Foo; } - - context: { tag: "I", value: 9 }, - >context : { tag: string; value: number; } -@@= skipped -14, +14 lines =@@ - >9 : 9 - - consume(_data) {}, -->consume : (this: { tag: string; value: number; }, _data: Foo) => void -->_data : Foo -+>consume : (this: { tag: string; value: number; }, _data: unknown) => void -+>_data : unknown - - produce() { -->produce : () => Foo -+>produce : (this: { tag: string; value: number; }) => Foo - - interface Foo { - prop: this; -@@= skipped -18, +18 lines =@@ - }); - - 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] -+>result11 : [{ tag: string; value: number; }, unknown] -+>defineOptions({ context: { tag: "I", value: 9 }, consume(_data) {}, produce() { function fn(this: { prop: string }) { return this.prop; } return fn; },}) : [{ tag: string; value: number; }, unknown] - >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 }, 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: unknown): void; produce(this: { tag: string; value: number; }): (this: { prop: string; }) => string; } - - context: { tag: "I", value: 9 }, - >context : { tag: string; value: number; } -@@= skipped -14, +14 lines =@@ - >9 : 9 - - consume(_data) {}, -->consume : (this: { tag: string; value: number; }, _data: (this: { prop: string; }) => string) => void -->_data : (this: { prop: string; }) => string -+>consume : (this: { tag: string; value: number; }, _data: unknown) => void -+>_data : unknown - - produce() { -->produce : () => (this: { prop: string; }) => string -+>produce : (this: { tag: string; value: number; }) => (this: { prop: string; }) => string - - function fn(this: { prop: string }) { - >fn : (this: { prop: string; }) => string \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/thislessFunctionsNotContextSensitive3.errors.txt b/testdata/baselines/reference/submodule/compiler/thislessFunctionsNotContextSensitive3.errors.txt index d676e3eac32..7a4df0dd824 100644 --- a/testdata/baselines/reference/submodule/compiler/thislessFunctionsNotContextSensitive3.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/thislessFunctionsNotContextSensitive3.errors.txt @@ -1,8 +1,10 @@ +thislessFunctionsNotContextSensitive3.ts(62,9): error TS2783: 'editor' is specified more than once, so this usage will be overwritten. thislessFunctionsNotContextSensitive3.ts(81,9): error TS2783: 'editor' is specified more than once, so this usage will be overwritten. +thislessFunctionsNotContextSensitive3.ts(96,3): error TS2353: Object literal may only specify known properties, and 'child' does not exist in type 'Partial<{ parent: string; overwrite: string; }>'. thislessFunctionsNotContextSensitive3.ts(108,3): error TS2353: Object literal may only specify known properties, and 'child' does not exist in type 'Partial<{ parent: string; overwrite: string; }>'. -==== thislessFunctionsNotContextSensitive3.ts (2 errors) ==== +==== thislessFunctionsNotContextSensitive3.ts (4 errors) ==== declare class Editor { private _editor; } @@ -65,6 +67,9 @@ thislessFunctionsNotContextSensitive3.ts(108,3): error TS2353: Object literal ma return [ Suggestion({ editor: this.editor, // error + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2783: 'editor' is specified more than once, so this usage will be overwritten. +!!! related TS2785 thislessFunctionsNotContextSensitive3.ts:63:9: This spread always overwrites this property. ...this.options.suggestion, }), ]; @@ -102,6 +107,8 @@ thislessFunctionsNotContextSensitive3.ts(108,3): error TS2353: Object literal ma const childExtension = parentExtension.configure({ child: "exists-too", // error + ~~~~~ +!!! error TS2353: Object literal may only specify known properties, and 'child' does not exist in type 'Partial<{ parent: string; overwrite: string; }>'. overwrite: "child", }); diff --git a/testdata/baselines/reference/submodule/compiler/thislessFunctionsNotContextSensitive3.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/thislessFunctionsNotContextSensitive3.errors.txt.diff deleted file mode 100644 index 146fe5791b3..00000000000 --- a/testdata/baselines/reference/submodule/compiler/thislessFunctionsNotContextSensitive3.errors.txt.diff +++ /dev/null @@ -1,33 +0,0 @@ ---- old.thislessFunctionsNotContextSensitive3.errors.txt -+++ new.thislessFunctionsNotContextSensitive3.errors.txt -@@= skipped -0, +0 lines =@@ --thislessFunctionsNotContextSensitive3.ts(62,9): error TS2783: 'editor' is specified more than once, so this usage will be overwritten. - thislessFunctionsNotContextSensitive3.ts(81,9): error TS2783: 'editor' is specified more than once, so this usage will be overwritten. --thislessFunctionsNotContextSensitive3.ts(96,3): error TS2353: Object literal may only specify known properties, and 'child' does not exist in type 'Partial<{ parent: string; overwrite: string; }>'. - thislessFunctionsNotContextSensitive3.ts(108,3): error TS2353: Object literal may only specify known properties, and 'child' does not exist in type 'Partial<{ parent: string; overwrite: string; }>'. - - --==== thislessFunctionsNotContextSensitive3.ts (4 errors) ==== -+==== thislessFunctionsNotContextSensitive3.ts (2 errors) ==== - declare class Editor { - private _editor; - } -@@= skipped -66, +64 lines =@@ - return [ - Suggestion({ - editor: this.editor, // error -- ~~~~~~~~~~~~~~~~~~~ --!!! error TS2783: 'editor' is specified more than once, so this usage will be overwritten. --!!! related TS2785 thislessFunctionsNotContextSensitive3.ts:63:9: This spread always overwrites this property. - ...this.options.suggestion, - }), - ]; -@@= skipped -40, +37 lines =@@ - - const childExtension = parentExtension.configure({ - child: "exists-too", // error -- ~~~~~ --!!! error TS2353: Object literal may only specify known properties, and 'child' does not exist in type 'Partial<{ parent: string; overwrite: string; }>'. - overwrite: "child", - }); - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/thislessFunctionsNotContextSensitive3.symbols b/testdata/baselines/reference/submodule/compiler/thislessFunctionsNotContextSensitive3.symbols index 7f00294f541..8bb3cff42e1 100644 --- a/testdata/baselines/reference/submodule/compiler/thislessFunctionsNotContextSensitive3.symbols +++ b/testdata/baselines/reference/submodule/compiler/thislessFunctionsNotContextSensitive3.symbols @@ -190,9 +190,11 @@ Extension.create({ >editor : Symbol(editor, Decl(thislessFunctionsNotContextSensitive3.ts, 26, 21)) ...this.options.suggestion, +>this.options.suggestion : Symbol(suggestion, Decl(thislessFunctionsNotContextSensitive3.ts, 52, 12)) >this.options : Symbol(options, Decl(thislessFunctionsNotContextSensitive3.ts, 25, 34)) >this : Symbol(this, Decl(thislessFunctionsNotContextSensitive3.ts, 25, 27)) >options : Symbol(options, Decl(thislessFunctionsNotContextSensitive3.ts, 25, 34)) +>suggestion : Symbol(suggestion, Decl(thislessFunctionsNotContextSensitive3.ts, 52, 12)) }), ]; diff --git a/testdata/baselines/reference/submodule/compiler/thislessFunctionsNotContextSensitive3.symbols.diff b/testdata/baselines/reference/submodule/compiler/thislessFunctionsNotContextSensitive3.symbols.diff deleted file mode 100644 index 3be1df6db01..00000000000 --- a/testdata/baselines/reference/submodule/compiler/thislessFunctionsNotContextSensitive3.symbols.diff +++ /dev/null @@ -1,14 +0,0 @@ ---- old.thislessFunctionsNotContextSensitive3.symbols -+++ new.thislessFunctionsNotContextSensitive3.symbols -@@= skipped -189, +189 lines =@@ - >editor : Symbol(editor, Decl(thislessFunctionsNotContextSensitive3.ts, 26, 21)) - - ...this.options.suggestion, -->this.options.suggestion : Symbol(suggestion, Decl(thislessFunctionsNotContextSensitive3.ts, 52, 12)) - >this.options : Symbol(options, Decl(thislessFunctionsNotContextSensitive3.ts, 25, 34)) - >this : Symbol(this, Decl(thislessFunctionsNotContextSensitive3.ts, 25, 27)) - >options : Symbol(options, Decl(thislessFunctionsNotContextSensitive3.ts, 25, 34)) -->suggestion : Symbol(suggestion, Decl(thislessFunctionsNotContextSensitive3.ts, 52, 12)) - - }), - ]; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/thislessFunctionsNotContextSensitive3.types b/testdata/baselines/reference/submodule/compiler/thislessFunctionsNotContextSensitive3.types index 2e40f9c4521..0dd032d4df9 100644 --- a/testdata/baselines/reference/submodule/compiler/thislessFunctionsNotContextSensitive3.types +++ b/testdata/baselines/reference/submodule/compiler/thislessFunctionsNotContextSensitive3.types @@ -91,18 +91,18 @@ declare function Suggestion(options: SuggestionOptions): Plugin; >options : SuggestionOptions Extension.create({ ->Extension.create({ name: "slash-command", addOptions() { return { suggestion: { char: "/", } as SuggestionOptions, }; }, addProseMirrorPlugins() { return [ Suggestion({ editor: this.editor, // error ...this.options.suggestion, }), ]; },}) : Extension +>Extension.create({ name: "slash-command", addOptions() { return { suggestion: { char: "/", } as SuggestionOptions, }; }, addProseMirrorPlugins() { return [ Suggestion({ editor: this.editor, // error ...this.options.suggestion, }), ]; },}) : Extension<{ suggestion: SuggestionOptions; }> >Extension.create : (config: Partial>) => Extension >Extension : typeof Extension >create : (config: Partial>) => Extension ->{ name: "slash-command", addOptions() { return { suggestion: { char: "/", } as SuggestionOptions, }; }, addProseMirrorPlugins() { return [ Suggestion({ editor: this.editor, // error ...this.options.suggestion, }), ]; },} : { name: string; addOptions(this: { name: string; parent: (() => any) | undefined; }): { suggestion: SuggestionOptions; }; addProseMirrorPlugins(this: { options: any; editor: Editor; }): Plugin[]; } +>{ name: "slash-command", addOptions() { return { suggestion: { char: "/", } as SuggestionOptions, }; }, addProseMirrorPlugins() { return [ Suggestion({ editor: this.editor, // error ...this.options.suggestion, }), ]; },} : { name: string; addOptions(): { suggestion: SuggestionOptions; }; addProseMirrorPlugins(this: { options: { suggestion: SuggestionOptions; }; editor: Editor; }): Plugin[]; } name: "slash-command", >name : string >"slash-command" : "slash-command" addOptions() { ->addOptions : (this: { name: string; parent: (() => any) | undefined; }) => { suggestion: SuggestionOptions; } +>addOptions : () => { suggestion: SuggestionOptions; } return { >{ suggestion: { char: "/", } as SuggestionOptions, } : { suggestion: SuggestionOptions; } @@ -120,7 +120,7 @@ Extension.create({ }; }, addProseMirrorPlugins() { ->addProseMirrorPlugins : (this: { options: any; editor: Editor; }) => Plugin[] +>addProseMirrorPlugins : (this: { options: { suggestion: SuggestionOptions; }; editor: Editor; }) => Plugin[] return [ >[ Suggestion({ editor: this.editor, // error ...this.options.suggestion, }), ] : Plugin[] @@ -128,20 +128,20 @@ Extension.create({ Suggestion({ >Suggestion({ editor: this.editor, // error ...this.options.suggestion, }) : Plugin >Suggestion : (options: SuggestionOptions) => Plugin ->{ editor: this.editor, // error ...this.options.suggestion, } : any +>{ editor: this.editor, // error ...this.options.suggestion, } : { editor: Editor; char?: string | undefined; } editor: this.editor, // error >editor : Editor >this.editor : Editor ->this : { options: any; editor: Editor; } +>this : { options: { suggestion: SuggestionOptions; }; editor: Editor; } >editor : Editor ...this.options.suggestion, ->this.options.suggestion : any ->this.options : any ->this : { options: any; editor: Editor; } ->options : any ->suggestion : any +>this.options.suggestion : SuggestionOptions +>this.options : { suggestion: SuggestionOptions; } +>this : { options: { suggestion: SuggestionOptions; }; editor: Editor; } +>options : { suggestion: SuggestionOptions; } +>suggestion : SuggestionOptions }), ]; @@ -208,19 +208,19 @@ Extension.create({ }); const parentExtension = Extension.create({ ->parentExtension : Extension ->Extension.create({ name: "parentExtension", addOptions() { return { parent: "exists", overwrite: "parent" }; },}) : Extension +>parentExtension : Extension<{ parent: string; overwrite: string; }> +>Extension.create({ name: "parentExtension", addOptions() { return { parent: "exists", overwrite: "parent" }; },}) : Extension<{ parent: string; overwrite: string; }> >Extension.create : (config: Partial>) => Extension >Extension : typeof Extension >create : (config: Partial>) => Extension ->{ name: "parentExtension", addOptions() { return { parent: "exists", overwrite: "parent" }; },} : { name: string; addOptions(this: { name: string; parent: (() => any) | undefined; }): { parent: string; overwrite: string; }; } +>{ name: "parentExtension", addOptions() { return { parent: "exists", overwrite: "parent" }; },} : { name: string; addOptions(): { parent: string; overwrite: string; }; } name: "parentExtension", >name : string >"parentExtension" : "parentExtension" addOptions() { ->addOptions : (this: { name: string; parent: (() => any) | undefined; }) => { parent: string; overwrite: string; } +>addOptions : () => { parent: string; overwrite: string; } return { parent: "exists", overwrite: "parent" }; >{ parent: "exists", overwrite: "parent" } : { parent: string; overwrite: string; } @@ -233,11 +233,11 @@ const parentExtension = Extension.create({ }); const childExtension = parentExtension.configure({ ->childExtension : Extension ->parentExtension.configure({ child: "exists-too", // error overwrite: "child",}) : Extension ->parentExtension.configure : (options?: Partial | undefined) => Extension ->parentExtension : Extension ->configure : (options?: Partial | undefined) => Extension +>childExtension : Extension<{ parent: string; overwrite: string; }> +>parentExtension.configure({ child: "exists-too", // error overwrite: "child",}) : Extension<{ parent: string; overwrite: string; }> +>parentExtension.configure : (options?: Partial<{ parent: string; overwrite: string; }> | undefined) => Extension<{ parent: string; overwrite: string; }> +>parentExtension : Extension<{ parent: string; overwrite: string; }> +>configure : (options?: Partial<{ parent: string; overwrite: string; }> | undefined) => Extension<{ parent: string; overwrite: string; }> >{ child: "exists-too", // error overwrite: "child",} : { child: string; overwrite: string; } child: "exists-too", // error diff --git a/testdata/baselines/reference/submodule/compiler/thislessFunctionsNotContextSensitive3.types.diff b/testdata/baselines/reference/submodule/compiler/thislessFunctionsNotContextSensitive3.types.diff index c4663dec9db..0833066c99a 100644 --- a/testdata/baselines/reference/submodule/compiler/thislessFunctionsNotContextSensitive3.types.diff +++ b/testdata/baselines/reference/submodule/compiler/thislessFunctionsNotContextSensitive3.types.diff @@ -20,65 +20,15 @@ >options : Partial | undefined } -@@= skipped -17, +17 lines =@@ - >options : SuggestionOptions - - Extension.create({ -->Extension.create({ name: "slash-command", addOptions() { return { suggestion: { char: "/", } as SuggestionOptions, }; }, addProseMirrorPlugins() { return [ Suggestion({ editor: this.editor, // error ...this.options.suggestion, }), ]; },}) : Extension<{ suggestion: SuggestionOptions; }> -+>Extension.create({ name: "slash-command", addOptions() { return { suggestion: { char: "/", } as SuggestionOptions, }; }, addProseMirrorPlugins() { return [ Suggestion({ editor: this.editor, // error ...this.options.suggestion, }), ]; },}) : Extension - >Extension.create : (config: Partial>) => Extension - >Extension : typeof Extension - >create : (config: Partial>) => Extension -->{ name: "slash-command", addOptions() { return { suggestion: { char: "/", } as SuggestionOptions, }; }, addProseMirrorPlugins() { return [ Suggestion({ editor: this.editor, // error ...this.options.suggestion, }), ]; },} : { name: string; addOptions(): { suggestion: SuggestionOptions; }; addProseMirrorPlugins(this: { options: { suggestion: SuggestionOptions; }; editor: Editor; }): Plugin[]; } -+>{ name: "slash-command", addOptions() { return { suggestion: { char: "/", } as SuggestionOptions, }; }, addProseMirrorPlugins() { return [ Suggestion({ editor: this.editor, // error ...this.options.suggestion, }), ]; },} : { name: string; addOptions(this: { name: string; parent: (() => any) | undefined; }): { suggestion: SuggestionOptions; }; addProseMirrorPlugins(this: { options: any; editor: Editor; }): Plugin[]; } - - name: "slash-command", - >name : string - >"slash-command" : "slash-command" - - addOptions() { -->addOptions : () => { suggestion: SuggestionOptions; } -+>addOptions : (this: { name: string; parent: (() => any) | undefined; }) => { suggestion: SuggestionOptions; } - - return { - >{ suggestion: { char: "/", } as SuggestionOptions, } : { suggestion: SuggestionOptions; } -@@= skipped -29, +29 lines =@@ - }; - }, - addProseMirrorPlugins() { -->addProseMirrorPlugins : (this: { options: { suggestion: SuggestionOptions; }; editor: Editor; }) => Plugin[] -+>addProseMirrorPlugins : (this: { options: any; editor: Editor; }) => Plugin[] - - return [ - >[ Suggestion({ editor: this.editor, // error ...this.options.suggestion, }), ] : Plugin[] -@@= skipped -8, +8 lines =@@ +@@= skipped -54, +54 lines =@@ Suggestion({ >Suggestion({ editor: this.editor, // error ...this.options.suggestion, }) : Plugin >Suggestion : (options: SuggestionOptions) => Plugin ->{ editor: this.editor, // error ...this.options.suggestion, } : { editor: Editor; char?: string; } -+>{ editor: this.editor, // error ...this.options.suggestion, } : any ++>{ editor: this.editor, // error ...this.options.suggestion, } : { editor: Editor; char?: string | undefined; } editor: this.editor, // error >editor : Editor - >this.editor : Editor -->this : { options: { suggestion: SuggestionOptions; }; editor: Editor; } -+>this : { options: any; editor: Editor; } - >editor : Editor - - ...this.options.suggestion, -->this.options.suggestion : SuggestionOptions -->this.options : { suggestion: SuggestionOptions; } -->this : { options: { suggestion: SuggestionOptions; }; editor: Editor; } -->options : { suggestion: SuggestionOptions; } -->suggestion : SuggestionOptions -+>this.options.suggestion : any -+>this.options : any -+>this : { options: any; editor: Editor; } -+>options : any -+>suggestion : any - - }), - ]; @@= skipped -59, +59 lines =@@ Suggestion({ >Suggestion({ editor: this.editor, // error ...this.options.suggestion, }) : Plugin @@ -87,45 +37,4 @@ +>{ editor: this.editor, // error ...this.options.suggestion, } : { editor: Editor; char?: string | undefined; } editor: this.editor, // error - >editor : Editor -@@= skipped -21, +21 lines =@@ - }); - - const parentExtension = Extension.create({ -->parentExtension : Extension<{ parent: string; overwrite: string; }> -->Extension.create({ name: "parentExtension", addOptions() { return { parent: "exists", overwrite: "parent" }; },}) : Extension<{ parent: string; overwrite: string; }> -+>parentExtension : Extension -+>Extension.create({ name: "parentExtension", addOptions() { return { parent: "exists", overwrite: "parent" }; },}) : Extension - >Extension.create : (config: Partial>) => Extension - >Extension : typeof Extension - >create : (config: Partial>) => Extension -->{ name: "parentExtension", addOptions() { return { parent: "exists", overwrite: "parent" }; },} : { name: string; addOptions(): { parent: string; overwrite: string; }; } -+>{ name: "parentExtension", addOptions() { return { parent: "exists", overwrite: "parent" }; },} : { name: string; addOptions(this: { name: string; parent: (() => any) | undefined; }): { parent: string; overwrite: string; }; } - - name: "parentExtension", - >name : string - >"parentExtension" : "parentExtension" - - addOptions() { -->addOptions : () => { parent: string; overwrite: string; } -+>addOptions : (this: { name: string; parent: (() => any) | undefined; }) => { parent: string; overwrite: string; } - - return { parent: "exists", overwrite: "parent" }; - >{ parent: "exists", overwrite: "parent" } : { parent: string; overwrite: string; } -@@= skipped -25, +25 lines =@@ - }); - - const childExtension = parentExtension.configure({ -->childExtension : Extension<{ parent: string; overwrite: string; }> -->parentExtension.configure({ child: "exists-too", // error overwrite: "child",}) : Extension<{ parent: string; overwrite: string; }> -->parentExtension.configure : (options?: Partial<{ parent: string; overwrite: string; }> | undefined) => Extension<{ parent: string; overwrite: string; }> -->parentExtension : Extension<{ parent: string; overwrite: string; }> -->configure : (options?: Partial<{ parent: string; overwrite: string; }> | undefined) => Extension<{ parent: string; overwrite: string; }> -+>childExtension : Extension -+>parentExtension.configure({ child: "exists-too", // error overwrite: "child",}) : Extension -+>parentExtension.configure : (options?: Partial | undefined) => Extension -+>parentExtension : Extension -+>configure : (options?: Partial | undefined) => Extension - >{ child: "exists-too", // error overwrite: "child",} : { child: string; overwrite: string; } - - child: "exists-too", // error \ No newline at end of file + >editor : Editor \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/vueLikeDataAndPropsInference.types b/testdata/baselines/reference/submodule/compiler/vueLikeDataAndPropsInference.types index 430b61f82dc..3ff1c467d5e 100644 --- a/testdata/baselines/reference/submodule/compiler/vueLikeDataAndPropsInference.types +++ b/testdata/baselines/reference/submodule/compiler/vueLikeDataAndPropsInference.types @@ -54,7 +54,7 @@ declare function test(fn: Options): void; test({ >test({ props: { foo: '' }, data(): { bar: boolean } { return { bar: true } }, watch: { foo(newVal: string, oldVal: string): void { this.bar = false } }}) : void >test : { (fn: ThisTypedOptions): void; (fn: Options<(this: Instance) => object, {}>): 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; } @@ -67,7 +67,7 @@ test({ }, data(): { bar: boolean } { ->data : (this: Readonly<{ foo: string; }> & Instance) => { bar: boolean; } +>data : () => { bar: boolean; } >bar : boolean return { diff --git a/testdata/baselines/reference/submodule/compiler/vueLikeDataAndPropsInference.types.diff b/testdata/baselines/reference/submodule/compiler/vueLikeDataAndPropsInference.types.diff index 83a2aa91abf..aa6630506f5 100644 --- a/testdata/baselines/reference/submodule/compiler/vueLikeDataAndPropsInference.types.diff +++ b/testdata/baselines/reference/submodule/compiler/vueLikeDataAndPropsInference.types.diff @@ -16,18 +16,7 @@ test({ >test({ props: { foo: '' }, data(): { bar: boolean } { return { bar: true } }, watch: { foo(newVal: string, oldVal: string): void { this.bar = false } }}) : void ->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(): { bar: boolean; }; watch: { foo(newVal: string, oldVal: string): void; }; } +>test : { (fn: ThisTypedOptions): void; (fn: Options<(this: Instance) => object, {}>): 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; } -@@= skipped -23, +23 lines =@@ - }, - - data(): { bar: boolean } { -->data : () => { bar: boolean; } -+>data : (this: Readonly<{ foo: string; }> & Instance) => { bar: boolean; } - >bar : boolean - - return { \ No newline at end of file + props: { \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/vueLikeDataAndPropsInference2.types b/testdata/baselines/reference/submodule/compiler/vueLikeDataAndPropsInference2.types index 9c25f845689..8f5db6a5436 100644 --- a/testdata/baselines/reference/submodule/compiler/vueLikeDataAndPropsInference2.types +++ b/testdata/baselines/reference/submodule/compiler/vueLikeDataAndPropsInference2.types @@ -55,7 +55,7 @@ declare function test(fn: Options): void; test({ >test({ props: { foo: '' }, data(): { bar: boolean } { return { bar: true } }, watch: { foo(newVal: string, oldVal: string): void { this.bar = false } }}) : void >test : { (fn: ThisTypedOptions): void; (fn: Options object), PropsDefinition>>): 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; } @@ -68,7 +68,7 @@ test({ }, data(): { bar: boolean } { ->data : (this: Readonly<{ foo: string; }> & Instance) => { bar: boolean; } +>data : () => { bar: boolean; } >bar : boolean return { diff --git a/testdata/baselines/reference/submodule/compiler/vueLikeDataAndPropsInference2.types.diff b/testdata/baselines/reference/submodule/compiler/vueLikeDataAndPropsInference2.types.diff index e5428eb7cc1..dab48643754 100644 --- a/testdata/baselines/reference/submodule/compiler/vueLikeDataAndPropsInference2.types.diff +++ b/testdata/baselines/reference/submodule/compiler/vueLikeDataAndPropsInference2.types.diff @@ -16,18 +16,7 @@ test({ >test({ props: { foo: '' }, data(): { bar: boolean } { return { bar: true } }, watch: { foo(newVal: string, oldVal: string): void { this.bar = false } }}) : void ->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(): { bar: boolean; }; watch: { foo(newVal: string, oldVal: string): void; }; } +>test : { (fn: ThisTypedOptions): void; (fn: Options object), PropsDefinition>>): 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; } -@@= skipped -23, +23 lines =@@ - }, - - data(): { bar: boolean } { -->data : () => { bar: boolean; } -+>data : (this: Readonly<{ foo: string; }> & Instance) => { bar: boolean; } - >bar : boolean - - return { \ No newline at end of file + props: { \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/thisTypeInFunctions.types b/testdata/baselines/reference/submodule/conformance/thisTypeInFunctions.types index 6bdad03782f..1ddfe1dacc0 100644 --- a/testdata/baselines/reference/submodule/conformance/thisTypeInFunctions.types +++ b/testdata/baselines/reference/submodule/conformance/thisTypeInFunctions.types @@ -129,7 +129,7 @@ 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 @@ -143,7 +143,7 @@ let impl: I = { >a : any explicitVoid1() { return 12; }, ->explicitVoid1 : (this: void) => number +>explicitVoid1 : () => number >12 : 12 explicitStructural() { @@ -175,11 +175,11 @@ 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 impl.explicitVoid2 = () => 12; @@ -448,7 +448,7 @@ let anyToSpecified: (this: { y: number }, x: number) => number = function(x: num >this : { y: number; } >y : number >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 >x : number diff --git a/testdata/baselines/reference/submodule/conformance/thisTypeInFunctions.types.diff b/testdata/baselines/reference/submodule/conformance/thisTypeInFunctions.types.diff deleted file mode 100644 index 02fdb132199..00000000000 --- a/testdata/baselines/reference/submodule/conformance/thisTypeInFunctions.types.diff +++ /dev/null @@ -1,43 +0,0 @@ ---- old.thisTypeInFunctions.types -+++ new.thisTypeInFunctions.types -@@= skipped -128, +128 lines =@@ - } - 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(): 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(this: void): number; explicitStructural(this: { a: number; }): number; explicitInterface(this: I): number; explicitThis(this: I): number; } - - a: 12, - >a : number -@@= skipped -14, +14 lines =@@ - >a : any - - explicitVoid1() { return 12; }, -->explicitVoid1 : () => number -+>explicitVoid1 : (this: void) => number - >12 : 12 - - explicitStructural() { -@@= skipped -32, +32 lines =@@ - }, - } - impl.explicitVoid1 = function () { return 12; }; -->impl.explicitVoid1 = function () { return 12; } : () => number -+>impl.explicitVoid1 = function () { return 12; } : (this: void) => number - >impl.explicitVoid1 : (this: void) => number - >impl : I - >explicitVoid1 : (this: void) => number -->function () { return 12; } : () => number -+>function () { return 12; } : (this: void) => number - >12 : 12 - - impl.explicitVoid2 = () => 12; -@@= skipped -273, +273 lines =@@ - >this : { y: number; } - >y : number - >x : number -->function(x: number): number { return x + 12; } : (x: number) => number -+>function(x: number): number { return x + 12; } : (this: { y: number; }, x: number) => number - >x : number - >x + 12 : number - >x : number \ No newline at end of file