diff --git a/internal/checker/nodebuilderimpl.go b/internal/checker/nodebuilderimpl.go index b6621ad5481..a4c1b981d55 100644 --- a/internal/checker/nodebuilderimpl.go +++ b/internal/checker/nodebuilderimpl.go @@ -1992,7 +1992,7 @@ func (b *NodeBuilderImpl) serializeReturnTypeForSignature(signature *Signature, if pt != nil { // !!! TODO: If annotated type node is a reference with insufficient type arguments, we should still fall back to type serialization // see: canReuseTypeNodeAnnotation in strada for context - returnTypeNode = b.pseudoTypeToNode(pt) + returnTypeNode = b.pseudoTypeToNodeWithCheckerFallback(pt, returnType) } } restore() @@ -2096,11 +2096,11 @@ func (b *NodeBuilderImpl) serializeTypeForDeclaration(declaration *ast.Declarati if ptt != nil && requiresAddingUndefined && containsNonMissingUndefinedType(b.ch, t) && !containsNonMissingUndefinedType(b.ch, ptt) { pt = pseudochecker.NewPseudoTypeUnion([]*pseudochecker.PseudoType{pt, pseudochecker.PseudoTypeUndefined}) } - result = b.pseudoTypeToNode(pt) + result = b.pseudoTypeToNodeWithCheckerFallback(pt, t) } else if requiresAddingUndefined { pt = pseudochecker.NewPseudoTypeUnion([]*pseudochecker.PseudoType{pt, pseudochecker.PseudoTypeUndefined}) if b.pseudoTypeEquivalentToType(pt, t, false, !b.ctx.suppressReportInferenceFallback) { - result = b.pseudoTypeToNode(pt) + result = b.pseudoTypeToNodeWithCheckerFallback(pt, t) } } remove() diff --git a/internal/checker/pseudotypenodebuilder.go b/internal/checker/pseudotypenodebuilder.go index d2ecd0e951f..de896938149 100644 --- a/internal/checker/pseudotypenodebuilder.go +++ b/internal/checker/pseudotypenodebuilder.go @@ -8,6 +8,30 @@ import ( "github.com/microsoft/typescript-go/internal/pseudochecker" ) +// pseudoTypeToNodeWithCheckerFallback is like pseudoTypeToNode but when the top-level pseudo type +// is PseudoTypeInferred, it reports any error nodes and then serializes from the checker's type. +// This avoids incorrect type output when PseudoTypeInferred would derive the type from the +// original declaration expression in an instantiated context. +func (b *NodeBuilderImpl) pseudoTypeToNodeWithCheckerFallback(t *pseudochecker.PseudoType, checkerType *Type) *ast.Node { + if t.Kind == pseudochecker.PseudoTypeKindInferred { + if !b.ctx.suppressReportInferenceFallback { + if errorNodes := t.AsPseudoTypeInferred().ErrorNodes; len(errorNodes) > 0 { + for _, n := range errorNodes { + b.ctx.tracker.ReportInferenceFallback(n) + } + } else { + b.ctx.tracker.ReportInferenceFallback(t.AsPseudoTypeInferred().Expression) + } + } + oldSuppress := b.ctx.suppressReportInferenceFallback + b.ctx.suppressReportInferenceFallback = true + result := b.typeToTypeNode(checkerType) + b.ctx.suppressReportInferenceFallback = oldSuppress + return result + } + return b.pseudoTypeToNode(t) +} + // Maps a pseudochecker's pseudotypes into ast nodes and reports any inference fallback errors the pseudotype structure implies func (b *NodeBuilderImpl) pseudoTypeToNode(t *pseudochecker.PseudoType) *ast.Node { debug.Assert(t != nil, "Attempted to serialize nil pseudotype") @@ -15,8 +39,17 @@ func (b *NodeBuilderImpl) pseudoTypeToNode(t *pseudochecker.PseudoType) *ast.Nod case pseudochecker.PseudoTypeKindDirect: return b.reuseTypeNode(t.AsPseudoTypeDirect().TypeNode) case pseudochecker.PseudoTypeKindInferred: - node := t.AsPseudoTypeInferred().Expression - b.ctx.tracker.ReportInferenceFallback(node) + inferred := t.AsPseudoTypeInferred() + node := inferred.Expression + if errorNodes := inferred.ErrorNodes; len(errorNodes) > 0 { + for _, n := range errorNodes { + b.ctx.tracker.ReportInferenceFallback(n) + } + } else if ast.IsEntityNameExpression(node) && ast.IsDeclaration(node.Parent) { + b.ctx.tracker.ReportInferenceFallback(node.Parent) + } else { + b.ctx.tracker.ReportInferenceFallback(node) + } // use symbol type from parent declaration to automatically handle expression type widening without duplicating logic if ast.IsReturnStatement(node.Parent) { enclosing := ast.GetContainingFunction(node) @@ -316,6 +349,17 @@ func (b *NodeBuilderImpl) pseudoTypeEquivalentToType(t *pseudochecker.PseudoType } // otherwise, fallback to actual pseudo/type cross-comparisons switch t.Kind { + case pseudochecker.PseudoTypeKindInferred: + // PseudoTypeInferred with error nodes is always considered equivalent — + // the error nodes identify specific problematic children, and pseudoTypeToNodeWithCheckerFallback + // will report errors on them and fall back to the checker's real type. + if len(t.AsPseudoTypeInferred().ErrorNodes) > 0 { + return true + } + if reportErrors { + b.ctx.tracker.ReportInferenceFallback(t.AsPseudoTypeInferred().Expression) + } + return false case pseudochecker.PseudoTypeKindObjectLiteral: pt := t.AsPseudoTypeObjectLiteral() if type_ == nil { @@ -366,7 +410,7 @@ func (b *NodeBuilderImpl) pseudoTypeEquivalentToType(t *pseudochecker.PseudoType case pseudochecker.PseudoObjectElementKindPropertyAssignment: d := e.AsPseudoPropertyAssignment() if !b.pseudoTypeEquivalentToType(d.Type, propType, e.Optional, false) { - if reportErrors { + if reportErrors && !isStructuralPseudoType(d.Type) { b.ctx.tracker.ReportInferenceFallback(e.Name.Parent) } return false @@ -501,16 +545,22 @@ func (b *NodeBuilderImpl) pseudoTypeEquivalentToType(t *pseudochecker.PseudoType b.ctx.tracker.ReportInferenceFallback(t.AsPseudoTypeNoResult().Declaration) } return false - case pseudochecker.PseudoTypeKindInferred: - if reportErrors { - b.ctx.tracker.ReportInferenceFallback(t.AsPseudoTypeInferred().Expression) - } - return false default: return false } } +func isStructuralPseudoType(t *pseudochecker.PseudoType) bool { + switch t.Kind { + case pseudochecker.PseudoTypeKindObjectLiteral, pseudochecker.PseudoTypeKindTuple, pseudochecker.PseudoTypeKindSingleCallSignature: + return true + case pseudochecker.PseudoTypeKindMaybeConstLocation: + d := t.AsPseudoTypeMaybeConstLocation() + return isStructuralPseudoType(d.ConstType) || isStructuralPseudoType(d.RegularType) + } + return false +} + // pseudoReturnTypeMatchesPredicate checks if a pseudo return type (which should be a Direct type // wrapping a TypePredicate) matches the given type predicate from the checker. func (b *NodeBuilderImpl) pseudoReturnTypeMatchesPredicate(rt *pseudochecker.PseudoType, predicate *TypePredicate) bool { diff --git a/internal/pseudochecker/lookup.go b/internal/pseudochecker/lookup.go index 61b11558098..ac8762185df 100644 --- a/internal/pseudochecker/lookup.go +++ b/internal/pseudochecker/lookup.go @@ -85,10 +85,10 @@ func (ch *PseudoChecker) typeFromPropertyAssignment(node *ast.Node) *PseudoType init := node.Initializer() if init != nil { expr := ch.typeFromExpression(init) - if expr != nil && expr.Kind != PseudoTypeKindInferred { + if expr != nil && (expr.Kind != PseudoTypeKindInferred || len(expr.AsPseudoTypeInferred().ErrorNodes) > 0) { return expr } - // fallback to NoResult if PseudoTypeKindInferred + // fallback to NoResult if PseudoTypeKindInferred without error nodes } } return NewPseudoTypeNoResult(node) @@ -118,14 +118,14 @@ func (ch *PseudoChecker) typeFromProperty(node *ast.Node) *PseudoType { return NewPseudoTypeNoResult(node) } expr := ch.typeFromExpression(init) - if expr != nil && expr.Kind != PseudoTypeKindInferred { + if expr != nil && (expr.Kind != PseudoTypeKindInferred || len(expr.AsPseudoTypeInferred().ErrorNodes) > 0) { if expr.Kind != PseudoTypeKindDirect && node.AsPropertyDeclaration().PostfixToken != nil && node.AsPropertyDeclaration().PostfixToken.Kind == ast.KindQuestionToken { // type comes from the initializer expression on a property with a `?` - add `| undefined` to the type return addUndefinedIfDefinitelyRequired(expr) } return expr } - // fallback to NoResult if PseudoTypeKindInferred + // fallback to NoResult if PseudoTypeKindInferred without error nodes } } return NewPseudoTypeNoResult(node) @@ -144,10 +144,10 @@ func (ch *PseudoChecker) typeFromVariable(declaration *ast.VariableDeclaration) return NewPseudoTypeNoResult(declaration.AsNode()) } expr := ch.typeFromExpression(init) - if expr != nil && expr.Kind != PseudoTypeKindInferred { + if expr != nil && (expr.Kind != PseudoTypeKindInferred || len(expr.AsPseudoTypeInferred().ErrorNodes) > 0) { return expr } - // fallback to NoResult if PseudoTypeKindInferred + // fallback to NoResult if PseudoTypeKindInferred without error nodes } } return NewPseudoTypeNoResult(declaration.AsNode()) @@ -322,8 +322,8 @@ func (ch *PseudoChecker) typeFromExpression(node *ast.Node) *PseudoType { } func (ch *PseudoChecker) typeFromObjectLiteral(node *ast.ObjectLiteralExpression) *PseudoType { - if !ch.canGetTypeFromObjectLiteral(node) { - return NewPseudoTypeInferred(node.AsNode()) + if errorNodes := ch.canGetTypeFromObjectLiteral(node); errorNodes != nil { + return NewPseudoTypeInferredWithErrors(node.AsNode(), errorNodes) } // we are in a const context producing an object literal type, there are no shorthand or spread assignments if node.Properties == nil || len(node.Properties.Nodes) == 0 { @@ -409,41 +409,44 @@ func (ch *PseudoChecker) getAccessorMember(accessor *ast.Node, name *ast.Node) * return nil } -func (ch *PseudoChecker) canGetTypeFromObjectLiteral(node *ast.ObjectLiteralExpression) bool { +// canGetTypeFromObjectLiteral checks whether an object literal can be typed by the pseudochecker. +// Returns nil if the object can be typed, or a slice of error nodes (shorthand/spread properties, +// non-literal computed names) that prevent typing. +func (ch *PseudoChecker) canGetTypeFromObjectLiteral(node *ast.ObjectLiteralExpression) []*ast.Node { if node.Properties == nil || len(node.Properties.Nodes) == 0 { - return true // empty object + return nil // empty object, ok } - // !!! TODO: strada reports errors on multiple non-inferrable props - // via calling reportInferenceFallback multiple times here before returning. - // Does that logic need to be included in this checker? Or can it - // be kept to the `PseudoType` -> `Node` mapping logic, so this - // checker can avoid needing any error reporting logic? + var errorNodes []*ast.Node for _, e := range node.Properties.Nodes { if e.Flags&ast.NodeFlagsThisNodeHasError != 0 { - return false + errorNodes = append(errorNodes, e) + continue } if e.Kind == ast.KindShorthandPropertyAssignment || e.Kind == ast.KindSpreadAssignment { - return false + errorNodes = append(errorNodes, e) + continue } if e.Name().Flags&ast.NodeFlagsThisNodeHasError != 0 { - return false + errorNodes = append(errorNodes, e.Name()) + continue } if e.Name().Kind == ast.KindPrivateIdentifier { - return false + errorNodes = append(errorNodes, e) + continue } if e.Name().Kind == ast.KindComputedPropertyName { expression := e.Name().Expression() if !ast.IsPrimitiveLiteralValue(expression, false) { - return false + errorNodes = append(errorNodes, e.Name()) } } } - return true + return errorNodes } func (ch *PseudoChecker) typeFromArrayLiteral(node *ast.ArrayLiteralExpression) *PseudoType { - if !ch.canGetTypeFromArrayLiteral(node) { - return NewPseudoTypeInferred(node.AsNode()) + if errorNodes := ch.canGetTypeFromArrayLiteral(node); errorNodes != nil { + return NewPseudoTypeInferredWithErrors(node.AsNode(), errorNodes) } if IsInConstContext(node.AsNode()) && isContextuallyTyped(node.AsNode()) { return NewPseudoTypeInferred(node.AsNode()) // expr in an as const cast with a contextual type has variable readonly state, bail @@ -456,16 +459,20 @@ func (ch *PseudoChecker) typeFromArrayLiteral(node *ast.ArrayLiteralExpression) return NewPseudoTypeTuple(results) } -func (ch *PseudoChecker) canGetTypeFromArrayLiteral(node *ast.ArrayLiteralExpression) bool { +// canGetTypeFromArrayLiteral checks whether an array literal can be typed by the pseudochecker. +// Returns nil if the array can be typed, or a slice of error nodes that prevent typing. +// For non-const arrays, the error node is the array expression itself. +// For const arrays with spreads, the error node is the spread element. +func (ch *PseudoChecker) canGetTypeFromArrayLiteral(node *ast.ArrayLiteralExpression) []*ast.Node { if !IsInConstContext(node.AsNode()) { - return false + return []*ast.Node{node.AsNode()} } for _, e := range node.Elements.Nodes { if e.Kind == ast.KindSpreadElement { - return false + return []*ast.Node{e} } } - return true + return nil } // See `isConstContext` in `checker.go` - this is basically any node kind mentioned in that diff --git a/internal/pseudochecker/type.go b/internal/pseudochecker/type.go index e4e70e25af0..d9a8d1816eb 100644 --- a/internal/pseudochecker/type.go +++ b/internal/pseudochecker/type.go @@ -94,18 +94,25 @@ func (t *PseudoType) AsPseudoTypeDirect() *PseudoTypeDirect { return t.data.(*Ps // PseudoTypeInferred directly encodes the type referred to by a given Expression // These represent cases where the expression was too complex for the pseudochecker. // Most of the time, these locations will produce an error under ID. +// Specific error nodes (shorthand properties, spread assignments, etc.) are stored on the +// ErrorNodes field, collected during pseudochecker construction. type PseudoTypeInferred struct { PseudoTypeBase Expression *ast.Node + ErrorNodes []*ast.Node } func NewPseudoTypeInferred(expr *ast.Node) *PseudoType { return newPseudoType(PseudoTypeKindInferred, &PseudoTypeInferred{Expression: expr}) } +func NewPseudoTypeInferredWithErrors(expr *ast.Node, errorNodes []*ast.Node) *PseudoType { + return newPseudoType(PseudoTypeKindInferred, &PseudoTypeInferred{Expression: expr, ErrorNodes: errorNodes}) +} + func (t *PseudoType) AsPseudoTypeInferred() *PseudoTypeInferred { return t.data.(*PseudoTypeInferred) } -// PseudoTypeNoResult is anlogous to PseudoTypeInferred in that it references a case +// PseudoTypeNoResult is analogous to PseudoTypeInferred in that it references a case // where the type was too complex for the pseudochecker. Rather than an expression, however, // it is referring to the return type of a signature or declaration. type PseudoTypeNoResult struct { diff --git a/testdata/baselines/reference/submodule/compiler/computedPropertiesNarrowed.errors.txt b/testdata/baselines/reference/submodule/compiler/computedPropertiesNarrowed.errors.txt index 317bd46e115..f4aae6aa04d 100644 --- a/testdata/baselines/reference/submodule/compiler/computedPropertiesNarrowed.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/computedPropertiesNarrowed.errors.txt @@ -1,12 +1,12 @@ -computedPropertiesNarrowed.ts(4,12): error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. -computedPropertiesNarrowed.ts(10,12): error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. -computedPropertiesNarrowed.ts(18,12): error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. -computedPropertiesNarrowed.ts(21,12): error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. -computedPropertiesNarrowed.ts(25,12): error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. -computedPropertiesNarrowed.ts(30,12): error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. -computedPropertiesNarrowed.ts(36,12): error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. -computedPropertiesNarrowed.ts(41,14): error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. -computedPropertiesNarrowed.ts(46,14): error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. +computedPropertiesNarrowed.ts(5,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. +computedPropertiesNarrowed.ts(11,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. +computedPropertiesNarrowed.ts(18,20): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. +computedPropertiesNarrowed.ts(22,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. +computedPropertiesNarrowed.ts(26,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. +computedPropertiesNarrowed.ts(31,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. +computedPropertiesNarrowed.ts(37,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. +computedPropertiesNarrowed.ts(42,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. +computedPropertiesNarrowed.ts(47,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. ==== computedPropertiesNarrowed.ts (9 errors) ==== @@ -14,19 +14,19 @@ computedPropertiesNarrowed.ts(46,14): error TS9010: Variable must have an explic declare function assert(n: number): asserts n is 1; assert(x); export let o = { - ~ -!!! error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. -!!! related TS9027 computedPropertiesNarrowed.ts:4:12: Add a type annotation to the variable o. [x]: 1 // error narrow type !== declared type + ~~~ +!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. +!!! related TS9027 computedPropertiesNarrowed.ts:4:12: Add a type annotation to the variable o. } const y: 0 = 0 export let o2 = { - ~~ -!!! error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. -!!! related TS9027 computedPropertiesNarrowed.ts:10:12: Add a type annotation to the variable o2. [y]: 1 // ok literal computed type + ~~~ +!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. +!!! related TS9027 computedPropertiesNarrowed.ts:10:12: Add a type annotation to the variable o2. } // literals are ok @@ -34,55 +34,55 @@ computedPropertiesNarrowed.ts(46,14): error TS9010: Variable must have an explic export let o31 = { [-1]: 1 } export let o32 = { [1-1]: 1 } // error number - ~~~ -!!! error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. + ~~~~~ +!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. !!! related TS9027 computedPropertiesNarrowed.ts:18:12: Add a type annotation to the variable o32. let u = Symbol(); export let o4 = { - ~~ -!!! error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. -!!! related TS9027 computedPropertiesNarrowed.ts:21:12: Add a type annotation to the variable o4. [u]: 1 // Should error, nut a unique symbol + ~~~ +!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. +!!! related TS9027 computedPropertiesNarrowed.ts:21:12: Add a type annotation to the variable o4. } export let o5 ={ - ~~ -!!! error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. -!!! related TS9027 computedPropertiesNarrowed.ts:25:12: Add a type annotation to the variable o5. [Symbol()]: 1 // Should error + ~~~~~~~~~~ +!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. +!!! related TS9027 computedPropertiesNarrowed.ts:25:12: Add a type annotation to the variable o5. } const uu: unique symbol = Symbol(); export let o6 = { - ~~ -!!! error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. -!!! related TS9027 computedPropertiesNarrowed.ts:30:12: Add a type annotation to the variable o6. [uu]: 1 // Should be ok + ~~~~ +!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. +!!! related TS9027 computedPropertiesNarrowed.ts:30:12: Add a type annotation to the variable o6. } function foo (): 1 { return 1; } export let o7 = { - ~~ -!!! error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. -!!! related TS9027 computedPropertiesNarrowed.ts:36:12: Add a type annotation to the variable o7. [foo()]: 1 // Should error + ~~~~~~~ +!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. +!!! related TS9027 computedPropertiesNarrowed.ts:36:12: Add a type annotation to the variable o7. }; let E = { A: 1 } as const export const o8 = { - ~~ -!!! error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. -!!! related TS9027 computedPropertiesNarrowed.ts:41:14: Add a type annotation to the variable o8. [E.A]: 1 // Fresh + ~~~~~ +!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. +!!! related TS9027 computedPropertiesNarrowed.ts:41:14: Add a type annotation to the variable o8. } function ns() { return { v: 0 } as const } export const o9 = { - ~~ -!!! error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. -!!! related TS9027 computedPropertiesNarrowed.ts:46:14: Add a type annotation to the variable o9. [ns().v]: 1 + ~~~~~~~~ +!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. +!!! related TS9027 computedPropertiesNarrowed.ts:46:14: Add a type annotation to the variable o9. } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/computedPropertiesNarrowed.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/computedPropertiesNarrowed.errors.txt.diff index 9655452d5a2..182799637a9 100644 --- a/testdata/baselines/reference/submodule/compiler/computedPropertiesNarrowed.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/computedPropertiesNarrowed.errors.txt.diff @@ -1,65 +1,23 @@ --- old.computedPropertiesNarrowed.errors.txt +++ new.computedPropertiesNarrowed.errors.txt @@= skipped -0, +0 lines =@@ --computedPropertiesNarrowed.ts(5,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. --computedPropertiesNarrowed.ts(11,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. --computedPropertiesNarrowed.ts(18,20): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. + computedPropertiesNarrowed.ts(5,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. + computedPropertiesNarrowed.ts(11,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. + computedPropertiesNarrowed.ts(18,20): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. -computedPropertiesNarrowed.ts(20,5): error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. --computedPropertiesNarrowed.ts(22,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. --computedPropertiesNarrowed.ts(26,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. --computedPropertiesNarrowed.ts(31,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. --computedPropertiesNarrowed.ts(37,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. --computedPropertiesNarrowed.ts(42,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. --computedPropertiesNarrowed.ts(47,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. -- -- + computedPropertiesNarrowed.ts(22,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. + computedPropertiesNarrowed.ts(26,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. + computedPropertiesNarrowed.ts(31,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. +@@= skipped -9, +8 lines =@@ + computedPropertiesNarrowed.ts(47,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. + + -==== computedPropertiesNarrowed.ts (10 errors) ==== -+computedPropertiesNarrowed.ts(4,12): error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. -+computedPropertiesNarrowed.ts(10,12): error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. -+computedPropertiesNarrowed.ts(18,12): error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. -+computedPropertiesNarrowed.ts(21,12): error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. -+computedPropertiesNarrowed.ts(25,12): error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. -+computedPropertiesNarrowed.ts(30,12): error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. -+computedPropertiesNarrowed.ts(36,12): error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. -+computedPropertiesNarrowed.ts(41,14): error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. -+computedPropertiesNarrowed.ts(46,14): error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. -+ -+ +==== computedPropertiesNarrowed.ts (9 errors) ==== const x: 0 | 1 = Math.random()? 0: 1; declare function assert(n: number): asserts n is 1; assert(x); - export let o = { -- [x]: 1 // error narrow type !== declared type -- ~~~ --!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. -+ ~ -+!!! error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. - !!! related TS9027 computedPropertiesNarrowed.ts:4:12: Add a type annotation to the variable o. -+ [x]: 1 // error narrow type !== declared type - } - - - const y: 0 = 0 - export let o2 = { -- [y]: 1 // ok literal computed type -- ~~~ --!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. -+ ~~ -+!!! error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. - !!! related TS9027 computedPropertiesNarrowed.ts:10:12: Add a type annotation to the variable o2. -+ [y]: 1 // ok literal computed type - } - - // literals are ok -@@= skipped -34, +33 lines =@@ - export let o31 = { [-1]: 1 } - - export let o32 = { [1-1]: 1 } // error number -- ~~~~~ --!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. -+ ~~~ -+!!! error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. +@@= skipped -30, +30 lines =@@ !!! related TS9027 computedPropertiesNarrowed.ts:18:12: Add a type annotation to the variable o32. let u = Symbol(); @@ -67,67 +25,5 @@ -!!! error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. -!!! related TS9027 computedPropertiesNarrowed.ts:20:5: Add a type annotation to the variable u. export let o4 = { -- [u]: 1 // Should error, nut a unique symbol -- ~~~ --!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. -+ ~~ -+!!! error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. - !!! related TS9027 computedPropertiesNarrowed.ts:21:12: Add a type annotation to the variable o4. -+ [u]: 1 // Should error, nut a unique symbol - } - - export let o5 ={ -- [Symbol()]: 1 // Should error -- ~~~~~~~~~~ --!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. -+ ~~ -+!!! error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. - !!! related TS9027 computedPropertiesNarrowed.ts:25:12: Add a type annotation to the variable o5. -+ [Symbol()]: 1 // Should error - } - - const uu: unique symbol = Symbol(); - export let o6 = { -- [uu]: 1 // Should be ok -- ~~~~ --!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. -+ ~~ -+!!! error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. - !!! related TS9027 computedPropertiesNarrowed.ts:30:12: Add a type annotation to the variable o6. -+ [uu]: 1 // Should be ok - } - - - function foo (): 1 { return 1; } - export let o7 = { -- [foo()]: 1 // Should error -- ~~~~~~~ --!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. -+ ~~ -+!!! error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. - !!! related TS9027 computedPropertiesNarrowed.ts:36:12: Add a type annotation to the variable o7. -+ [foo()]: 1 // Should error - }; - - let E = { A: 1 } as const - export const o8 = { -- [E.A]: 1 // Fresh -- ~~~~~ --!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. -+ ~~ -+!!! error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. - !!! related TS9027 computedPropertiesNarrowed.ts:41:14: Add a type annotation to the variable o8. -+ [E.A]: 1 // Fresh - } - - function ns() { return { v: 0 } as const } - export const o9 = { -- [ns().v]: 1 -- ~~~~~~~~ --!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. -+ ~~ -+!!! error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. - !!! related TS9027 computedPropertiesNarrowed.ts:46:14: Add a type annotation to the variable o9. -+ [ns().v]: 1 - } - \ No newline at end of file + [u]: 1 // Should error, nut a unique symbol + ~~~ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/conditionalTypeDoesntSpinForever.types b/testdata/baselines/reference/submodule/compiler/conditionalTypeDoesntSpinForever.types index 9ec3885db2e..4d702402d00 100644 --- a/testdata/baselines/reference/submodule/compiler/conditionalTypeDoesntSpinForever.types +++ b/testdata/baselines/reference/submodule/compiler/conditionalTypeDoesntSpinForever.types @@ -46,8 +46,8 @@ export enum PubSubRecordIsStoredInRedisAsA { } const buildNameFieldConstructor = (soFar: SO_FAR) => ( ->buildNameFieldConstructor : (soFar: SO_FAR) => {} | { name: (instance?: TYPE) => BuildPubSubRecordType; } ->(soFar: SO_FAR) => ( "name" in soFar ? {} : { name: (instance: TYPE = undefined) => buildPubSubRecordType(Object.assign({}, soFar, {name: instance as TYPE}) as SO_FAR & {name: TYPE}) as BuildPubSubRecordType } ) : (soFar: SO_FAR) => {} | { name: (instance?: TYPE) => BuildPubSubRecordType; } +>buildNameFieldConstructor : (soFar: SO_FAR) => { name?: undefined; } | { name: (instance?: TYPE) => BuildPubSubRecordType; } +>(soFar: SO_FAR) => ( "name" in soFar ? {} : { name: (instance: TYPE = undefined) => buildPubSubRecordType(Object.assign({}, soFar, {name: instance as TYPE}) as SO_FAR & {name: TYPE}) as BuildPubSubRecordType } ) : (soFar: SO_FAR) => { name?: undefined; } | { name: (instance?: TYPE) => BuildPubSubRecordType; } >soFar : SO_FAR >( "name" in soFar ? {} : { name: (instance: TYPE = undefined) => buildPubSubRecordType(Object.assign({}, soFar, {name: instance as TYPE}) as SO_FAR & {name: TYPE}) as BuildPubSubRecordType } ) : {} | { name: (instance?: TYPE) => BuildPubSubRecordType; } @@ -103,8 +103,8 @@ export enum PubSubRecordIsStoredInRedisAsA { } const buildStoredAsConstructor = (soFar: SO_FAR) => ( ->buildStoredAsConstructor : (soFar: SO_FAR) => {} | { storedAsJsonEncodedRedisString: () => BuildPubSubRecordType; storedAsRedisHash: () => BuildPubSubRecordType; } ->(soFar: SO_FAR) => ( "storedAs" in soFar ? {} : { storedAsJsonEncodedRedisString: () => buildPubSubRecordType(Object.assign({}, soFar, {storedAs: PubSubRecordIsStoredInRedisAsA.jsonEncodedRedisString})) as BuildPubSubRecordType, storedAsRedisHash: () => buildPubSubRecordType(Object.assign({}, soFar, {storedAs: PubSubRecordIsStoredInRedisAsA.redisHash})) as BuildPubSubRecordType, } ) : (soFar: SO_FAR) => {} | { storedAsJsonEncodedRedisString: () => BuildPubSubRecordType; storedAsRedisHash: () => BuildPubSubRecordType; } +>buildStoredAsConstructor : (soFar: SO_FAR) => { storedAsJsonEncodedRedisString?: undefined; storedAsRedisHash?: undefined; } | { storedAsJsonEncodedRedisString: () => BuildPubSubRecordType; storedAsRedisHash: () => BuildPubSubRecordType; } +>(soFar: SO_FAR) => ( "storedAs" in soFar ? {} : { storedAsJsonEncodedRedisString: () => buildPubSubRecordType(Object.assign({}, soFar, {storedAs: PubSubRecordIsStoredInRedisAsA.jsonEncodedRedisString})) as BuildPubSubRecordType, storedAsRedisHash: () => buildPubSubRecordType(Object.assign({}, soFar, {storedAs: PubSubRecordIsStoredInRedisAsA.redisHash})) as BuildPubSubRecordType, } ) : (soFar: SO_FAR) => { storedAsJsonEncodedRedisString?: undefined; storedAsRedisHash?: undefined; } | { storedAsJsonEncodedRedisString: () => BuildPubSubRecordType; storedAsRedisHash: () => BuildPubSubRecordType; } >soFar : SO_FAR >( "storedAs" in soFar ? {} : { storedAsJsonEncodedRedisString: () => buildPubSubRecordType(Object.assign({}, soFar, {storedAs: PubSubRecordIsStoredInRedisAsA.jsonEncodedRedisString})) as BuildPubSubRecordType, storedAsRedisHash: () => buildPubSubRecordType(Object.assign({}, soFar, {storedAs: PubSubRecordIsStoredInRedisAsA.redisHash})) as BuildPubSubRecordType, } ) : {} | { storedAsJsonEncodedRedisString: () => BuildPubSubRecordType; storedAsRedisHash: () => BuildPubSubRecordType; } @@ -183,8 +183,8 @@ export enum PubSubRecordIsStoredInRedisAsA { } : {} const buildIdentifierFieldConstructor = (soFar: SO_FAR) => ( ->buildIdentifierFieldConstructor : (soFar: SO_FAR) => {} | { identifier: (instance?: TYPE) => BuildPubSubRecordType; } ->(soFar: SO_FAR) => ( "identifier" in soFar || (!("record" in soFar)) ? {} : { identifier: (instance: TYPE = undefined) => buildPubSubRecordType(Object.assign({}, soFar, {identifier: instance as TYPE}) as SO_FAR & {identifier: TYPE}) as BuildPubSubRecordType } ) : (soFar: SO_FAR) => {} | { identifier: (instance?: TYPE) => BuildPubSubRecordType; } +>buildIdentifierFieldConstructor : (soFar: SO_FAR) => { identifier?: undefined; } | { identifier: (instance?: TYPE) => BuildPubSubRecordType; } +>(soFar: SO_FAR) => ( "identifier" in soFar || (!("record" in soFar)) ? {} : { identifier: (instance: TYPE = undefined) => buildPubSubRecordType(Object.assign({}, soFar, {identifier: instance as TYPE}) as SO_FAR & {identifier: TYPE}) as BuildPubSubRecordType } ) : (soFar: SO_FAR) => { identifier?: undefined; } | { identifier: (instance?: TYPE) => BuildPubSubRecordType; } >soFar : SO_FAR >( "identifier" in soFar || (!("record" in soFar)) ? {} : { identifier: (instance: TYPE = undefined) => buildPubSubRecordType(Object.assign({}, soFar, {identifier: instance as TYPE}) as SO_FAR & {identifier: TYPE}) as BuildPubSubRecordType } ) : {} | { identifier: (instance?: TYPE) => BuildPubSubRecordType; } @@ -242,8 +242,8 @@ export enum PubSubRecordIsStoredInRedisAsA { } const buildRecordFieldConstructor = (soFar: SO_FAR) => ( ->buildRecordFieldConstructor : (soFar: SO_FAR) => {} | { record: (instance?: TYPE) => BuildPubSubRecordType; } ->(soFar: SO_FAR) => ( "record" in soFar ? {} : { record: (instance: TYPE = undefined) => buildPubSubRecordType(Object.assign({}, soFar, {record: instance as TYPE}) as SO_FAR & {record: TYPE}) as BuildPubSubRecordType } ) : (soFar: SO_FAR) => {} | { record: (instance?: TYPE) => BuildPubSubRecordType; } +>buildRecordFieldConstructor : (soFar: SO_FAR) => { record?: undefined; } | { record: (instance?: TYPE) => BuildPubSubRecordType; } +>(soFar: SO_FAR) => ( "record" in soFar ? {} : { record: (instance: TYPE = undefined) => buildPubSubRecordType(Object.assign({}, soFar, {record: instance as TYPE}) as SO_FAR & {record: TYPE}) as BuildPubSubRecordType } ) : (soFar: SO_FAR) => { record?: undefined; } | { record: (instance?: TYPE) => BuildPubSubRecordType; } >soFar : SO_FAR >( "record" in soFar ? {} : { record: (instance: TYPE = undefined) => buildPubSubRecordType(Object.assign({}, soFar, {record: instance as TYPE}) as SO_FAR & {record: TYPE}) as BuildPubSubRecordType } ) : {} | { record: (instance?: TYPE) => BuildPubSubRecordType; } @@ -376,8 +376,8 @@ export enum PubSubRecordIsStoredInRedisAsA { } : {} const buildType = (soFar: SO_FAR) => ( ->buildType : (soFar: SO_FAR) => {} | { type: SO_FAR; fields: () => Set; hasField: (fieldName: string | number | symbol) => boolean; } ->(soFar: SO_FAR) => ( "identifier" in soFar && "object" in soFar && "maxMsToWaitBeforePublishing" in soFar && "PubSubRecordIsStoredInRedisAsA" in soFar ? {} : { type: soFar, fields: () => new Set(Object.keys(soFar) as (keyof SO_FAR)[]), hasField: (fieldName: string | number | symbol) => fieldName in soFar } ) : (soFar: SO_FAR) => {} | { type: SO_FAR; fields: () => Set; hasField: (fieldName: string | number | symbol) => boolean; } +>buildType : (soFar: SO_FAR) => { type?: undefined; fields?: undefined; hasField?: undefined; } | { type: SO_FAR; fields: () => Set; hasField: (fieldName: string | number | symbol) => boolean; } +>(soFar: SO_FAR) => ( "identifier" in soFar && "object" in soFar && "maxMsToWaitBeforePublishing" in soFar && "PubSubRecordIsStoredInRedisAsA" in soFar ? {} : { type: soFar, fields: () => new Set(Object.keys(soFar) as (keyof SO_FAR)[]), hasField: (fieldName: string | number | symbol) => fieldName in soFar } ) : (soFar: SO_FAR) => { type?: undefined; fields?: undefined; hasField?: undefined; } | { type: SO_FAR; fields: () => Set; hasField: (fieldName: string | number | symbol) => boolean; } >soFar : SO_FAR >( "identifier" in soFar && "object" in soFar && "maxMsToWaitBeforePublishing" in soFar && "PubSubRecordIsStoredInRedisAsA" in soFar ? {} : { type: soFar, fields: () => new Set(Object.keys(soFar) as (keyof SO_FAR)[]), hasField: (fieldName: string | number | symbol) => fieldName in soFar } ) : {} | { type: SO_FAR; fields: () => Set; hasField: (fieldName: string | number | symbol) => boolean; } @@ -452,22 +452,22 @@ export enum PubSubRecordIsStoredInRedisAsA { buildNameFieldConstructor(soFar), >buildNameFieldConstructor(soFar) : { name?: undefined; } | { name: (instance?: TYPE) => BuildPubSubRecordType; } ->buildNameFieldConstructor : (soFar: SO_FAR_1) => {} | { name: (instance?: TYPE) => BuildPubSubRecordType; } +>buildNameFieldConstructor : (soFar: SO_FAR_1) => { name?: undefined; } | { name: (instance?: TYPE) => BuildPubSubRecordType; } >soFar : SO_FAR buildIdentifierFieldConstructor(soFar), >buildIdentifierFieldConstructor(soFar) : { identifier?: undefined; } | { identifier: (instance?: TYPE) => BuildPubSubRecordType; } ->buildIdentifierFieldConstructor : (soFar: SO_FAR_1) => {} | { identifier: (instance?: TYPE) => BuildPubSubRecordType; } +>buildIdentifierFieldConstructor : (soFar: SO_FAR_1) => { identifier?: undefined; } | { identifier: (instance?: TYPE) => BuildPubSubRecordType; } >soFar : SO_FAR buildRecordFieldConstructor(soFar), >buildRecordFieldConstructor(soFar) : { record?: undefined; } | { record: (instance?: TYPE) => BuildPubSubRecordType; } ->buildRecordFieldConstructor : (soFar: SO_FAR_1) => {} | { record: (instance?: TYPE) => BuildPubSubRecordType; } +>buildRecordFieldConstructor : (soFar: SO_FAR_1) => { record?: undefined; } | { record: (instance?: TYPE) => BuildPubSubRecordType; } >soFar : SO_FAR buildStoredAsConstructor(soFar), >buildStoredAsConstructor(soFar) : { storedAsJsonEncodedRedisString?: undefined; storedAsRedisHash?: undefined; } | { storedAsJsonEncodedRedisString: () => BuildPubSubRecordType; storedAsRedisHash: () => BuildPubSubRecordType; } ->buildStoredAsConstructor : (soFar: SO_FAR_1) => {} | { storedAsJsonEncodedRedisString: () => BuildPubSubRecordType; storedAsRedisHash: () => BuildPubSubRecordType; } +>buildStoredAsConstructor : (soFar: SO_FAR_1) => { storedAsJsonEncodedRedisString?: undefined; storedAsRedisHash?: undefined; } | { storedAsJsonEncodedRedisString: () => BuildPubSubRecordType; storedAsRedisHash: () => BuildPubSubRecordType; } >soFar : SO_FAR buildMaxMsToWaitBeforePublishingFieldConstructor(soFar), @@ -477,7 +477,7 @@ export enum PubSubRecordIsStoredInRedisAsA { buildType(soFar) >buildType(soFar) : { type?: undefined; fields?: undefined; hasField?: undefined; } | { type: SO_FAR; fields: () => Set; hasField: (fieldName: string | number | symbol) => boolean; } ->buildType : (soFar: SO_FAR_1) => {} | { type: SO_FAR_1; fields: () => Set; hasField: (fieldName: string | number | symbol) => boolean; } +>buildType : (soFar: SO_FAR_1) => { type?: undefined; fields?: undefined; hasField?: undefined; } | { type: SO_FAR_1; fields: () => Set; hasField: (fieldName: string | number | symbol) => boolean; } >soFar : SO_FAR ) as BuildPubSubRecordType; diff --git a/testdata/baselines/reference/submodule/compiler/conditionalTypeDoesntSpinForever.types.diff b/testdata/baselines/reference/submodule/compiler/conditionalTypeDoesntSpinForever.types.diff deleted file mode 100644 index f2e505b4c53..00000000000 --- a/testdata/baselines/reference/submodule/compiler/conditionalTypeDoesntSpinForever.types.diff +++ /dev/null @@ -1,93 +0,0 @@ ---- old.conditionalTypeDoesntSpinForever.types -+++ new.conditionalTypeDoesntSpinForever.types -@@= skipped -45, +45 lines =@@ - } - - const buildNameFieldConstructor = (soFar: SO_FAR) => ( -->buildNameFieldConstructor : (soFar: SO_FAR) => { name?: undefined; } | { name: (instance?: TYPE) => BuildPubSubRecordType; } -->(soFar: SO_FAR) => ( "name" in soFar ? {} : { name: (instance: TYPE = undefined) => buildPubSubRecordType(Object.assign({}, soFar, {name: instance as TYPE}) as SO_FAR & {name: TYPE}) as BuildPubSubRecordType } ) : (soFar: SO_FAR) => { name?: undefined; } | { name: (instance?: TYPE) => BuildPubSubRecordType; } -+>buildNameFieldConstructor : (soFar: SO_FAR) => {} | { name: (instance?: TYPE) => BuildPubSubRecordType; } -+>(soFar: SO_FAR) => ( "name" in soFar ? {} : { name: (instance: TYPE = undefined) => buildPubSubRecordType(Object.assign({}, soFar, {name: instance as TYPE}) as SO_FAR & {name: TYPE}) as BuildPubSubRecordType } ) : (soFar: SO_FAR) => {} | { name: (instance?: TYPE) => BuildPubSubRecordType; } - >soFar : SO_FAR - >( "name" in soFar ? {} : { name: (instance: TYPE = undefined) => buildPubSubRecordType(Object.assign({}, soFar, {name: instance as TYPE}) as SO_FAR & {name: TYPE}) as BuildPubSubRecordType } ) : {} | { name: (instance?: TYPE) => BuildPubSubRecordType; } - -@@= skipped -57, +57 lines =@@ - } - - const buildStoredAsConstructor = (soFar: SO_FAR) => ( -->buildStoredAsConstructor : (soFar: SO_FAR) => { storedAsJsonEncodedRedisString?: undefined; storedAsRedisHash?: undefined; } | { storedAsJsonEncodedRedisString: () => BuildPubSubRecordType; storedAsRedisHash: () => BuildPubSubRecordType; } -->(soFar: SO_FAR) => ( "storedAs" in soFar ? {} : { storedAsJsonEncodedRedisString: () => buildPubSubRecordType(Object.assign({}, soFar, {storedAs: PubSubRecordIsStoredInRedisAsA.jsonEncodedRedisString})) as BuildPubSubRecordType, storedAsRedisHash: () => buildPubSubRecordType(Object.assign({}, soFar, {storedAs: PubSubRecordIsStoredInRedisAsA.redisHash})) as BuildPubSubRecordType, } ) : (soFar: SO_FAR) => { storedAsJsonEncodedRedisString?: undefined; storedAsRedisHash?: undefined; } | { storedAsJsonEncodedRedisString: () => BuildPubSubRecordType; storedAsRedisHash: () => BuildPubSubRecordType; } -+>buildStoredAsConstructor : (soFar: SO_FAR) => {} | { storedAsJsonEncodedRedisString: () => BuildPubSubRecordType; storedAsRedisHash: () => BuildPubSubRecordType; } -+>(soFar: SO_FAR) => ( "storedAs" in soFar ? {} : { storedAsJsonEncodedRedisString: () => buildPubSubRecordType(Object.assign({}, soFar, {storedAs: PubSubRecordIsStoredInRedisAsA.jsonEncodedRedisString})) as BuildPubSubRecordType, storedAsRedisHash: () => buildPubSubRecordType(Object.assign({}, soFar, {storedAs: PubSubRecordIsStoredInRedisAsA.redisHash})) as BuildPubSubRecordType, } ) : (soFar: SO_FAR) => {} | { storedAsJsonEncodedRedisString: () => BuildPubSubRecordType; storedAsRedisHash: () => BuildPubSubRecordType; } - >soFar : SO_FAR - >( "storedAs" in soFar ? {} : { storedAsJsonEncodedRedisString: () => buildPubSubRecordType(Object.assign({}, soFar, {storedAs: PubSubRecordIsStoredInRedisAsA.jsonEncodedRedisString})) as BuildPubSubRecordType, storedAsRedisHash: () => buildPubSubRecordType(Object.assign({}, soFar, {storedAs: PubSubRecordIsStoredInRedisAsA.redisHash})) as BuildPubSubRecordType, } ) : {} | { storedAsJsonEncodedRedisString: () => BuildPubSubRecordType; storedAsRedisHash: () => BuildPubSubRecordType; } - -@@= skipped -80, +80 lines =@@ - } : {} - - const buildIdentifierFieldConstructor = (soFar: SO_FAR) => ( -->buildIdentifierFieldConstructor : (soFar: SO_FAR) => { identifier?: undefined; } | { identifier: (instance?: TYPE) => BuildPubSubRecordType; } -->(soFar: SO_FAR) => ( "identifier" in soFar || (!("record" in soFar)) ? {} : { identifier: (instance: TYPE = undefined) => buildPubSubRecordType(Object.assign({}, soFar, {identifier: instance as TYPE}) as SO_FAR & {identifier: TYPE}) as BuildPubSubRecordType } ) : (soFar: SO_FAR) => { identifier?: undefined; } | { identifier: (instance?: TYPE) => BuildPubSubRecordType; } -+>buildIdentifierFieldConstructor : (soFar: SO_FAR) => {} | { identifier: (instance?: TYPE) => BuildPubSubRecordType; } -+>(soFar: SO_FAR) => ( "identifier" in soFar || (!("record" in soFar)) ? {} : { identifier: (instance: TYPE = undefined) => buildPubSubRecordType(Object.assign({}, soFar, {identifier: instance as TYPE}) as SO_FAR & {identifier: TYPE}) as BuildPubSubRecordType } ) : (soFar: SO_FAR) => {} | { identifier: (instance?: TYPE) => BuildPubSubRecordType; } - >soFar : SO_FAR - >( "identifier" in soFar || (!("record" in soFar)) ? {} : { identifier: (instance: TYPE = undefined) => buildPubSubRecordType(Object.assign({}, soFar, {identifier: instance as TYPE}) as SO_FAR & {identifier: TYPE}) as BuildPubSubRecordType } ) : {} | { identifier: (instance?: TYPE) => BuildPubSubRecordType; } - -@@= skipped -59, +59 lines =@@ - } - - const buildRecordFieldConstructor = (soFar: SO_FAR) => ( -->buildRecordFieldConstructor : (soFar: SO_FAR) => { record?: undefined; } | { record: (instance?: TYPE) => BuildPubSubRecordType; } -->(soFar: SO_FAR) => ( "record" in soFar ? {} : { record: (instance: TYPE = undefined) => buildPubSubRecordType(Object.assign({}, soFar, {record: instance as TYPE}) as SO_FAR & {record: TYPE}) as BuildPubSubRecordType } ) : (soFar: SO_FAR) => { record?: undefined; } | { record: (instance?: TYPE) => BuildPubSubRecordType; } -+>buildRecordFieldConstructor : (soFar: SO_FAR) => {} | { record: (instance?: TYPE) => BuildPubSubRecordType; } -+>(soFar: SO_FAR) => ( "record" in soFar ? {} : { record: (instance: TYPE = undefined) => buildPubSubRecordType(Object.assign({}, soFar, {record: instance as TYPE}) as SO_FAR & {record: TYPE}) as BuildPubSubRecordType } ) : (soFar: SO_FAR) => {} | { record: (instance?: TYPE) => BuildPubSubRecordType; } - >soFar : SO_FAR - >( "record" in soFar ? {} : { record: (instance: TYPE = undefined) => buildPubSubRecordType(Object.assign({}, soFar, {record: instance as TYPE}) as SO_FAR & {record: TYPE}) as BuildPubSubRecordType } ) : {} | { record: (instance?: TYPE) => BuildPubSubRecordType; } - -@@= skipped -134, +134 lines =@@ - } : {} - - const buildType = (soFar: SO_FAR) => ( -->buildType : (soFar: SO_FAR) => { type?: undefined; fields?: undefined; hasField?: undefined; } | { type: SO_FAR; fields: () => Set; hasField: (fieldName: string | number | symbol) => boolean; } -->(soFar: SO_FAR) => ( "identifier" in soFar && "object" in soFar && "maxMsToWaitBeforePublishing" in soFar && "PubSubRecordIsStoredInRedisAsA" in soFar ? {} : { type: soFar, fields: () => new Set(Object.keys(soFar) as (keyof SO_FAR)[]), hasField: (fieldName: string | number | symbol) => fieldName in soFar } ) : (soFar: SO_FAR) => { type?: undefined; fields?: undefined; hasField?: undefined; } | { type: SO_FAR; fields: () => Set; hasField: (fieldName: string | number | symbol) => boolean; } -+>buildType : (soFar: SO_FAR) => {} | { type: SO_FAR; fields: () => Set; hasField: (fieldName: string | number | symbol) => boolean; } -+>(soFar: SO_FAR) => ( "identifier" in soFar && "object" in soFar && "maxMsToWaitBeforePublishing" in soFar && "PubSubRecordIsStoredInRedisAsA" in soFar ? {} : { type: soFar, fields: () => new Set(Object.keys(soFar) as (keyof SO_FAR)[]), hasField: (fieldName: string | number | symbol) => fieldName in soFar } ) : (soFar: SO_FAR) => {} | { type: SO_FAR; fields: () => Set; hasField: (fieldName: string | number | symbol) => boolean; } - >soFar : SO_FAR - >( "identifier" in soFar && "object" in soFar && "maxMsToWaitBeforePublishing" in soFar && "PubSubRecordIsStoredInRedisAsA" in soFar ? {} : { type: soFar, fields: () => new Set(Object.keys(soFar) as (keyof SO_FAR)[]), hasField: (fieldName: string | number | symbol) => fieldName in soFar } ) : {} | { type: SO_FAR; fields: () => Set; hasField: (fieldName: string | number | symbol) => boolean; } - -@@= skipped -76, +76 lines =@@ - - buildNameFieldConstructor(soFar), - >buildNameFieldConstructor(soFar) : { name?: undefined; } | { name: (instance?: TYPE) => BuildPubSubRecordType; } -->buildNameFieldConstructor : (soFar: SO_FAR_1) => { name?: undefined; } | { name: (instance?: TYPE) => BuildPubSubRecordType; } -+>buildNameFieldConstructor : (soFar: SO_FAR_1) => {} | { name: (instance?: TYPE) => BuildPubSubRecordType; } - >soFar : SO_FAR - - buildIdentifierFieldConstructor(soFar), - >buildIdentifierFieldConstructor(soFar) : { identifier?: undefined; } | { identifier: (instance?: TYPE) => BuildPubSubRecordType; } -->buildIdentifierFieldConstructor : (soFar: SO_FAR_1) => { identifier?: undefined; } | { identifier: (instance?: TYPE) => BuildPubSubRecordType; } -+>buildIdentifierFieldConstructor : (soFar: SO_FAR_1) => {} | { identifier: (instance?: TYPE) => BuildPubSubRecordType; } - >soFar : SO_FAR - - buildRecordFieldConstructor(soFar), - >buildRecordFieldConstructor(soFar) : { record?: undefined; } | { record: (instance?: TYPE) => BuildPubSubRecordType; } -->buildRecordFieldConstructor : (soFar: SO_FAR_1) => { record?: undefined; } | { record: (instance?: TYPE) => BuildPubSubRecordType; } -+>buildRecordFieldConstructor : (soFar: SO_FAR_1) => {} | { record: (instance?: TYPE) => BuildPubSubRecordType; } - >soFar : SO_FAR - - buildStoredAsConstructor(soFar), - >buildStoredAsConstructor(soFar) : { storedAsJsonEncodedRedisString?: undefined; storedAsRedisHash?: undefined; } | { storedAsJsonEncodedRedisString: () => BuildPubSubRecordType; storedAsRedisHash: () => BuildPubSubRecordType; } -->buildStoredAsConstructor : (soFar: SO_FAR_1) => { storedAsJsonEncodedRedisString?: undefined; storedAsRedisHash?: undefined; } | { storedAsJsonEncodedRedisString: () => BuildPubSubRecordType; storedAsRedisHash: () => BuildPubSubRecordType; } -+>buildStoredAsConstructor : (soFar: SO_FAR_1) => {} | { storedAsJsonEncodedRedisString: () => BuildPubSubRecordType; storedAsRedisHash: () => BuildPubSubRecordType; } - >soFar : SO_FAR - - buildMaxMsToWaitBeforePublishingFieldConstructor(soFar), -@@= skipped -25, +25 lines =@@ - - buildType(soFar) - >buildType(soFar) : { type?: undefined; fields?: undefined; hasField?: undefined; } | { type: SO_FAR; fields: () => Set; hasField: (fieldName: string | number | symbol) => boolean; } -->buildType : (soFar: SO_FAR_1) => { type?: undefined; fields?: undefined; hasField?: undefined; } | { type: SO_FAR_1; fields: () => Set; hasField: (fieldName: string | number | symbol) => boolean; } -+>buildType : (soFar: SO_FAR_1) => {} | { type: SO_FAR_1; fields: () => Set; hasField: (fieldName: string | number | symbol) => boolean; } - >soFar : SO_FAR - - ) as BuildPubSubRecordType; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsDefault.errors.txt b/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsDefault.errors.txt index b07df12ef54..1c78fa1a4f5 100644 --- a/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsDefault.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsDefault.errors.txt @@ -1,7 +1,6 @@ a.ts(1,16): error TS9037: Default exports can't be inferred with --isolatedDeclarations. b.ts(1,23): error TS9013: Expression type can't be inferred with --isolatedDeclarations. c.ts(1,16): error TS9017: Only const arrays can be inferred with --isolatedDeclarations. -c.ts(1,24): error TS9013: Expression type can't be inferred with --isolatedDeclarations. d.ts(1,24): error TS9013: Expression type can't be inferred with --isolatedDeclarations. e.ts(1,24): error TS9013: Expression type can't be inferred with --isolatedDeclarations. @@ -20,15 +19,11 @@ e.ts(1,24): error TS9013: Expression type can't be inferred with --isolatedDecla !!! related TS9036 b.ts:1:1: Move the expression in default export to a variable and add a type annotation to it. !!! related TS9035 b.ts:1:23: Add satisfies and a type assertion to this expression (satisfies T as T) to make the type explicit. -==== c.ts (2 errors) ==== +==== c.ts (1 errors) ==== export default [{ foo: 1 + 1 }]; ~~~~~~~~~~~~~~~~ !!! error TS9017: Only const arrays can be inferred with --isolatedDeclarations. !!! related TS9036 c.ts:1:1: Move the expression in default export to a variable and add a type annotation to it. - ~~~~~ -!!! error TS9013: Expression type can't be inferred with --isolatedDeclarations. -!!! related TS9036 c.ts:1:1: Move the expression in default export to a variable and add a type annotation to it. -!!! related TS9035 c.ts:1:24: Add satisfies and a type assertion to this expression (satisfies T as T) to make the type explicit. ==== d.ts (1 errors) ==== export default [{ foo: 1 + 1 }] as const; diff --git a/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsDefault.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsDefault.errors.txt.diff deleted file mode 100644 index 251537b48dd..00000000000 --- a/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsDefault.errors.txt.diff +++ /dev/null @@ -1,27 +0,0 @@ ---- old.isolatedDeclarationErrorsDefault.errors.txt -+++ new.isolatedDeclarationErrorsDefault.errors.txt -@@= skipped -0, +0 lines =@@ - a.ts(1,16): error TS9037: Default exports can't be inferred with --isolatedDeclarations. - b.ts(1,23): error TS9013: Expression type can't be inferred with --isolatedDeclarations. - c.ts(1,16): error TS9017: Only const arrays can be inferred with --isolatedDeclarations. -+c.ts(1,24): error TS9013: Expression type can't be inferred with --isolatedDeclarations. - d.ts(1,24): error TS9013: Expression type can't be inferred with --isolatedDeclarations. - e.ts(1,24): error TS9013: Expression type can't be inferred with --isolatedDeclarations. - -@@= skipped -18, +19 lines =@@ - !!! related TS9036 b.ts:1:1: Move the expression in default export to a variable and add a type annotation to it. - !!! related TS9035 b.ts:1:23: Add satisfies and a type assertion to this expression (satisfies T as T) to make the type explicit. - --==== c.ts (1 errors) ==== -+==== c.ts (2 errors) ==== - export default [{ foo: 1 + 1 }]; - ~~~~~~~~~~~~~~~~ - !!! error TS9017: Only const arrays can be inferred with --isolatedDeclarations. - !!! related TS9036 c.ts:1:1: Move the expression in default export to a variable and add a type annotation to it. -+ ~~~~~ -+!!! error TS9013: Expression type can't be inferred with --isolatedDeclarations. -+!!! related TS9036 c.ts:1:1: Move the expression in default export to a variable and add a type annotation to it. -+!!! related TS9035 c.ts:1:24: Add satisfies and a type assertion to this expression (satisfies T as T) to make the type explicit. - - ==== d.ts (1 errors) ==== - export default [{ foo: 1 + 1 }] as const; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsExpressions.errors.txt b/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsExpressions.errors.txt index 65a5f6b97e3..3c234b8c804 100644 --- a/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsExpressions.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsExpressions.errors.txt @@ -19,8 +19,8 @@ isolatedDeclarationErrorsExpressions.ts(33,12): error TS9010: Variable must have isolatedDeclarationErrorsExpressions.ts(49,12): error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. isolatedDeclarationErrorsExpressions.ts(50,12): error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. isolatedDeclarationErrorsExpressions.ts(51,12): error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. -isolatedDeclarationErrorsExpressions.ts(53,12): error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. -isolatedDeclarationErrorsExpressions.ts(55,12): error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. +isolatedDeclarationErrorsExpressions.ts(53,18): error TS9017: Only const arrays can be inferred with --isolatedDeclarations. +isolatedDeclarationErrorsExpressions.ts(55,38): error TS9018: Arrays with spread elements can't inferred with --isolatedDeclarations. isolatedDeclarationErrorsExpressions.ts(59,12): error TS9012: Property must have an explicit type annotation with --isolatedDeclarations. isolatedDeclarationErrorsExpressions.ts(60,12): error TS9012: Property must have an explicit type annotation with --isolatedDeclarations. isolatedDeclarationErrorsExpressions.ts(61,12): error TS9012: Property must have an explicit type annotation with --isolatedDeclarations. @@ -169,13 +169,13 @@ isolatedDeclarationErrorsExpressions.ts(128,19): error TS9019: Binding elements !!! related TS9027 isolatedDeclarationErrorsExpressions.ts:51:12: Add a type annotation to the variable templateLetOk4AsConst. export let arr = [1, 2, 3]; - ~~~ -!!! error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. + ~~~~~~~~~ +!!! error TS9017: Only const arrays can be inferred with --isolatedDeclarations. !!! related TS9027 isolatedDeclarationErrorsExpressions.ts:53:12: Add a type annotation to the variable arr. export let arrConst = [1, 2, 3] as const; export let arrWithSpread = [1, 2, 3, ...arr] as const; - ~~~~~~~~~~~~~ -!!! error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. + ~~~~~~ +!!! error TS9018: Arrays with spread elements can't inferred with --isolatedDeclarations. !!! related TS9027 isolatedDeclarationErrorsExpressions.ts:55:12: Add a type annotation to the variable arrWithSpread. export class Exported { diff --git a/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsExpressions.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsExpressions.errors.txt.diff index da8ac97dc63..f79203b048b 100644 --- a/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsExpressions.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsExpressions.errors.txt.diff @@ -1,17 +1,6 @@ --- old.isolatedDeclarationErrorsExpressions.errors.txt +++ new.isolatedDeclarationErrorsExpressions.errors.txt -@@= skipped -18, +18 lines =@@ - isolatedDeclarationErrorsExpressions.ts(49,12): error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. - isolatedDeclarationErrorsExpressions.ts(50,12): error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. - isolatedDeclarationErrorsExpressions.ts(51,12): error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. --isolatedDeclarationErrorsExpressions.ts(53,18): error TS9017: Only const arrays can be inferred with --isolatedDeclarations. --isolatedDeclarationErrorsExpressions.ts(55,38): error TS9018: Arrays with spread elements can't inferred with --isolatedDeclarations. -+isolatedDeclarationErrorsExpressions.ts(53,12): error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. -+isolatedDeclarationErrorsExpressions.ts(55,12): error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. - isolatedDeclarationErrorsExpressions.ts(59,12): error TS9012: Property must have an explicit type annotation with --isolatedDeclarations. - isolatedDeclarationErrorsExpressions.ts(60,12): error TS9012: Property must have an explicit type annotation with --isolatedDeclarations. - isolatedDeclarationErrorsExpressions.ts(61,12): error TS9012: Property must have an explicit type annotation with --isolatedDeclarations. -@@= skipped -24, +24 lines =@@ +@@= skipped -42, +42 lines =@@ isolatedDeclarationErrorsExpressions.ts(104,5): error TS9012: Property must have an explicit type annotation with --isolatedDeclarations. isolatedDeclarationErrorsExpressions.ts(109,37): error TS9011: Parameter must have an explicit type annotation with --isolatedDeclarations. isolatedDeclarationErrorsExpressions.ts(110,37): error TS9011: Parameter must have an explicit type annotation with --isolatedDeclarations. @@ -24,25 +13,7 @@ isolatedDeclarationErrorsExpressions.ts(119,36): error TS9011: Parameter must have an explicit type annotation with --isolatedDeclarations. isolatedDeclarationErrorsExpressions.ts(127,16): error TS9019: Binding elements can't be exported directly with --isolatedDeclarations. isolatedDeclarationErrorsExpressions.ts(128,19): error TS9019: Binding elements can't be exported directly with --isolatedDeclarations. -@@= skipped -126, +126 lines =@@ - !!! related TS9027 isolatedDeclarationErrorsExpressions.ts:51:12: Add a type annotation to the variable templateLetOk4AsConst. - - export let arr = [1, 2, 3]; -- ~~~~~~~~~ --!!! error TS9017: Only const arrays can be inferred with --isolatedDeclarations. -+ ~~~ -+!!! error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. - !!! related TS9027 isolatedDeclarationErrorsExpressions.ts:53:12: Add a type annotation to the variable arr. - export let arrConst = [1, 2, 3] as const; - export let arrWithSpread = [1, 2, 3, ...arr] as const; -- ~~~~~~ --!!! error TS9018: Arrays with spread elements can't inferred with --isolatedDeclarations. -+ ~~~~~~~~~~~~~ -+!!! error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. - !!! related TS9027 isolatedDeclarationErrorsExpressions.ts:55:12: Add a type annotation to the variable arrWithSpread. - - export class Exported { -@@= skipped -131, +131 lines =@@ +@@= skipped -257, +257 lines =@@ !!! related TS9028 isolatedDeclarationErrorsExpressions.ts:110:33: Add a type annotation to the parameter p. export function numberParamBad3(p = numberParam): void { } ~~~~~~~~~~~ diff --git a/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsObjects.errors.txt b/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsObjects.errors.txt index 4136c28c66d..8fa23907bd2 100644 --- a/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsObjects.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsObjects.errors.txt @@ -1,23 +1,25 @@ isolatedDeclarationErrorsObjects.ts(7,8): error TS9013: Expression type can't be inferred with --isolatedDeclarations. isolatedDeclarationErrorsObjects.ts(12,12): error TS9013: Expression type can't be inferred with --isolatedDeclarations. -isolatedDeclarationErrorsObjects.ts(14,8): error TS9013: Expression type can't be inferred with --isolatedDeclarations. isolatedDeclarationErrorsObjects.ts(16,12): error TS9013: Expression type can't be inferred with --isolatedDeclarations. isolatedDeclarationErrorsObjects.ts(21,5): error TS9008: Method must have an explicit return type annotation with --isolatedDeclarations. isolatedDeclarationErrorsObjects.ts(24,5): error TS9008: Method must have an explicit return type annotation with --isolatedDeclarations. isolatedDeclarationErrorsObjects.ts(25,8): error TS9013: Expression type can't be inferred with --isolatedDeclarations. -isolatedDeclarationErrorsObjects.ts(28,10): error TS9013: Expression type can't be inferred with --isolatedDeclarations. isolatedDeclarationErrorsObjects.ts(29,9): error TS9008: Method must have an explicit return type annotation with --isolatedDeclarations. isolatedDeclarationErrorsObjects.ts(32,9): error TS9008: Method must have an explicit return type annotation with --isolatedDeclarations. isolatedDeclarationErrorsObjects.ts(40,9): error TS7032: Property 'singleSetterBad' implicitly has type 'any', because its set accessor lacks a parameter type annotation. isolatedDeclarationErrorsObjects.ts(40,25): error TS7006: Parameter 'value' implicitly has an 'any' type. isolatedDeclarationErrorsObjects.ts(40,25): error TS9009: At least one accessor must have an explicit type annotation with --isolatedDeclarations. -isolatedDeclarationErrorsObjects.ts(62,14): error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. -isolatedDeclarationErrorsObjects.ts(73,14): error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. +isolatedDeclarationErrorsObjects.ts(64,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. +isolatedDeclarationErrorsObjects.ts(65,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. +isolatedDeclarationErrorsObjects.ts(66,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. +isolatedDeclarationErrorsObjects.ts(67,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. +isolatedDeclarationErrorsObjects.ts(68,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. +isolatedDeclarationErrorsObjects.ts(75,5): error TS9015: Objects that contain spread assignments can't be inferred with --isolatedDeclarations. isolatedDeclarationErrorsObjects.ts(77,5): error TS9016: Objects that contain shorthand properties can't be inferred with --isolatedDeclarations. -isolatedDeclarationErrorsObjects.ts(83,13): error TS9013: Expression type can't be inferred with --isolatedDeclarations. +isolatedDeclarationErrorsObjects.ts(84,9): error TS9015: Objects that contain spread assignments can't be inferred with --isolatedDeclarations. -==== isolatedDeclarationErrorsObjects.ts (17 errors) ==== +==== isolatedDeclarationErrorsObjects.ts (19 errors) ==== export let o = { a: 1, b: "" @@ -40,20 +42,13 @@ isolatedDeclarationErrorsObjects.ts(83,13): error TS9013: Expression type can't !!! related TS9035 isolatedDeclarationErrorsObjects.ts:12:12: Add satisfies and a type assertion to this expression (satisfies T as T) to make the type explicit. }, c: { - ~ d: 1, - ~~~~~~~~~~~~~ e: V, - ~~~~~~~~~~~~~ ~ !!! error TS9013: Expression type can't be inferred with --isolatedDeclarations. !!! related TS9027 isolatedDeclarationErrorsObjects.ts:10:12: Add a type annotation to the variable oBad2. !!! related TS9035 isolatedDeclarationErrorsObjects.ts:16:12: Add satisfies and a type assertion to this expression (satisfies T as T) to make the type explicit. } - ~~~~~ -!!! error TS9013: Expression type can't be inferred with --isolatedDeclarations. -!!! related TS9027 isolatedDeclarationErrorsObjects.ts:10:12: Add a type annotation to the variable oBad2. -!!! related TS9035 isolatedDeclarationErrorsObjects.ts:14:8: Add satisfies and a type assertion to this expression (satisfies T as T) to make the type explicit. } export let oWithMethods = { @@ -77,28 +72,19 @@ isolatedDeclarationErrorsObjects.ts(83,13): error TS9013: Expression type can't } export let oWithMethodsNested = { foo: { - ~ method() { }, - ~~~~~~~~~~~~~~~~~~~~~ ~~~~~~ !!! error TS9008: Method must have an explicit return type annotation with --isolatedDeclarations. !!! related TS9027 isolatedDeclarationErrorsObjects.ts:27:12: Add a type annotation to the variable oWithMethodsNested. !!! related TS9034 isolatedDeclarationErrorsObjects.ts:29:9: Add a return type to the method a: 1, - ~~~~~~~~~~~~~ okMethod(): void { }, - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ bad() { } - ~~~~~~~~~~~~~~~~~ ~~~ !!! error TS9008: Method must have an explicit return type annotation with --isolatedDeclarations. !!! related TS9027 isolatedDeclarationErrorsObjects.ts:27:12: Add a type annotation to the variable oWithMethodsNested. !!! related TS9034 isolatedDeclarationErrorsObjects.ts:32:9: Add a return type to the method } - ~~~~~ -!!! error TS9013: Expression type can't be inferred with --isolatedDeclarations. -!!! related TS9027 isolatedDeclarationErrorsObjects.ts:27:12: Add a type annotation to the variable oWithMethodsNested. -!!! related TS9035 isolatedDeclarationErrorsObjects.ts:28:10: Add satisfies and a type assertion to this expression (satisfies T as T) to make the type explicit. } @@ -135,25 +121,37 @@ isolatedDeclarationErrorsObjects.ts(83,13): error TS9013: Expression type can't V = 10, } export const oWithComputedProperties = { - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. -!!! related TS9027 isolatedDeclarationErrorsObjects.ts:62:14: Add a type annotation to the variable oWithComputedProperties. [1]: 1, [1 + 3]: 1, + ~~~~~~~ +!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. +!!! related TS9027 isolatedDeclarationErrorsObjects.ts:62:14: Add a type annotation to the variable oWithComputedProperties. [prop(2)]: 2, + ~~~~~~~~~ +!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. +!!! related TS9027 isolatedDeclarationErrorsObjects.ts:62:14: Add a type annotation to the variable oWithComputedProperties. [s]: 1, + ~~~ +!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. +!!! related TS9027 isolatedDeclarationErrorsObjects.ts:62:14: Add a type annotation to the variable oWithComputedProperties. [E.V]: 1, + ~~~~~ +!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. +!!! related TS9027 isolatedDeclarationErrorsObjects.ts:62:14: Add a type annotation to the variable oWithComputedProperties. [str]: 0, + ~~~~~ +!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. +!!! related TS9027 isolatedDeclarationErrorsObjects.ts:62:14: Add a type annotation to the variable oWithComputedProperties. } const part = { a: 1 }; export const oWithSpread = { - ~~~~~~~~~~~ -!!! error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. -!!! related TS9027 isolatedDeclarationErrorsObjects.ts:73:14: Add a type annotation to the variable oWithSpread. b: 1, ...part, + ~~~~~~~ +!!! error TS9015: Objects that contain spread assignments can't be inferred with --isolatedDeclarations. +!!! related TS9027 isolatedDeclarationErrorsObjects.ts:73:14: Add a type annotation to the variable oWithSpread. c: 1, part, ~~~~ @@ -165,14 +163,11 @@ isolatedDeclarationErrorsObjects.ts(83,13): error TS9013: Expression type can't export const oWithSpread2 = { b: 1, nested: { - ~ ...part, - ~~~~~~~~~~~~~~~~ - }, - ~~~~~ -!!! error TS9013: Expression type can't be inferred with --isolatedDeclarations. + ~~~~~~~ +!!! error TS9015: Objects that contain spread assignments can't be inferred with --isolatedDeclarations. !!! related TS9027 isolatedDeclarationErrorsObjects.ts:81:14: Add a type annotation to the variable oWithSpread2. -!!! related TS9035 isolatedDeclarationErrorsObjects.ts:83:13: Add satisfies and a type assertion to this expression (satisfies T as T) to make the type explicit. + }, c: 1, } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsObjects.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsObjects.errors.txt.diff deleted file mode 100644 index 21d8bfee4b0..00000000000 --- a/testdata/baselines/reference/submodule/compiler/isolatedDeclarationErrorsObjects.errors.txt.diff +++ /dev/null @@ -1,148 +0,0 @@ ---- old.isolatedDeclarationErrorsObjects.errors.txt -+++ new.isolatedDeclarationErrorsObjects.errors.txt -@@= skipped -0, +0 lines =@@ - isolatedDeclarationErrorsObjects.ts(7,8): error TS9013: Expression type can't be inferred with --isolatedDeclarations. - isolatedDeclarationErrorsObjects.ts(12,12): error TS9013: Expression type can't be inferred with --isolatedDeclarations. -+isolatedDeclarationErrorsObjects.ts(14,8): error TS9013: Expression type can't be inferred with --isolatedDeclarations. - isolatedDeclarationErrorsObjects.ts(16,12): error TS9013: Expression type can't be inferred with --isolatedDeclarations. - isolatedDeclarationErrorsObjects.ts(21,5): error TS9008: Method must have an explicit return type annotation with --isolatedDeclarations. - isolatedDeclarationErrorsObjects.ts(24,5): error TS9008: Method must have an explicit return type annotation with --isolatedDeclarations. - isolatedDeclarationErrorsObjects.ts(25,8): error TS9013: Expression type can't be inferred with --isolatedDeclarations. -+isolatedDeclarationErrorsObjects.ts(28,10): error TS9013: Expression type can't be inferred with --isolatedDeclarations. - isolatedDeclarationErrorsObjects.ts(29,9): error TS9008: Method must have an explicit return type annotation with --isolatedDeclarations. - isolatedDeclarationErrorsObjects.ts(32,9): error TS9008: Method must have an explicit return type annotation with --isolatedDeclarations. - isolatedDeclarationErrorsObjects.ts(40,9): error TS7032: Property 'singleSetterBad' implicitly has type 'any', because its set accessor lacks a parameter type annotation. - isolatedDeclarationErrorsObjects.ts(40,25): error TS7006: Parameter 'value' implicitly has an 'any' type. - isolatedDeclarationErrorsObjects.ts(40,25): error TS9009: At least one accessor must have an explicit type annotation with --isolatedDeclarations. --isolatedDeclarationErrorsObjects.ts(64,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. --isolatedDeclarationErrorsObjects.ts(65,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. --isolatedDeclarationErrorsObjects.ts(66,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. --isolatedDeclarationErrorsObjects.ts(67,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. --isolatedDeclarationErrorsObjects.ts(68,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. --isolatedDeclarationErrorsObjects.ts(75,5): error TS9015: Objects that contain spread assignments can't be inferred with --isolatedDeclarations. -+isolatedDeclarationErrorsObjects.ts(62,14): error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. -+isolatedDeclarationErrorsObjects.ts(73,14): error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. - isolatedDeclarationErrorsObjects.ts(77,5): error TS9016: Objects that contain shorthand properties can't be inferred with --isolatedDeclarations. --isolatedDeclarationErrorsObjects.ts(84,9): error TS9015: Objects that contain spread assignments can't be inferred with --isolatedDeclarations. -- -- --==== isolatedDeclarationErrorsObjects.ts (19 errors) ==== -+isolatedDeclarationErrorsObjects.ts(83,13): error TS9013: Expression type can't be inferred with --isolatedDeclarations. -+ -+ -+==== isolatedDeclarationErrorsObjects.ts (17 errors) ==== - export let o = { - a: 1, - b: "" -@@= skipped -41, +39 lines =@@ - !!! related TS9035 isolatedDeclarationErrorsObjects.ts:12:12: Add satisfies and a type assertion to this expression (satisfies T as T) to make the type explicit. - }, - c: { -+ ~ - d: 1, -+ ~~~~~~~~~~~~~ - e: V, -+ ~~~~~~~~~~~~~ - ~ - !!! error TS9013: Expression type can't be inferred with --isolatedDeclarations. - !!! related TS9027 isolatedDeclarationErrorsObjects.ts:10:12: Add a type annotation to the variable oBad2. - !!! related TS9035 isolatedDeclarationErrorsObjects.ts:16:12: Add satisfies and a type assertion to this expression (satisfies T as T) to make the type explicit. - } -+ ~~~~~ -+!!! error TS9013: Expression type can't be inferred with --isolatedDeclarations. -+!!! related TS9027 isolatedDeclarationErrorsObjects.ts:10:12: Add a type annotation to the variable oBad2. -+!!! related TS9035 isolatedDeclarationErrorsObjects.ts:14:8: Add satisfies and a type assertion to this expression (satisfies T as T) to make the type explicit. - } - - export let oWithMethods = { -@@= skipped -30, +37 lines =@@ - } - export let oWithMethodsNested = { - foo: { -+ ~ - method() { }, -+ ~~~~~~~~~~~~~~~~~~~~~ - ~~~~~~ - !!! error TS9008: Method must have an explicit return type annotation with --isolatedDeclarations. - !!! related TS9027 isolatedDeclarationErrorsObjects.ts:27:12: Add a type annotation to the variable oWithMethodsNested. - !!! related TS9034 isolatedDeclarationErrorsObjects.ts:29:9: Add a return type to the method - a: 1, -+ ~~~~~~~~~~~~~ - okMethod(): void { }, -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - bad() { } -+ ~~~~~~~~~~~~~~~~~ - ~~~ - !!! error TS9008: Method must have an explicit return type annotation with --isolatedDeclarations. - !!! related TS9027 isolatedDeclarationErrorsObjects.ts:27:12: Add a type annotation to the variable oWithMethodsNested. - !!! related TS9034 isolatedDeclarationErrorsObjects.ts:32:9: Add a return type to the method - } -+ ~~~~~ -+!!! error TS9013: Expression type can't be inferred with --isolatedDeclarations. -+!!! related TS9027 isolatedDeclarationErrorsObjects.ts:27:12: Add a type annotation to the variable oWithMethodsNested. -+!!! related TS9035 isolatedDeclarationErrorsObjects.ts:28:10: Add satisfies and a type assertion to this expression (satisfies T as T) to make the type explicit. - } - - -@@= skipped -49, +58 lines =@@ - V = 10, - } - export const oWithComputedProperties = { -+ ~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. -+!!! related TS9027 isolatedDeclarationErrorsObjects.ts:62:14: Add a type annotation to the variable oWithComputedProperties. - [1]: 1, - [1 + 3]: 1, -- ~~~~~~~ --!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. --!!! related TS9027 isolatedDeclarationErrorsObjects.ts:62:14: Add a type annotation to the variable oWithComputedProperties. - [prop(2)]: 2, -- ~~~~~~~~~ --!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. --!!! related TS9027 isolatedDeclarationErrorsObjects.ts:62:14: Add a type annotation to the variable oWithComputedProperties. - [s]: 1, -- ~~~ --!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. --!!! related TS9027 isolatedDeclarationErrorsObjects.ts:62:14: Add a type annotation to the variable oWithComputedProperties. - [E.V]: 1, -- ~~~~~ --!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. --!!! related TS9027 isolatedDeclarationErrorsObjects.ts:62:14: Add a type annotation to the variable oWithComputedProperties. - [str]: 0, -- ~~~~~ --!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. --!!! related TS9027 isolatedDeclarationErrorsObjects.ts:62:14: Add a type annotation to the variable oWithComputedProperties. - } - - const part = { a: 1 }; - - export const oWithSpread = { -+ ~~~~~~~~~~~ -+!!! error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. -+!!! related TS9027 isolatedDeclarationErrorsObjects.ts:73:14: Add a type annotation to the variable oWithSpread. - b: 1, - ...part, -- ~~~~~~~ --!!! error TS9015: Objects that contain spread assignments can't be inferred with --isolatedDeclarations. --!!! related TS9027 isolatedDeclarationErrorsObjects.ts:73:14: Add a type annotation to the variable oWithSpread. - c: 1, - part, - ~~~~ -@@= skipped -42, +30 lines =@@ - export const oWithSpread2 = { - b: 1, - nested: { -+ ~ - ...part, -- ~~~~~~~ --!!! error TS9015: Objects that contain spread assignments can't be inferred with --isolatedDeclarations. -+ ~~~~~~~~~~~~~~~~ -+ }, -+ ~~~~~ -+!!! error TS9013: Expression type can't be inferred with --isolatedDeclarations. - !!! related TS9027 isolatedDeclarationErrorsObjects.ts:81:14: Add a type annotation to the variable oWithSpread2. -- }, -+!!! related TS9035 isolatedDeclarationErrorsObjects.ts:83:13: Add satisfies and a type assertion to this expression (satisfies T as T) to make the type explicit. - c: 1, - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/isolatedDeclarationLazySymbols.errors.txt b/testdata/baselines/reference/submodule/compiler/isolatedDeclarationLazySymbols.errors.txt index 1d718f8a1f8..812ec2c1bea 100644 --- a/testdata/baselines/reference/submodule/compiler/isolatedDeclarationLazySymbols.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/isolatedDeclarationLazySymbols.errors.txt @@ -2,10 +2,11 @@ isolatedDeclarationLazySymbols.ts(1,17): error TS9007: Function must have an exp isolatedDeclarationLazySymbols.ts(13,1): error TS9023: Assigning properties to functions without declaring them is not supported with --isolatedDeclarations. Add an explicit declaration for the properties assigned to this function. isolatedDeclarationLazySymbols.ts(16,5): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type. isolatedDeclarationLazySymbols.ts(16,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. -isolatedDeclarationLazySymbols.ts(20,12): error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. +isolatedDeclarationLazySymbols.ts(21,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. +isolatedDeclarationLazySymbols.ts(22,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. -==== isolatedDeclarationLazySymbols.ts (5 errors) ==== +==== isolatedDeclarationLazySymbols.ts (6 errors) ==== export function foo() { ~~~ !!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. @@ -35,9 +36,12 @@ isolatedDeclarationLazySymbols.ts(20,12): error TS9010: Variable must have an ex } export let oo = { - ~~ -!!! error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. -!!! related TS9027 isolatedDeclarationLazySymbols.ts:20:12: Add a type annotation to the variable oo. [o['prop.inner']]:"A", + ~~~~~~~~~~~~~~~~~ +!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. +!!! related TS9027 isolatedDeclarationLazySymbols.ts:20:12: Add a type annotation to the variable oo. [o.prop.inner]: "B", + ~~~~~~~~~~~~~~ +!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. +!!! related TS9027 isolatedDeclarationLazySymbols.ts:20:12: Add a type annotation to the variable oo. } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/isolatedDeclarationLazySymbols.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/isolatedDeclarationLazySymbols.errors.txt.diff deleted file mode 100644 index b8d25a00a27..00000000000 --- a/testdata/baselines/reference/submodule/compiler/isolatedDeclarationLazySymbols.errors.txt.diff +++ /dev/null @@ -1,34 +0,0 @@ ---- old.isolatedDeclarationLazySymbols.errors.txt -+++ new.isolatedDeclarationLazySymbols.errors.txt -@@= skipped -1, +1 lines =@@ - isolatedDeclarationLazySymbols.ts(13,1): error TS9023: Assigning properties to functions without declaring them is not supported with --isolatedDeclarations. Add an explicit declaration for the properties assigned to this function. - isolatedDeclarationLazySymbols.ts(16,5): error TS1166: A computed property name in a class property declaration must have a simple literal type or a 'unique symbol' type. - isolatedDeclarationLazySymbols.ts(16,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. --isolatedDeclarationLazySymbols.ts(21,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. --isolatedDeclarationLazySymbols.ts(22,5): error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. -- -- --==== isolatedDeclarationLazySymbols.ts (6 errors) ==== -+isolatedDeclarationLazySymbols.ts(20,12): error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. -+ -+ -+==== isolatedDeclarationLazySymbols.ts (5 errors) ==== - export function foo() { - ~~~ - !!! error TS9007: Function must have an explicit return type annotation with --isolatedDeclarations. -@@= skipped -34, +33 lines =@@ - } - - export let oo = { -+ ~~ -+!!! error TS9010: Variable must have an explicit type annotation with --isolatedDeclarations. -+!!! related TS9027 isolatedDeclarationLazySymbols.ts:20:12: Add a type annotation to the variable oo. - [o['prop.inner']]:"A", -- ~~~~~~~~~~~~~~~~~ --!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. --!!! related TS9027 isolatedDeclarationLazySymbols.ts:20:12: Add a type annotation to the variable oo. - [o.prop.inner]: "B", -- ~~~~~~~~~~~~~~ --!!! error TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations. --!!! related TS9027 isolatedDeclarationLazySymbols.ts:20:12: Add a type annotation to the variable oo. - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsJson(target=es2015).js b/testdata/baselines/reference/submodule/conformance/jsDeclarationsJson(target=es2015).js index 6566c591417..4d32902a6be 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsJson(target=es2015).js +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsJson(target=es2015).js @@ -31,16 +31,12 @@ declare const j: { x: number; y: number; obj: { - items: ({ + "items": ({ x: number; - y?: undefined; - err?: undefined; } | { x: number; y: number; - err?: undefined; } | { - y?: undefined; x: number; err: boolean; })[]; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsJson(target=es2015).js.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsJson(target=es2015).js.diff index e9775fb05e1..42861d3c670 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsJson(target=es2015).js.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsJson(target=es2015).js.diff @@ -8,7 +8,20 @@ declare const j: { x: number; y: number; -@@= skipped -20, +19 lines =@@ + obj: { +- items: ({ ++ "items": ({ + x: number; +- y?: undefined; +- err?: undefined; + } | { + x: number; + y: number; +- err?: undefined; + } | { +- y?: undefined; + x: number; + err: boolean; })[]; }; }; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsJson(target=es2015).types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsJson(target=es2015).types index 83709c340e9..a819b7f1c56 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsJson(target=es2015).types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsJson(target=es2015).types @@ -2,17 +2,17 @@ === index.js === const j = require("./obj.json"); ->j : { x: number; y: number; obj: { items: ({ x: number; y?: undefined; err?: undefined; } | { x: number; y: number; err?: undefined; } | { y?: undefined; x: number; err: boolean; })[]; }; } ->require("./obj.json") : { x: number; y: number; obj: { items: ({ x: number; y?: undefined; err?: undefined; } | { x: number; y: number; err?: undefined; } | { y?: undefined; x: number; err: boolean; })[]; }; } +>j : { x: number; y: number; obj: { "items": ({ x: number; } | { x: number; y: number; } | { x: number; err: boolean; })[]; }; } +>require("./obj.json") : { x: number; y: number; obj: { "items": ({ x: number; } | { x: number; y: number; } | { x: number; err: boolean; })[]; }; } >require : any >"./obj.json" : "./obj.json" module.exports = j; ->module.exports = j : { x: number; y: number; obj: { items: ({ x: number; y?: undefined; err?: undefined; } | { x: number; y: number; err?: undefined; } | { y?: undefined; x: number; err: boolean; })[]; }; } ->module.exports : { x: number; y: number; obj: { items: ({ x: number; y?: undefined; err?: undefined; } | { x: number; y: number; err?: undefined; } | { y?: undefined; x: number; err: boolean; })[]; }; } ->module : { exports: { x: number; y: number; obj: { items: ({ x: number; y?: undefined; err?: undefined; } | { x: number; y: number; err?: undefined; } | { y?: undefined; x: number; err: boolean; })[]; }; }; } ->exports : { x: number; y: number; obj: { items: ({ x: number; y?: undefined; err?: undefined; } | { x: number; y: number; err?: undefined; } | { y?: undefined; x: number; err: boolean; })[]; }; } ->j : { x: number; y: number; obj: { items: ({ x: number; y?: undefined; err?: undefined; } | { x: number; y: number; err?: undefined; } | { y?: undefined; x: number; err: boolean; })[]; }; } +>module.exports = j : { x: number; y: number; obj: { "items": ({ x: number; } | { x: number; y: number; } | { x: number; err: boolean; })[]; }; } +>module.exports : { x: number; y: number; obj: { "items": ({ x: number; } | { x: number; y: number; } | { x: number; err: boolean; })[]; }; } +>module : { exports: { x: number; y: number; obj: { "items": ({ x: number; } | { x: number; y: number; } | { x: number; err: boolean; })[]; }; }; } +>exports : { x: number; y: number; obj: { "items": ({ x: number; } | { x: number; y: number; } | { x: number; err: boolean; })[]; }; } +>j : { x: number; y: number; obj: { "items": ({ x: number; } | { x: number; y: number; } | { x: number; err: boolean; })[]; }; } === obj.json === { diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsJson(target=es2015).types.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsJson(target=es2015).types.diff new file mode 100644 index 00000000000..002a564ed7f --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsJson(target=es2015).types.diff @@ -0,0 +1,27 @@ +--- old.jsDeclarationsJson(target=es2015).types ++++ new.jsDeclarationsJson(target=es2015).types +@@= skipped -1, +1 lines =@@ + + === index.js === + const j = require("./obj.json"); +->j : { x: number; y: number; obj: { items: ({ x: number; y?: undefined; err?: undefined; } | { x: number; y: number; err?: undefined; } | { y?: undefined; x: number; err: boolean; })[]; }; } +->require("./obj.json") : { x: number; y: number; obj: { items: ({ x: number; y?: undefined; err?: undefined; } | { x: number; y: number; err?: undefined; } | { y?: undefined; x: number; err: boolean; })[]; }; } ++>j : { x: number; y: number; obj: { "items": ({ x: number; } | { x: number; y: number; } | { x: number; err: boolean; })[]; }; } ++>require("./obj.json") : { x: number; y: number; obj: { "items": ({ x: number; } | { x: number; y: number; } | { x: number; err: boolean; })[]; }; } + >require : any + >"./obj.json" : "./obj.json" + + module.exports = j; +->module.exports = j : { x: number; y: number; obj: { items: ({ x: number; y?: undefined; err?: undefined; } | { x: number; y: number; err?: undefined; } | { y?: undefined; x: number; err: boolean; })[]; }; } +->module.exports : { x: number; y: number; obj: { items: ({ x: number; y?: undefined; err?: undefined; } | { x: number; y: number; err?: undefined; } | { y?: undefined; x: number; err: boolean; })[]; }; } +->module : { exports: { x: number; y: number; obj: { items: ({ x: number; y?: undefined; err?: undefined; } | { x: number; y: number; err?: undefined; } | { y?: undefined; x: number; err: boolean; })[]; }; }; } +->exports : { x: number; y: number; obj: { items: ({ x: number; y?: undefined; err?: undefined; } | { x: number; y: number; err?: undefined; } | { y?: undefined; x: number; err: boolean; })[]; }; } +->j : { x: number; y: number; obj: { items: ({ x: number; y?: undefined; err?: undefined; } | { x: number; y: number; err?: undefined; } | { y?: undefined; x: number; err: boolean; })[]; }; } ++>module.exports = j : { x: number; y: number; obj: { "items": ({ x: number; } | { x: number; y: number; } | { x: number; err: boolean; })[]; }; } ++>module.exports : { x: number; y: number; obj: { "items": ({ x: number; } | { x: number; y: number; } | { x: number; err: boolean; })[]; }; } ++>module : { exports: { x: number; y: number; obj: { "items": ({ x: number; } | { x: number; y: number; } | { x: number; err: boolean; })[]; }; }; } ++>exports : { x: number; y: number; obj: { "items": ({ x: number; } | { x: number; y: number; } | { x: number; err: boolean; })[]; }; } ++>j : { x: number; y: number; obj: { "items": ({ x: number; } | { x: number; y: number; } | { x: number; err: boolean; })[]; }; } + + === obj.json === + { \ No newline at end of file