diff --git a/internal/ast/ast.go b/internal/ast/ast.go index f7abb99c14..b2f9a7a150 100644 --- a/internal/ast/ast.go +++ b/internal/ast/ast.go @@ -9624,6 +9624,10 @@ func (node *JSDocAugmentsTag) Clone(f NodeFactoryCoercible) *Node { return cloneNode(f.AsNodeFactory().NewJSDocAugmentsTag(node.TagName, node.ClassName, node.Comment), node.AsNode(), f.AsNodeFactory().hooks) } +func IsJSDocAugmentsTag(node *Node) bool { + return node.Kind == KindJSDocAugmentsTag +} + // JSDocSatisfiesTag type JSDocSatisfiesTag struct { JSDocTagBase diff --git a/internal/checker/checker.go b/internal/checker/checker.go index 4b595b6e2e..870af0b9c6 100644 --- a/internal/checker/checker.go +++ b/internal/checker/checker.go @@ -7466,12 +7466,14 @@ func (c *Checker) checkSuperExpression(node *ast.Node) *Type { isCallExpression := ast.IsCallExpression(node.Parent) && node.Parent.Expression() == node immediateContainer := getSuperContainer(node, true /*stopOnFunctions*/) container := immediateContainer + // adjust the container reference in case if super is used inside arrow functions with arbitrarily deep nesting if !isCallExpression { for container != nil && ast.IsArrowFunction(container) { container = getSuperContainer(container, true /*stopOnFunctions*/) } } + isLegalUsageOfSuperExpression := func() bool { if isCallExpression { // TS 1.0 SPEC (April 2014): 4.8.1 @@ -7492,6 +7494,7 @@ func (c *Checker) checkSuperExpression(node *ast.Node) *Type { } return false } + if container == nil || !isLegalUsageOfSuperExpression() { // issue more specific error if super is used in computed property name // class A { foo() { return "1" }} @@ -8740,7 +8743,7 @@ func (c *Checker) chooseOverload(s *CallState, relation *Relation) *Signature { if inferenceContext != nil { inferredTypeParameters = inferenceContext.inferredTypeParameters } - checkCandidate = c.getSignatureInstantiation(candidate, typeArgumentTypes, inferredTypeParameters) + checkCandidate = c.getSignatureInstantiation(candidate, typeArgumentTypes, ast.IsInJSFile(candidate.declaration), inferredTypeParameters) // If the original signature has a generic rest type, instantiation may produce a // signature with different arity and we need to perform another arity check. if c.getNonArrayRestType(candidate) != nil && !c.hasCorrectArity(s.node, s.args, checkCandidate, s.signatureHelpTrailingComma) { @@ -8762,7 +8765,7 @@ func (c *Checker) chooseOverload(s *CallState, relation *Relation) *Signature { s.argCheckMode = CheckModeNormal if inferenceContext != nil { typeArgumentTypes := c.instantiateTypes(c.inferTypeArguments(s.node, candidate, s.args, s.argCheckMode, inferenceContext), inferenceContext.mapper) - checkCandidate = c.getSignatureInstantiation(candidate, typeArgumentTypes, inferenceContext.inferredTypeParameters) + checkCandidate = c.getSignatureInstantiation(candidate, typeArgumentTypes, ast.IsInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters) // If the original signature has a generic rest type, instantiation may produce a // signature with different arity and we need to perform another arity check. if c.getNonArrayRestType(candidate) != nil && !c.hasCorrectArity(s.node, s.args, checkCandidate, s.signatureHelpTrailingComma) { @@ -8908,8 +8911,9 @@ func (c *Checker) hasCorrectTypeArgumentArity(signature *Signature, typeArgument } func (c *Checker) checkTypeArguments(signature *Signature, typeArgumentNodes []*ast.Node, reportErrors bool, headMessage *diagnostics.Message) []*Type { + isJavaScript := ast.IsInJSFile(signature.declaration) typeParameters := signature.typeParameters - typeArgumentTypes := c.fillMissingTypeArguments(core.Map(typeArgumentNodes, c.getTypeFromTypeNode), typeParameters, c.getMinTypeArgumentCount(typeParameters)) + typeArgumentTypes := c.fillMissingTypeArguments(core.Map(typeArgumentNodes, c.getTypeFromTypeNode), typeParameters, c.getMinTypeArgumentCount(typeParameters), isJavaScript) var mapper *TypeMapper for i := range typeArgumentNodes { // Debug.assert(typeParameters[i] != nil, "Should not call checkTypeArguments with too many type arguments") @@ -10164,7 +10168,7 @@ func (c *Checker) getInstantiationExpressionType(exprType *Type, node *ast.Node) return core.SameMap(applicableSignatures, func(sig *Signature) *Signature { typeArgumentTypes := c.checkTypeArguments(sig, typeArguments.Nodes, true /*reportErrors*/, nil) if typeArgumentTypes != nil { - return c.getSignatureInstantiation(sig, typeArgumentTypes, nil) + return c.getSignatureInstantiation(sig, typeArgumentTypes, ast.IsInJSFile(sig.declaration), nil) } return sig }) @@ -18346,7 +18350,7 @@ func (c *Checker) getInstantiatedConstructorsForTypeArguments(t *Type, typeArgum typeArguments := core.Map(typeArgumentNodes, c.getTypeFromTypeNode) return core.SameMap(signatures, func(sig *Signature) *Signature { if len(sig.typeParameters) != 0 { - return c.getSignatureInstantiation(sig, typeArguments, nil) + return c.getSignatureInstantiation(sig, typeArguments, ast.IsInJSFile(location), nil) } return sig }) @@ -18354,13 +18358,14 @@ func (c *Checker) getInstantiatedConstructorsForTypeArguments(t *Type, typeArgum func (c *Checker) getConstructorsForTypeArguments(t *Type, typeArgumentNodes []*ast.Node, location *ast.Node) []*Signature { typeArgCount := len(typeArgumentNodes) + isJavaScript := ast.IsInJSFile(location) return core.Filter(c.getSignaturesOfType(t, SignatureKindConstruct), func(sig *Signature) bool { - return typeArgCount >= c.getMinTypeArgumentCount(sig.typeParameters) && typeArgCount <= len(sig.typeParameters) + return isJavaScript || typeArgCount >= c.getMinTypeArgumentCount(sig.typeParameters) && typeArgCount <= len(sig.typeParameters) }) } -func (c *Checker) getSignatureInstantiation(sig *Signature, typeArguments []*Type, inferredTypeParameters []*Type) *Signature { - instantiatedSignature := c.getSignatureInstantiationWithoutFillingInTypeArguments(sig, c.fillMissingTypeArguments(typeArguments, sig.typeParameters, c.getMinTypeArgumentCount(sig.typeParameters))) +func (c *Checker) getSignatureInstantiation(sig *Signature, typeArguments []*Type, isJavaScript bool, inferredTypeParameters []*Type) *Signature { + instantiatedSignature := c.getSignatureInstantiationWithoutFillingInTypeArguments(sig, c.fillMissingTypeArguments(typeArguments, sig.typeParameters, c.getMinTypeArgumentCount(sig.typeParameters), isJavaScript)) if len(inferredTypeParameters) != 0 { returnSignature := c.getSingleCallOrConstructSignature(c.getReturnTypeOfSignature(instantiatedSignature)) if returnSignature != nil { @@ -18498,12 +18503,13 @@ func (c *Checker) createCanonicalSignature(signature *Signature) *Signature { // where different generations of the same type parameter are in scope). This leads to a lot of new type // identities, and potentially a lot of work comparing those identities, so here we create an instantiation // that uses the original type identities for all unconstrained type parameters. - return c.getSignatureInstantiation(signature, core.Map(signature.typeParameters, func(tp *Type) *Type { + typeArguments := core.Map(signature.typeParameters, func(tp *Type) *Type { if tp.Target() != nil && c.getConstraintOfTypeParameter(tp.Target()) == nil { return tp.Target() } return tp - }), nil) + }) + return c.getSignatureInstantiation(signature, typeArguments, ast.IsInJSFile(signature.declaration), nil /*inferredTypeParameters*/) } func (c *Checker) getBaseSignature(signature *Signature) *Signature { @@ -18563,7 +18569,7 @@ func (c *Checker) instantiateSignatureInContextOf(signature *Signature, contextu c.inferTypes(context.inferences, source, target, InferencePriorityReturnType, false) }) } - return c.getSignatureInstantiation(signature, c.getInferredTypes(context), nil) + return c.getSignatureInstantiation(signature, c.getInferredTypes(context), ast.IsInJSFile(contextualSignature.declaration), nil /*inferredTypeParameters*/) } func (c *Checker) resolveBaseTypesOfInterface(t *Type) { @@ -19884,16 +19890,17 @@ func (c *Checker) getDefaultConstructSignatures(classType *Type) []*Signature { return []*Signature{c.newSignature(flags, nil, classType.AsInterfaceType().LocalTypeParameters(), nil, nil, classType, nil, 0)} } baseTypeNode := getBaseTypeNodeOfClass(classType) + isJavaScript := declaration != nil && ast.IsInJSFile(declaration) typeArguments := c.getTypeArgumentsFromNode(baseTypeNode) typeArgCount := len(typeArguments) var result []*Signature for _, baseSig := range baseSignatures { minTypeArgumentCount := c.getMinTypeArgumentCount(baseSig.typeParameters) typeParamCount := len(baseSig.typeParameters) - if typeArgCount >= minTypeArgumentCount && typeArgCount <= typeParamCount { + if isJavaScript || typeArgCount >= minTypeArgumentCount && typeArgCount <= typeParamCount { var sig *Signature if typeParamCount != 0 { - sig = c.createSignatureInstantiation(baseSig, c.fillMissingTypeArguments(typeArguments, baseSig.typeParameters, minTypeArgumentCount)) + sig = c.createSignatureInstantiation(baseSig, c.fillMissingTypeArguments(typeArguments, baseSig.typeParameters, minTypeArgumentCount, isJavaScript)) } else { sig = c.cloneSignature(baseSig) } @@ -20987,7 +20994,7 @@ func (c *Checker) getTypeArguments(t *Type) []*Type { } func (c *Checker) getEffectiveTypeArguments(node *ast.Node, typeParameters []*Type) []*Type { - return c.fillMissingTypeArguments(core.Map(node.TypeArguments(), c.getTypeFromTypeNode), typeParameters, c.getMinTypeArgumentCount(typeParameters)) + return c.fillMissingTypeArguments(core.Map(node.TypeArguments(), c.getTypeFromTypeNode), typeParameters, c.getMinTypeArgumentCount(typeParameters), ast.IsInJSFile(node)) } // Gets the minimum number of type arguments needed to satisfy all non-optional type parameters. @@ -21007,25 +21014,31 @@ func (c *Checker) hasTypeParameterDefault(t *Type) bool { }) } -func (c *Checker) fillMissingTypeArguments(typeArguments []*Type, typeParameters []*Type, minTypeArgumentCount int) []*Type { +func (c *Checker) fillMissingTypeArguments(typeArguments []*Type, typeParameters []*Type, minTypeArgumentCount int, isJavaScriptImplicitAny bool) []*Type { numTypeParameters := len(typeParameters) if numTypeParameters == 0 { return nil } numTypeArguments := len(typeArguments) - if numTypeArguments >= minTypeArgumentCount && numTypeArguments < numTypeParameters { + if isJavaScriptImplicitAny || (numTypeArguments >= minTypeArgumentCount && numTypeArguments < numTypeParameters) { result := make([]*Type, numTypeParameters) copy(result, typeArguments) // Map invalid forward references in default types to the error type for i := numTypeArguments; i < numTypeParameters; i++ { result[i] = c.errorType } + baseDefaultType := c.getDefaultTypeArgumentType(isJavaScriptImplicitAny) for i := numTypeArguments; i < numTypeParameters; i++ { defaultType := c.getDefaultFromTypeParameter(typeParameters[i]) + + if isJavaScriptImplicitAny && defaultType != nil && (c.isTypeIdenticalTo(defaultType, c.unknownType) || c.isTypeIdenticalTo(defaultType, c.emptyObjectType)) { + defaultType = c.anyType + } + if defaultType != nil { result[i] = c.instantiateType(defaultType, newTypeMapper(typeParameters, result)) } else { - result[i] = c.unknownType + result[i] = baseDefaultType } } return result @@ -21033,6 +21046,13 @@ func (c *Checker) fillMissingTypeArguments(typeArguments []*Type, typeParameters return typeArguments } +func (c *Checker) getDefaultTypeArgumentType(isInJavaScriptFile bool) *Type { + if isInJavaScriptFile { + return c.anyType + } + return c.unknownType +} + // Gets the default type for a type parameter. If the type parameter is the result of an instantiation, // this gets the instantiated default type of its target. If the type parameter has no default type or // the default is circular, `undefined` is returned. @@ -22072,6 +22092,8 @@ func (c *Checker) getTypeReferenceType(node *ast.Node, symbol *ast.Symbol) *Type if res != nil && c.checkNoTypeArguments(node, symbol) { return c.getRegularTypeOfLiteralType(res) } + + // !!! Resolving values as types for JS return c.errorType } @@ -22085,15 +22107,29 @@ func (c *Checker) getTypeFromClassOrInterfaceReference(node *ast.Node, symbol *a if len(typeParameters) != 0 { numTypeArguments := len(node.TypeArguments()) minTypeArgumentCount := c.getMinTypeArgumentCount(typeParameters) - if numTypeArguments < minTypeArgumentCount || numTypeArguments > len(typeParameters) { - message := diagnostics.Generic_type_0_requires_1_type_argument_s - if minTypeArgumentCount < len(typeParameters) { - message = diagnostics.Generic_type_0_requires_between_1_and_2_type_arguments + isJs := ast.IsInJSFile(node) + isJsImplicitAny := !c.noImplicitAny && isJs + if !isJsImplicitAny && (numTypeArguments < minTypeArgumentCount || numTypeArguments > len(typeParameters)) { + var message *diagnostics.Message + + missingAugmentsTag := isJs && ast.IsExpressionWithTypeArguments(node) && !ast.IsJSDocAugmentsTag(node.Parent) + if missingAugmentsTag { + message = diagnostics.Expected_0_type_arguments_provide_these_with_an_extends_tag + if minTypeArgumentCount < len(typeParameters) { + message = diagnostics.Expected_0_1_type_arguments_provide_these_with_an_extends_tag + } + } else { + message = diagnostics.Generic_type_0_requires_1_type_argument_s + if minTypeArgumentCount < len(typeParameters) { + message = diagnostics.Generic_type_0_requires_between_1_and_2_type_arguments + } } - typeStr := c.TypeToString(t) // !!! /*enclosingDeclaration*/, nil, TypeFormatFlagsWriteArrayAsGenericType + typeStr := c.TypeToStringEx(t, nil /*enclosingDeclaration*/, TypeFormatFlagsWriteArrayAsGenericType) c.error(node, message, typeStr, minTypeArgumentCount, len(typeParameters)) - // TODO: Adopt same permissive behavior in TS as in JS to reduce follow-on editing experience failures (requires editing fillMissingTypeArguments) - return c.errorType + if !isJs { + // TODO: Adopt same permissive behavior in TS as in JS to reduce follow-on editing experience failures (requires editing fillMissingTypeArguments) + return c.errorType + } } if node.Kind == ast.KindTypeReference && c.isDeferredTypeReferenceNode(node, numTypeArguments != len(typeParameters)) { return c.createDeferredTypeReference(t, node, nil /*mapper*/, nil /*alias*/) @@ -22101,7 +22137,7 @@ func (c *Checker) getTypeFromClassOrInterfaceReference(node *ast.Node, symbol *a // In a type reference, the outer type parameters of the referenced class or interface are automatically // supplied as type arguments and the type reference only specifies arguments for the local type parameters // of the class or interface. - localTypeArguments := c.fillMissingTypeArguments(c.getTypeArgumentsFromNode(node), typeParameters, minTypeArgumentCount) + localTypeArguments := c.fillMissingTypeArguments(c.getTypeArgumentsFromNode(node), typeParameters, minTypeArgumentCount, isJs) typeArguments := append(d.OuterTypeParameters(), localTypeArguments...) return c.createTypeReference(t, typeArguments) } @@ -22542,7 +22578,7 @@ func (c *Checker) getTypeAliasInstantiation(symbol *ast.Symbol, typeArguments [] key := getTypeAliasInstantiationKey(typeArguments, alias) instantiation := links.instantiations[key] if instantiation == nil { - mapper := newTypeMapper(typeParameters, c.fillMissingTypeArguments(typeArguments, typeParameters, c.getMinTypeArgumentCount(typeParameters))) + mapper := newTypeMapper(typeParameters, c.fillMissingTypeArguments(typeArguments, typeParameters, c.getMinTypeArgumentCount(typeParameters), ast.IsInJSFile(symbol.ValueDeclaration))) instantiation = c.instantiateTypeWithAlias(t, mapper, alias) links.instantiations[key] = instantiation } diff --git a/internal/checker/inference.go b/internal/checker/inference.go index 80e465aada..a6264e18cf 100644 --- a/internal/checker/inference.go +++ b/internal/checker/inference.go @@ -82,8 +82,9 @@ func (c *Checker) inferFromTypes(n *InferenceState, source *Type, target *Type) // Simply infer from source type arguments to target type arguments, with defaults applied. params := c.typeAliasLinks.Get(source.alias.symbol).typeParameters minParams := c.getMinTypeArgumentCount(params) - sourceTypes := c.fillMissingTypeArguments(source.alias.typeArguments, params, minParams) - targetTypes := c.fillMissingTypeArguments(target.alias.typeArguments, params, minParams) + nodeIsInJsFile := ast.IsInJSFile(source.alias.symbol.ValueDeclaration) + sourceTypes := c.fillMissingTypeArguments(source.alias.typeArguments, params, minParams, nodeIsInJsFile) + targetTypes := c.fillMissingTypeArguments(target.alias.typeArguments, params, minParams, nodeIsInJsFile) c.inferFromTypeArguments(n, sourceTypes, targetTypes, c.getAliasVariances(source.alias.symbol)) } // And if there weren't any type arguments, there's no reason to run inference as the types must be the same. diff --git a/internal/checker/jsx.go b/internal/checker/jsx.go index 5629ba9ff7..083953e11f 100644 --- a/internal/checker/jsx.go +++ b/internal/checker/jsx.go @@ -952,7 +952,7 @@ func (c *Checker) getJsxPropsTypeFromClassType(sig *Signature, context *ast.Node // Props is of type 'any' or unknown return attributesType } - // Normal case -- add in IntrinsicClassElements and IntrinsicElements + // Normal case -- add in IntrinsicClassAttributes and IntrinsicAttributes apparentAttributesType := attributesType intrinsicClassAttribs := c.getJsxType(JsxNames.IntrinsicClassAttributes, context) if !c.isErrorType(intrinsicClassAttribs) { @@ -960,8 +960,8 @@ func (c *Checker) getJsxPropsTypeFromClassType(sig *Signature, context *ast.Node hostClassType := c.getReturnTypeOfSignature(sig) var libraryManagedAttributeType *Type if typeParams != nil { - // apply JSX.IntrinsicClassElements - inferredArgs := c.fillMissingTypeArguments([]*Type{hostClassType}, typeParams, c.getMinTypeArgumentCount(typeParams)) + // apply JSX.IntrinsicClassAttributes + inferredArgs := c.fillMissingTypeArguments([]*Type{hostClassType}, typeParams, c.getMinTypeArgumentCount(typeParams), ast.IsInJSFile(context)) libraryManagedAttributeType = c.instantiateType(intrinsicClassAttribs, newTypeMapper(typeParams, inferredArgs)) } else { libraryManagedAttributeType = intrinsicClassAttribs @@ -1008,7 +1008,7 @@ func (c *Checker) getJsxManagedAttributesFromLocatedAttributes(context *ast.Node managedSym := c.getJsxLibraryManagedAttributes(ns) if managedSym != nil { ctorType := c.getStaticTypeOfReferencedJsxConstructor(context) - result := c.instantiateAliasOrInterfaceWithDefaults(managedSym, []*Type{ctorType, attributesType}) + result := c.instantiateAliasOrInterfaceWithDefaults(managedSym, []*Type{ctorType, attributesType}, ast.IsInJSFile(context)) if result != nil { return result } @@ -1016,13 +1016,13 @@ func (c *Checker) getJsxManagedAttributesFromLocatedAttributes(context *ast.Node return attributesType } -func (c *Checker) instantiateAliasOrInterfaceWithDefaults(managedSym *ast.Symbol, typeArguments []*Type) *Type { +func (c *Checker) instantiateAliasOrInterfaceWithDefaults(managedSym *ast.Symbol, typeArguments []*Type, inJavaScript bool) *Type { declaredManagedType := c.getDeclaredTypeOfSymbol(managedSym) // fetches interface type, or initializes symbol links type parmaeters if managedSym.Flags&ast.SymbolFlagsTypeAlias != 0 { params := c.typeAliasLinks.Get(managedSym).typeParameters if len(params) >= len(typeArguments) { - args := c.fillMissingTypeArguments(typeArguments, params, len(typeArguments)) + args := c.fillMissingTypeArguments(typeArguments, params, len(typeArguments), inJavaScript) if len(args) == 0 { return declaredManagedType } @@ -1030,7 +1030,7 @@ func (c *Checker) instantiateAliasOrInterfaceWithDefaults(managedSym *ast.Symbol } } if len(declaredManagedType.AsInterfaceType().TypeParameters()) >= len(typeArguments) { - args := c.fillMissingTypeArguments(typeArguments, declaredManagedType.AsInterfaceType().TypeParameters(), len(typeArguments)) + args := c.fillMissingTypeArguments(typeArguments, declaredManagedType.AsInterfaceType().TypeParameters(), len(typeArguments), inJavaScript) return c.createTypeReference(declaredManagedType, args) } return nil @@ -1272,7 +1272,7 @@ func (c *Checker) getJsxElementTypeTypeAt(location *ast.Node) *Type { if sym == nil { return nil } - t := c.instantiateAliasOrInterfaceWithDefaults(sym, nil) + t := c.instantiateAliasOrInterfaceWithDefaults(sym, nil, ast.IsInJSFile(location)) if t == nil || c.isErrorType(t) { return nil } diff --git a/internal/checker/relater.go b/internal/checker/relater.go index 7d6193ae49..891f010c84 100644 --- a/internal/checker/relater.go +++ b/internal/checker/relater.go @@ -3327,8 +3327,9 @@ func (r *Relater) structuredTypeRelatedToWorker(source *Type, target *Type, repo } params := r.c.typeAliasLinks.Get(source.alias.symbol).typeParameters minParams := r.c.getMinTypeArgumentCount(params) - sourceTypes := r.c.fillMissingTypeArguments(source.alias.typeArguments, params, minParams) - targetTypes := r.c.fillMissingTypeArguments(target.alias.typeArguments, params, minParams) + nodeIsInJsFile := ast.IsInJSFile(source.alias.symbol.ValueDeclaration) + sourceTypes := r.c.fillMissingTypeArguments(source.alias.typeArguments, params, minParams, nodeIsInJsFile) + targetTypes := r.c.fillMissingTypeArguments(target.alias.typeArguments, params, minParams, nodeIsInJsFile) varianceResult, ok := relateVariances(sourceTypes, targetTypes, variances, intersectionState) if ok { return varianceResult diff --git a/testdata/baselines/reference/compiler/superCallInJSWithWrongBaseTypeArgumentCount1(strict=false).js b/testdata/baselines/reference/compiler/superCallInJSWithWrongBaseTypeArgumentCount1(strict=false).js new file mode 100644 index 0000000000..a8ea92d742 --- /dev/null +++ b/testdata/baselines/reference/compiler/superCallInJSWithWrongBaseTypeArgumentCount1(strict=false).js @@ -0,0 +1,101 @@ +//// [tests/cases/compiler/superCallInJSWithWrongBaseTypeArgumentCount1.ts] //// + +//// [a.ts] +export class A {} + +//// [b.js] +import { A } from './a.js'; + +export class B1 extends A { + constructor() { + super(); + } +} + +export class B2 extends A { + constructor() { + super(); + } +} + +export class B3 extends A { + constructor() { + super(); + } +} + +//// [a.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.A = void 0; +class A { +} +exports.A = A; +//// [b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.B3 = exports.B2 = exports.B1 = void 0; +const a_js_1 = require("./a.js"); +class B1 extends a_js_1.A { + constructor() { + super(); + } +} +exports.B1 = B1; +class B2 extends a_js_1.A { + constructor() { + super(); + } +} +exports.B2 = B2; +class B3 extends a_js_1.A { + constructor() { + super(); + } +} +exports.B3 = B3; + + +//// [a.d.ts] +export declare class A { +} +//// [b.d.ts] +import { A } from './a.js'; +export declare class B1 extends A { + constructor(); +} +export declare class B2 extends A { + constructor(); +} +export declare class B3 extends A { + constructor(); +} + + +//// [DtsFileErrors] + + +b.d.ts(2,33): error TS2314: Generic type 'A' requires 1 type argument(s). +b.d.ts(8,33): error TS2314: Generic type 'A' requires 1 type argument(s). + + +==== a.d.ts (0 errors) ==== + export declare class A { + } + +==== b.d.ts (2 errors) ==== + import { A } from './a.js'; + export declare class B1 extends A { + ~ +!!! error TS2314: Generic type 'A' requires 1 type argument(s). + constructor(); + } + export declare class B2 extends A { + constructor(); + } + export declare class B3 extends A { + ~~~~~~~~~~~~~~~~~ +!!! error TS2314: Generic type 'A' requires 1 type argument(s). + constructor(); + } + \ No newline at end of file diff --git a/testdata/baselines/reference/compiler/superCallInJSWithWrongBaseTypeArgumentCount1(strict=false).symbols b/testdata/baselines/reference/compiler/superCallInJSWithWrongBaseTypeArgumentCount1(strict=false).symbols new file mode 100644 index 0000000000..dd20cdcfbe --- /dev/null +++ b/testdata/baselines/reference/compiler/superCallInJSWithWrongBaseTypeArgumentCount1(strict=false).symbols @@ -0,0 +1,40 @@ +//// [tests/cases/compiler/superCallInJSWithWrongBaseTypeArgumentCount1.ts] //// + +=== a.ts === +export class A {} +>A : Symbol(A, Decl(a.ts, 0, 0)) +>T : Symbol(T, Decl(a.ts, 0, 15)) + +=== b.js === +import { A } from './a.js'; +>A : Symbol(A, Decl(b.js, 0, 8)) + +export class B1 extends A { +>B1 : Symbol(B1, Decl(b.js, 0, 27)) +>A : Symbol(A, Decl(b.js, 0, 8)) + + constructor() { + super(); +>super : Symbol(A, Decl(a.ts, 0, 0)) + } +} + +export class B2 extends A { +>B2 : Symbol(B2, Decl(b.js, 6, 1)) +>A : Symbol(A, Decl(b.js, 0, 8)) + + constructor() { + super(); +>super : Symbol(A, Decl(a.ts, 0, 0)) + } +} + +export class B3 extends A { +>B3 : Symbol(B3, Decl(b.js, 12, 1)) +>A : Symbol(A, Decl(b.js, 0, 8)) + + constructor() { + super(); +>super : Symbol(A, Decl(a.ts, 0, 0)) + } +} diff --git a/testdata/baselines/reference/compiler/superCallInJSWithWrongBaseTypeArgumentCount1(strict=false).types b/testdata/baselines/reference/compiler/superCallInJSWithWrongBaseTypeArgumentCount1(strict=false).types new file mode 100644 index 0000000000..47437482ac --- /dev/null +++ b/testdata/baselines/reference/compiler/superCallInJSWithWrongBaseTypeArgumentCount1(strict=false).types @@ -0,0 +1,42 @@ +//// [tests/cases/compiler/superCallInJSWithWrongBaseTypeArgumentCount1.ts] //// + +=== a.ts === +export class A {} +>A : A + +=== b.js === +import { A } from './a.js'; +>A : typeof A + +export class B1 extends A { +>B1 : B1 +>A : A + + constructor() { + super(); +>super() : void +>super : typeof A + } +} + +export class B2 extends A { +>B2 : B2 +>A : A + + constructor() { + super(); +>super() : void +>super : typeof A + } +} + +export class B3 extends A { +>B3 : B3 +>A : A + + constructor() { + super(); +>super() : void +>super : typeof A + } +} diff --git a/testdata/baselines/reference/compiler/superCallInJSWithWrongBaseTypeArgumentCount1(strict=true).errors.txt b/testdata/baselines/reference/compiler/superCallInJSWithWrongBaseTypeArgumentCount1(strict=true).errors.txt new file mode 100644 index 0000000000..85fc3a63f1 --- /dev/null +++ b/testdata/baselines/reference/compiler/superCallInJSWithWrongBaseTypeArgumentCount1(strict=true).errors.txt @@ -0,0 +1,31 @@ +b.js(3,25): error TS8026: Expected A type arguments; provide these with an '@extends' tag. +b.js(15,25): error TS8026: Expected A type arguments; provide these with an '@extends' tag. + + +==== a.ts (0 errors) ==== + export class A {} + +==== b.js (2 errors) ==== + import { A } from './a.js'; + + export class B1 extends A { + ~ +!!! error TS8026: Expected A type arguments; provide these with an '@extends' tag. + constructor() { + super(); + } + } + + export class B2 extends A { + constructor() { + super(); + } + } + + export class B3 extends A { + ~~~~~~~~~~~~~~~~~ +!!! error TS8026: Expected A type arguments; provide these with an '@extends' tag. + constructor() { + super(); + } + } \ No newline at end of file diff --git a/testdata/baselines/reference/compiler/superCallInJSWithWrongBaseTypeArgumentCount1(strict=true).js b/testdata/baselines/reference/compiler/superCallInJSWithWrongBaseTypeArgumentCount1(strict=true).js new file mode 100644 index 0000000000..08d58dbbaa --- /dev/null +++ b/testdata/baselines/reference/compiler/superCallInJSWithWrongBaseTypeArgumentCount1(strict=true).js @@ -0,0 +1,72 @@ +//// [tests/cases/compiler/superCallInJSWithWrongBaseTypeArgumentCount1.ts] //// + +//// [a.ts] +export class A {} + +//// [b.js] +import { A } from './a.js'; + +export class B1 extends A { + constructor() { + super(); + } +} + +export class B2 extends A { + constructor() { + super(); + } +} + +export class B3 extends A { + constructor() { + super(); + } +} + +//// [a.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.A = void 0; +class A { +} +exports.A = A; +//// [b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.B3 = exports.B2 = exports.B1 = void 0; +const a_js_1 = require("./a.js"); +class B1 extends a_js_1.A { + constructor() { + super(); + } +} +exports.B1 = B1; +class B2 extends a_js_1.A { + constructor() { + super(); + } +} +exports.B2 = B2; +class B3 extends a_js_1.A { + constructor() { + super(); + } +} +exports.B3 = B3; + + +//// [a.d.ts] +export declare class A { +} +//// [b.d.ts] +import { A } from './a.js'; +export declare class B1 extends A { + constructor(); +} +export declare class B2 extends A { + constructor(); +} +export declare class B3 extends A { + constructor(); +} diff --git a/testdata/baselines/reference/compiler/superCallInJSWithWrongBaseTypeArgumentCount1(strict=true).symbols b/testdata/baselines/reference/compiler/superCallInJSWithWrongBaseTypeArgumentCount1(strict=true).symbols new file mode 100644 index 0000000000..dd20cdcfbe --- /dev/null +++ b/testdata/baselines/reference/compiler/superCallInJSWithWrongBaseTypeArgumentCount1(strict=true).symbols @@ -0,0 +1,40 @@ +//// [tests/cases/compiler/superCallInJSWithWrongBaseTypeArgumentCount1.ts] //// + +=== a.ts === +export class A {} +>A : Symbol(A, Decl(a.ts, 0, 0)) +>T : Symbol(T, Decl(a.ts, 0, 15)) + +=== b.js === +import { A } from './a.js'; +>A : Symbol(A, Decl(b.js, 0, 8)) + +export class B1 extends A { +>B1 : Symbol(B1, Decl(b.js, 0, 27)) +>A : Symbol(A, Decl(b.js, 0, 8)) + + constructor() { + super(); +>super : Symbol(A, Decl(a.ts, 0, 0)) + } +} + +export class B2 extends A { +>B2 : Symbol(B2, Decl(b.js, 6, 1)) +>A : Symbol(A, Decl(b.js, 0, 8)) + + constructor() { + super(); +>super : Symbol(A, Decl(a.ts, 0, 0)) + } +} + +export class B3 extends A { +>B3 : Symbol(B3, Decl(b.js, 12, 1)) +>A : Symbol(A, Decl(b.js, 0, 8)) + + constructor() { + super(); +>super : Symbol(A, Decl(a.ts, 0, 0)) + } +} diff --git a/testdata/baselines/reference/compiler/superCallInJSWithWrongBaseTypeArgumentCount1(strict=true).types b/testdata/baselines/reference/compiler/superCallInJSWithWrongBaseTypeArgumentCount1(strict=true).types new file mode 100644 index 0000000000..47437482ac --- /dev/null +++ b/testdata/baselines/reference/compiler/superCallInJSWithWrongBaseTypeArgumentCount1(strict=true).types @@ -0,0 +1,42 @@ +//// [tests/cases/compiler/superCallInJSWithWrongBaseTypeArgumentCount1.ts] //// + +=== a.ts === +export class A {} +>A : A + +=== b.js === +import { A } from './a.js'; +>A : typeof A + +export class B1 extends A { +>B1 : B1 +>A : A + + constructor() { + super(); +>super() : void +>super : typeof A + } +} + +export class B2 extends A { +>B2 : B2 +>A : A + + constructor() { + super(); +>super() : void +>super : typeof A + } +} + +export class B3 extends A { +>B3 : B3 +>A : A + + constructor() { + super(); +>super() : void +>super : typeof A + } +} diff --git a/testdata/baselines/reference/compiler/superCallInJSWithWrongBaseTypeArgumentCount2(strict=false).js b/testdata/baselines/reference/compiler/superCallInJSWithWrongBaseTypeArgumentCount2(strict=false).js new file mode 100644 index 0000000000..732da07a69 --- /dev/null +++ b/testdata/baselines/reference/compiler/superCallInJSWithWrongBaseTypeArgumentCount2(strict=false).js @@ -0,0 +1,113 @@ +//// [tests/cases/compiler/superCallInJSWithWrongBaseTypeArgumentCount2.ts] //// + +//// [a.ts] +export class A {} + +//// [b.js] +import { A } from './a.js'; + +/** @extends {A} */ +export class B1 extends A { + constructor() { + super(); + } +} + +/** @extends {A} */ +export class B2 extends A { + constructor() { + super(); + } +} + +/** @extends {A} */ +export class B3 extends A { + constructor() { + super(); + } +} + +//// [a.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.A = void 0; +class A { +} +exports.A = A; +//// [b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.B3 = exports.B2 = exports.B1 = void 0; +const a_js_1 = require("./a.js"); +/** @extends {A} */ +class B1 extends a_js_1.A { + constructor() { + super(); + } +} +exports.B1 = B1; +/** @extends {A} */ +class B2 extends a_js_1.A { + constructor() { + super(); + } +} +exports.B2 = B2; +/** @extends {A} */ +class B3 extends a_js_1.A { + constructor() { + super(); + } +} +exports.B3 = B3; + + +//// [a.d.ts] +export declare class A { +} +//// [b.d.ts] +import { A } from './a.js'; +/** @extends {A} */ +export declare class B1 extends A { + constructor(); +} +/** @extends {A} */ +export declare class B2 extends A { + constructor(); +} +/** @extends {A} */ +export declare class B3 extends A { + constructor(); +} + + +//// [DtsFileErrors] + + +b.d.ts(3,33): error TS2314: Generic type 'A' requires 1 type argument(s). +b.d.ts(11,33): error TS2314: Generic type 'A' requires 1 type argument(s). + + +==== a.d.ts (0 errors) ==== + export declare class A { + } + +==== b.d.ts (2 errors) ==== + import { A } from './a.js'; + /** @extends {A} */ + export declare class B1 extends A { + ~ +!!! error TS2314: Generic type 'A' requires 1 type argument(s). + constructor(); + } + /** @extends {A} */ + export declare class B2 extends A { + constructor(); + } + /** @extends {A} */ + export declare class B3 extends A { + ~~~~~~~~~~~~~~~~~ +!!! error TS2314: Generic type 'A' requires 1 type argument(s). + constructor(); + } + \ No newline at end of file diff --git a/testdata/baselines/reference/compiler/superCallInJSWithWrongBaseTypeArgumentCount2(strict=false).symbols b/testdata/baselines/reference/compiler/superCallInJSWithWrongBaseTypeArgumentCount2(strict=false).symbols new file mode 100644 index 0000000000..a39f3507c1 --- /dev/null +++ b/testdata/baselines/reference/compiler/superCallInJSWithWrongBaseTypeArgumentCount2(strict=false).symbols @@ -0,0 +1,43 @@ +//// [tests/cases/compiler/superCallInJSWithWrongBaseTypeArgumentCount2.ts] //// + +=== a.ts === +export class A {} +>A : Symbol(A, Decl(a.ts, 0, 0)) +>T : Symbol(T, Decl(a.ts, 0, 15)) + +=== b.js === +import { A } from './a.js'; +>A : Symbol(A, Decl(b.js, 0, 8)) + +/** @extends {A} */ +export class B1 extends A { +>B1 : Symbol(B1, Decl(b.js, 0, 27)) +>A : Symbol(A, Decl(b.js, 0, 8)) + + constructor() { + super(); +>super : Symbol(A, Decl(a.ts, 0, 0)) + } +} + +/** @extends {A} */ +export class B2 extends A { +>B2 : Symbol(B2, Decl(b.js, 7, 1)) +>A : Symbol(A, Decl(b.js, 0, 8)) + + constructor() { + super(); +>super : Symbol(A, Decl(a.ts, 0, 0)) + } +} + +/** @extends {A} */ +export class B3 extends A { +>B3 : Symbol(B3, Decl(b.js, 14, 1)) +>A : Symbol(A, Decl(b.js, 0, 8)) + + constructor() { + super(); +>super : Symbol(A, Decl(a.ts, 0, 0)) + } +} diff --git a/testdata/baselines/reference/compiler/superCallInJSWithWrongBaseTypeArgumentCount2(strict=false).types b/testdata/baselines/reference/compiler/superCallInJSWithWrongBaseTypeArgumentCount2(strict=false).types new file mode 100644 index 0000000000..f074d787ba --- /dev/null +++ b/testdata/baselines/reference/compiler/superCallInJSWithWrongBaseTypeArgumentCount2(strict=false).types @@ -0,0 +1,45 @@ +//// [tests/cases/compiler/superCallInJSWithWrongBaseTypeArgumentCount2.ts] //// + +=== a.ts === +export class A {} +>A : A + +=== b.js === +import { A } from './a.js'; +>A : typeof A + +/** @extends {A} */ +export class B1 extends A { +>B1 : B1 +>A : A + + constructor() { + super(); +>super() : void +>super : typeof A + } +} + +/** @extends {A} */ +export class B2 extends A { +>B2 : B2 +>A : A + + constructor() { + super(); +>super() : void +>super : typeof A + } +} + +/** @extends {A} */ +export class B3 extends A { +>B3 : B3 +>A : A + + constructor() { + super(); +>super() : void +>super : typeof A + } +} diff --git a/testdata/baselines/reference/compiler/superCallInJSWithWrongBaseTypeArgumentCount2(strict=true).errors.txt b/testdata/baselines/reference/compiler/superCallInJSWithWrongBaseTypeArgumentCount2(strict=true).errors.txt new file mode 100644 index 0000000000..a2ad36543e --- /dev/null +++ b/testdata/baselines/reference/compiler/superCallInJSWithWrongBaseTypeArgumentCount2(strict=true).errors.txt @@ -0,0 +1,34 @@ +b.js(4,25): error TS8026: Expected A type arguments; provide these with an '@extends' tag. +b.js(18,25): error TS8026: Expected A type arguments; provide these with an '@extends' tag. + + +==== a.ts (0 errors) ==== + export class A {} + +==== b.js (2 errors) ==== + import { A } from './a.js'; + + /** @extends {A} */ + export class B1 extends A { + ~ +!!! error TS8026: Expected A type arguments; provide these with an '@extends' tag. + constructor() { + super(); + } + } + + /** @extends {A} */ + export class B2 extends A { + constructor() { + super(); + } + } + + /** @extends {A} */ + export class B3 extends A { + ~ +!!! error TS8026: Expected A type arguments; provide these with an '@extends' tag. + constructor() { + super(); + } + } \ No newline at end of file diff --git a/testdata/baselines/reference/compiler/superCallInJSWithWrongBaseTypeArgumentCount2(strict=true).js b/testdata/baselines/reference/compiler/superCallInJSWithWrongBaseTypeArgumentCount2(strict=true).js new file mode 100644 index 0000000000..331070d2fe --- /dev/null +++ b/testdata/baselines/reference/compiler/superCallInJSWithWrongBaseTypeArgumentCount2(strict=true).js @@ -0,0 +1,81 @@ +//// [tests/cases/compiler/superCallInJSWithWrongBaseTypeArgumentCount2.ts] //// + +//// [a.ts] +export class A {} + +//// [b.js] +import { A } from './a.js'; + +/** @extends {A} */ +export class B1 extends A { + constructor() { + super(); + } +} + +/** @extends {A} */ +export class B2 extends A { + constructor() { + super(); + } +} + +/** @extends {A} */ +export class B3 extends A { + constructor() { + super(); + } +} + +//// [a.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.A = void 0; +class A { +} +exports.A = A; +//// [b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.B3 = exports.B2 = exports.B1 = void 0; +const a_js_1 = require("./a.js"); +/** @extends {A} */ +class B1 extends a_js_1.A { + constructor() { + super(); + } +} +exports.B1 = B1; +/** @extends {A} */ +class B2 extends a_js_1.A { + constructor() { + super(); + } +} +exports.B2 = B2; +/** @extends {A} */ +class B3 extends a_js_1.A { + constructor() { + super(); + } +} +exports.B3 = B3; + + +//// [a.d.ts] +export declare class A { +} +//// [b.d.ts] +import { A } from './a.js'; +/** @extends {A} */ +export declare class B1 extends A { + constructor(); +} +/** @extends {A} */ +export declare class B2 extends A { + constructor(); +} +/** @extends {A} */ +export declare class B3 extends A { + constructor(); +} diff --git a/testdata/baselines/reference/compiler/superCallInJSWithWrongBaseTypeArgumentCount2(strict=true).symbols b/testdata/baselines/reference/compiler/superCallInJSWithWrongBaseTypeArgumentCount2(strict=true).symbols new file mode 100644 index 0000000000..a39f3507c1 --- /dev/null +++ b/testdata/baselines/reference/compiler/superCallInJSWithWrongBaseTypeArgumentCount2(strict=true).symbols @@ -0,0 +1,43 @@ +//// [tests/cases/compiler/superCallInJSWithWrongBaseTypeArgumentCount2.ts] //// + +=== a.ts === +export class A {} +>A : Symbol(A, Decl(a.ts, 0, 0)) +>T : Symbol(T, Decl(a.ts, 0, 15)) + +=== b.js === +import { A } from './a.js'; +>A : Symbol(A, Decl(b.js, 0, 8)) + +/** @extends {A} */ +export class B1 extends A { +>B1 : Symbol(B1, Decl(b.js, 0, 27)) +>A : Symbol(A, Decl(b.js, 0, 8)) + + constructor() { + super(); +>super : Symbol(A, Decl(a.ts, 0, 0)) + } +} + +/** @extends {A} */ +export class B2 extends A { +>B2 : Symbol(B2, Decl(b.js, 7, 1)) +>A : Symbol(A, Decl(b.js, 0, 8)) + + constructor() { + super(); +>super : Symbol(A, Decl(a.ts, 0, 0)) + } +} + +/** @extends {A} */ +export class B3 extends A { +>B3 : Symbol(B3, Decl(b.js, 14, 1)) +>A : Symbol(A, Decl(b.js, 0, 8)) + + constructor() { + super(); +>super : Symbol(A, Decl(a.ts, 0, 0)) + } +} diff --git a/testdata/baselines/reference/compiler/superCallInJSWithWrongBaseTypeArgumentCount2(strict=true).types b/testdata/baselines/reference/compiler/superCallInJSWithWrongBaseTypeArgumentCount2(strict=true).types new file mode 100644 index 0000000000..f074d787ba --- /dev/null +++ b/testdata/baselines/reference/compiler/superCallInJSWithWrongBaseTypeArgumentCount2(strict=true).types @@ -0,0 +1,45 @@ +//// [tests/cases/compiler/superCallInJSWithWrongBaseTypeArgumentCount2.ts] //// + +=== a.ts === +export class A {} +>A : A + +=== b.js === +import { A } from './a.js'; +>A : typeof A + +/** @extends {A} */ +export class B1 extends A { +>B1 : B1 +>A : A + + constructor() { + super(); +>super() : void +>super : typeof A + } +} + +/** @extends {A} */ +export class B2 extends A { +>B2 : B2 +>A : A + + constructor() { + super(); +>super() : void +>super : typeof A + } +} + +/** @extends {A} */ +export class B3 extends A { +>B3 : B3 +>A : A + + constructor() { + super(); +>super() : void +>super : typeof A + } +} diff --git a/testdata/baselines/reference/submodule/compiler/arrayLiteralAndArrayConstructorEquivalence1.errors.txt b/testdata/baselines/reference/submodule/compiler/arrayLiteralAndArrayConstructorEquivalence1.errors.txt index 1a1d20698a..61c9f33cad 100644 --- a/testdata/baselines/reference/submodule/compiler/arrayLiteralAndArrayConstructorEquivalence1.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/arrayLiteralAndArrayConstructorEquivalence1.errors.txt @@ -1,4 +1,4 @@ -arrayLiteralAndArrayConstructorEquivalence1.ts(3,14): error TS2314: Generic type 'T[]' requires 1 type argument(s). +arrayLiteralAndArrayConstructorEquivalence1.ts(3,14): error TS2314: Generic type 'Array' requires 1 type argument(s). ==== arrayLiteralAndArrayConstructorEquivalence1.ts (1 errors) ==== @@ -6,7 +6,7 @@ arrayLiteralAndArrayConstructorEquivalence1.ts(3,14): error TS2314: Generic type var myCars3 = new Array({}); var myCars4: Array; // error ~~~~~ -!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). +!!! error TS2314: Generic type 'Array' requires 1 type argument(s). var myCars5: Array[]; myCars = myCars3; diff --git a/testdata/baselines/reference/submodule/compiler/arrayLiteralAndArrayConstructorEquivalence1.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/arrayLiteralAndArrayConstructorEquivalence1.errors.txt.diff deleted file mode 100644 index fb0330c9d3..0000000000 --- a/testdata/baselines/reference/submodule/compiler/arrayLiteralAndArrayConstructorEquivalence1.errors.txt.diff +++ /dev/null @@ -1,17 +0,0 @@ ---- old.arrayLiteralAndArrayConstructorEquivalence1.errors.txt -+++ new.arrayLiteralAndArrayConstructorEquivalence1.errors.txt -@@= skipped -0, +0 lines =@@ --arrayLiteralAndArrayConstructorEquivalence1.ts(3,14): error TS2314: Generic type 'Array' requires 1 type argument(s). -+arrayLiteralAndArrayConstructorEquivalence1.ts(3,14): error TS2314: Generic type 'T[]' requires 1 type argument(s). - - - ==== arrayLiteralAndArrayConstructorEquivalence1.ts (1 errors) ==== -@@= skipped -5, +5 lines =@@ - var myCars3 = new Array({}); - var myCars4: Array; // error - ~~~~~ --!!! error TS2314: Generic type 'Array' requires 1 type argument(s). -+!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). - var myCars5: Array[]; - - myCars = myCars3; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/arrayReferenceWithoutTypeArgs.errors.txt b/testdata/baselines/reference/submodule/compiler/arrayReferenceWithoutTypeArgs.errors.txt index 15d7149cd3..7114eb4548 100644 --- a/testdata/baselines/reference/submodule/compiler/arrayReferenceWithoutTypeArgs.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/arrayReferenceWithoutTypeArgs.errors.txt @@ -1,9 +1,9 @@ -arrayReferenceWithoutTypeArgs.ts(2,17): error TS2314: Generic type 'T[]' requires 1 type argument(s). +arrayReferenceWithoutTypeArgs.ts(2,17): error TS2314: Generic type 'Array' requires 1 type argument(s). ==== arrayReferenceWithoutTypeArgs.ts (1 errors) ==== class X { public f(a: Array) { } ~~~~~ -!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). +!!! error TS2314: Generic type 'Array' requires 1 type argument(s). } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/arrayReferenceWithoutTypeArgs.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/arrayReferenceWithoutTypeArgs.errors.txt.diff deleted file mode 100644 index 46153f1d0b..0000000000 --- a/testdata/baselines/reference/submodule/compiler/arrayReferenceWithoutTypeArgs.errors.txt.diff +++ /dev/null @@ -1,14 +0,0 @@ ---- old.arrayReferenceWithoutTypeArgs.errors.txt -+++ new.arrayReferenceWithoutTypeArgs.errors.txt -@@= skipped -0, +0 lines =@@ --arrayReferenceWithoutTypeArgs.ts(2,17): error TS2314: Generic type 'Array' requires 1 type argument(s). -+arrayReferenceWithoutTypeArgs.ts(2,17): error TS2314: Generic type 'T[]' requires 1 type argument(s). - - - ==== arrayReferenceWithoutTypeArgs.ts (1 errors) ==== - class X { - public f(a: Array) { } - ~~~~~ --!!! error TS2314: Generic type 'Array' requires 1 type argument(s). -+!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/defaultPropsEmptyCurlyBecomesAnyForJs.errors.txt b/testdata/baselines/reference/submodule/compiler/defaultPropsEmptyCurlyBecomesAnyForJs.errors.txt deleted file mode 100644 index e169325b99..0000000000 --- a/testdata/baselines/reference/submodule/compiler/defaultPropsEmptyCurlyBecomesAnyForJs.errors.txt +++ /dev/null @@ -1,35 +0,0 @@ -typed_component.ts(5,20): error TS2339: Property 'x' does not exist on type '{}'. -typed_component.ts(6,20): error TS2339: Property 'y' does not exist on type '{}'. -typed_component.ts(7,20): error TS2339: Property 'value' does not exist on type '{}'. - - -==== library.d.ts (0 errors) ==== - export class Foo { - props: T; - state: U; - constructor(props: T, state: U); - } - -==== component.js (0 errors) ==== - import { Foo } from "./library"; - export class MyFoo extends Foo { - member; - } - -==== typed_component.ts (3 errors) ==== - import { MyFoo } from "./component"; - export class TypedFoo extends MyFoo { - constructor() { - super({x: "string", y: 42}, { value: undefined }); - this.props.x; - ~ -!!! error TS2339: Property 'x' does not exist on type '{}'. - this.props.y; - ~ -!!! error TS2339: Property 'y' does not exist on type '{}'. - this.state.value; - ~~~~~ -!!! error TS2339: Property 'value' does not exist on type '{}'. - this.member; - } - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/defaultPropsEmptyCurlyBecomesAnyForJs.types b/testdata/baselines/reference/submodule/compiler/defaultPropsEmptyCurlyBecomesAnyForJs.types index 2444d0db26..41fba90f36 100644 --- a/testdata/baselines/reference/submodule/compiler/defaultPropsEmptyCurlyBecomesAnyForJs.types +++ b/testdata/baselines/reference/submodule/compiler/defaultPropsEmptyCurlyBecomesAnyForJs.types @@ -21,7 +21,7 @@ import { Foo } from "./library"; export class MyFoo extends Foo { >MyFoo : MyFoo ->Foo : Foo<{}, {}> +>Foo : Foo member; >member : any @@ -50,23 +50,23 @@ export class TypedFoo extends MyFoo { this.props.x; >this.props.x : any ->this.props : {} +>this.props : any >this : this ->props : {} +>props : any >x : any this.props.y; >this.props.y : any ->this.props : {} +>this.props : any >this : this ->props : {} +>props : any >y : any this.state.value; >this.state.value : any ->this.state : {} +>this.state : any >this : this ->state : {} +>state : any >value : any this.member; diff --git a/testdata/baselines/reference/submodule/compiler/fillInMissingTypeArgsOnJSConstructCalls.errors.txt b/testdata/baselines/reference/submodule/compiler/fillInMissingTypeArgsOnJSConstructCalls.errors.txt index 4c1cc57fe3..a044985514 100644 --- a/testdata/baselines/reference/submodule/compiler/fillInMissingTypeArgsOnJSConstructCalls.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/fillInMissingTypeArgsOnJSConstructCalls.errors.txt @@ -1,7 +1,6 @@ BaseB.js(2,25): error TS1005: ',' expected. BaseB.js(3,14): error TS2304: Cannot find name 'Class'. BaseB.js(4,25): error TS2304: Cannot find name 'Class'. -SubB.js(3,35): error TS2314: Generic type 'B' requires 2 type argument(s). ==== BaseA.js (0 errors) ==== @@ -25,12 +24,10 @@ SubB.js(3,35): error TS2314: Generic type 'B' requires 2 type argument this._AClass = AClass; } } -==== SubB.js (1 errors) ==== +==== SubB.js (0 errors) ==== import SubA from './SubA'; import BaseB from './BaseB'; export default class SubB extends BaseB { - ~~~~~~~~~~~ -!!! error TS2314: Generic type 'B' requires 2 type argument(s). constructor() { super(SubA); } diff --git a/testdata/baselines/reference/submodule/compiler/fillInMissingTypeArgsOnJSConstructCalls.symbols b/testdata/baselines/reference/submodule/compiler/fillInMissingTypeArgsOnJSConstructCalls.symbols index 25e7944164..37c60b79a6 100644 --- a/testdata/baselines/reference/submodule/compiler/fillInMissingTypeArgsOnJSConstructCalls.symbols +++ b/testdata/baselines/reference/submodule/compiler/fillInMissingTypeArgsOnJSConstructCalls.symbols @@ -52,6 +52,7 @@ export default class SubB extends BaseB { constructor() { super(SubA); +>super : Symbol(B, Decl(BaseB.js, 0, 28)) >SubA : Symbol(SubA, Decl(SubB.js, 0, 6)) } } diff --git a/testdata/baselines/reference/submodule/compiler/fillInMissingTypeArgsOnJSConstructCalls.symbols.diff b/testdata/baselines/reference/submodule/compiler/fillInMissingTypeArgsOnJSConstructCalls.symbols.diff index 6b67b4c6f6..6c79a32755 100644 --- a/testdata/baselines/reference/submodule/compiler/fillInMissingTypeArgsOnJSConstructCalls.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/fillInMissingTypeArgsOnJSConstructCalls.symbols.diff @@ -26,6 +26,7 @@ constructor() { super(SubA); ->super : Symbol(BaseB, Decl(BaseB.js, 0, 28)) ++>super : Symbol(B, Decl(BaseB.js, 0, 28)) >SubA : Symbol(SubA, Decl(SubB.js, 0, 6)) } } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/fillInMissingTypeArgsOnJSConstructCalls.types b/testdata/baselines/reference/submodule/compiler/fillInMissingTypeArgsOnJSConstructCalls.types index b60b64bdc2..1818b2c36b 100644 --- a/testdata/baselines/reference/submodule/compiler/fillInMissingTypeArgsOnJSConstructCalls.types +++ b/testdata/baselines/reference/submodule/compiler/fillInMissingTypeArgsOnJSConstructCalls.types @@ -42,12 +42,12 @@ import BaseB from './BaseB'; export default class SubB extends BaseB { >SubB : SubB ->BaseB : typeof BaseB +>BaseB : BaseB constructor() { super(SubA); >super(SubA) : void ->super : any +>super : typeof BaseB >SubA : typeof SubA } } diff --git a/testdata/baselines/reference/submodule/compiler/genericArrayAssignmentCompatErrors.errors.txt b/testdata/baselines/reference/submodule/compiler/genericArrayAssignmentCompatErrors.errors.txt index 4f0f19a24b..28dadd442c 100644 --- a/testdata/baselines/reference/submodule/compiler/genericArrayAssignmentCompatErrors.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/genericArrayAssignmentCompatErrors.errors.txt @@ -1,6 +1,6 @@ genericArrayAssignmentCompatErrors.ts(2,19): error TS2351: This expression is not constructable. Type 'undefined[]' has no construct signatures. -genericArrayAssignmentCompatErrors.ts(4,14): error TS2314: Generic type 'T[]' requires 1 type argument(s). +genericArrayAssignmentCompatErrors.ts(4,14): error TS2314: Generic type 'Array' requires 1 type argument(s). ==== genericArrayAssignmentCompatErrors.ts (2 errors) ==== @@ -12,7 +12,7 @@ genericArrayAssignmentCompatErrors.ts(4,14): error TS2314: Generic type 'T[]' re var myCars3 = new Array({}); var myCars4: Array; // error ~~~~~ -!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). +!!! error TS2314: Generic type 'Array' requires 1 type argument(s). var myCars5: Array[]; myCars = myCars2; diff --git a/testdata/baselines/reference/submodule/compiler/genericArrayAssignmentCompatErrors.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/genericArrayAssignmentCompatErrors.errors.txt.diff deleted file mode 100644 index 9af44f9dee..0000000000 --- a/testdata/baselines/reference/submodule/compiler/genericArrayAssignmentCompatErrors.errors.txt.diff +++ /dev/null @@ -1,19 +0,0 @@ ---- old.genericArrayAssignmentCompatErrors.errors.txt -+++ new.genericArrayAssignmentCompatErrors.errors.txt -@@= skipped -0, +0 lines =@@ - genericArrayAssignmentCompatErrors.ts(2,19): error TS2351: This expression is not constructable. - Type 'undefined[]' has no construct signatures. --genericArrayAssignmentCompatErrors.ts(4,14): error TS2314: Generic type 'Array' requires 1 type argument(s). -+genericArrayAssignmentCompatErrors.ts(4,14): error TS2314: Generic type 'T[]' requires 1 type argument(s). - - - ==== genericArrayAssignmentCompatErrors.ts (2 errors) ==== -@@= skipped -11, +11 lines =@@ - var myCars3 = new Array({}); - var myCars4: Array; // error - ~~~~~ --!!! error TS2314: Generic type 'Array' requires 1 type argument(s). -+!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). - var myCars5: Array[]; - - myCars = myCars2; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/genericDefaultsJs.errors.txt b/testdata/baselines/reference/submodule/compiler/genericDefaultsJs.errors.txt deleted file mode 100644 index ac88fe62b4..0000000000 --- a/testdata/baselines/reference/submodule/compiler/genericDefaultsJs.errors.txt +++ /dev/null @@ -1,130 +0,0 @@ -main.js(19,21): error TS2314: Generic type 'C0' requires 1 type argument(s). -main.js(20,21): error TS2314: Generic type 'C0' requires 1 type argument(s). -main.js(25,21): error TS2314: Generic type 'C0' requires 1 type argument(s). -main.js(31,22): error TS2351: This expression is not constructable. - Type 'typeof C0_B0' has no construct signatures. -main.js(34,22): error TS2351: This expression is not constructable. - Type 'typeof C0_B0' has no construct signatures. -main.js(38,29): error TS2339: Property 'y' does not exist on type 'C0_B1'. -main.js(41,29): error TS2339: Property 'y' does not exist on type 'C0_B2'. -main.js(43,21): error TS2707: Generic type 'C1' requires between 1 and 2 type arguments. -main.js(44,21): error TS2707: Generic type 'C1' requires between 1 and 2 type arguments. -main.js(49,21): error TS2707: Generic type 'C1' requires between 1 and 2 type arguments. -main.js(55,22): error TS2351: This expression is not constructable. - Type 'typeof C1_B0' has no construct signatures. -main.js(58,22): error TS2351: This expression is not constructable. - Type 'typeof C1_B0' has no construct signatures. -main.js(62,29): error TS2339: Property 'y' does not exist on type 'C1_B1'. -main.js(65,29): error TS2339: Property 'y' does not exist on type 'C1_B2'. - - -==== decls.d.ts (0 errors) ==== - declare function f0(x?: T): T; - declare function f1(x?: T): [T, U]; - declare class C0 { - y: T; - constructor(x?: T); - } - declare class C1 { - y: [T, U]; - constructor(x?: T); - } -==== main.js (14 errors) ==== - const f0_v0 = f0(); - const f0_v1 = f0(1); - - const f1_c0 = f1(); - const f1_c1 = f1(1); - - const C0_v0 = new C0(); - const C0_v0_y = C0_v0.y; - - const C0_v1 = new C0(1); - const C0_v1_y = C0_v1.y; - - const C1_v0 = new C1(); - const C1_v0_y = C1_v0.y; - - const C1_v1 = new C1(1); - const C1_v1_y = C1_v1.y; - - class C0_B0 extends C0 {} - ~~ -!!! error TS2314: Generic type 'C0' requires 1 type argument(s). - class C0_B1 extends C0 { - ~~ -!!! error TS2314: Generic type 'C0' requires 1 type argument(s). - constructor() { - super(); - } - } - class C0_B2 extends C0 { - ~~ -!!! error TS2314: Generic type 'C0' requires 1 type argument(s). - constructor() { - super(1); - } - } - - const C0_B0_v0 = new C0_B0(); - ~~~~~ -!!! error TS2351: This expression is not constructable. -!!! error TS2351: Type 'typeof C0_B0' has no construct signatures. - const C0_B0_v0_y = C0_B0_v0.y; - - const C0_B0_v1 = new C0_B0(1); - ~~~~~ -!!! error TS2351: This expression is not constructable. -!!! error TS2351: Type 'typeof C0_B0' has no construct signatures. - const C0_B0_v1_y = C0_B0_v1.y; - - const C0_B1_v0 = new C0_B1(); - const C0_B1_v0_y = C0_B1_v0.y; - ~ -!!! error TS2339: Property 'y' does not exist on type 'C0_B1'. - - const C0_B2_v0 = new C0_B2(); - const C0_B2_v0_y = C0_B2_v0.y; - ~ -!!! error TS2339: Property 'y' does not exist on type 'C0_B2'. - - class C1_B0 extends C1 {} - ~~ -!!! error TS2707: Generic type 'C1' requires between 1 and 2 type arguments. - class C1_B1 extends C1 { - ~~ -!!! error TS2707: Generic type 'C1' requires between 1 and 2 type arguments. - constructor() { - super(); - } - } - class C1_B2 extends C1 { - ~~ -!!! error TS2707: Generic type 'C1' requires between 1 and 2 type arguments. - constructor() { - super(1); - } - } - - const C1_B0_v0 = new C1_B0(); - ~~~~~ -!!! error TS2351: This expression is not constructable. -!!! error TS2351: Type 'typeof C1_B0' has no construct signatures. - const C1_B0_v0_y = C1_B0_v0.y; - - const C1_B0_v1 = new C1_B0(1); - ~~~~~ -!!! error TS2351: This expression is not constructable. -!!! error TS2351: Type 'typeof C1_B0' has no construct signatures. - const C1_B0_v1_y = C1_B0_v1.y; - - const C1_B1_v0 = new C1_B1(); - const C1_B1_v0_y = C1_B1_v0.y; - ~ -!!! error TS2339: Property 'y' does not exist on type 'C1_B1'. - - const C1_B2_v0 = new C1_B2(); - const C1_B2_v0_y = C1_B2_v0.y; - ~ -!!! error TS2339: Property 'y' does not exist on type 'C1_B2'. - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/genericDefaultsJs.symbols b/testdata/baselines/reference/submodule/compiler/genericDefaultsJs.symbols index 3a85bc0077..cd78a51b39 100644 --- a/testdata/baselines/reference/submodule/compiler/genericDefaultsJs.symbols +++ b/testdata/baselines/reference/submodule/compiler/genericDefaultsJs.symbols @@ -110,6 +110,7 @@ class C0_B1 extends C0 { constructor() { super(); +>super : Symbol(C0, Decl(decls.d.ts, 1, 50)) } } class C0_B2 extends C0 { @@ -118,6 +119,7 @@ class C0_B2 extends C0 { constructor() { super(1); +>super : Symbol(C0, Decl(decls.d.ts, 1, 50)) } } @@ -127,7 +129,9 @@ const C0_B0_v0 = new C0_B0(); const C0_B0_v0_y = C0_B0_v0.y; >C0_B0_v0_y : Symbol(C0_B0_v0_y, Decl(main.js, 31, 5)) +>C0_B0_v0.y : Symbol(y, Decl(decls.d.ts, 2, 21)) >C0_B0_v0 : Symbol(C0_B0_v0, Decl(main.js, 30, 5)) +>y : Symbol(y, Decl(decls.d.ts, 2, 21)) const C0_B0_v1 = new C0_B0(1); >C0_B0_v1 : Symbol(C0_B0_v1, Decl(main.js, 33, 5)) @@ -135,7 +139,9 @@ const C0_B0_v1 = new C0_B0(1); const C0_B0_v1_y = C0_B0_v1.y; >C0_B0_v1_y : Symbol(C0_B0_v1_y, Decl(main.js, 34, 5)) +>C0_B0_v1.y : Symbol(y, Decl(decls.d.ts, 2, 21)) >C0_B0_v1 : Symbol(C0_B0_v1, Decl(main.js, 33, 5)) +>y : Symbol(y, Decl(decls.d.ts, 2, 21)) const C0_B1_v0 = new C0_B1(); >C0_B1_v0 : Symbol(C0_B1_v0, Decl(main.js, 36, 5)) @@ -143,7 +149,9 @@ const C0_B1_v0 = new C0_B1(); const C0_B1_v0_y = C0_B1_v0.y; >C0_B1_v0_y : Symbol(C0_B1_v0_y, Decl(main.js, 37, 5)) +>C0_B1_v0.y : Symbol(y, Decl(decls.d.ts, 2, 21)) >C0_B1_v0 : Symbol(C0_B1_v0, Decl(main.js, 36, 5)) +>y : Symbol(y, Decl(decls.d.ts, 2, 21)) const C0_B2_v0 = new C0_B2(); >C0_B2_v0 : Symbol(C0_B2_v0, Decl(main.js, 39, 5)) @@ -151,7 +159,9 @@ const C0_B2_v0 = new C0_B2(); const C0_B2_v0_y = C0_B2_v0.y; >C0_B2_v0_y : Symbol(C0_B2_v0_y, Decl(main.js, 40, 5)) +>C0_B2_v0.y : Symbol(y, Decl(decls.d.ts, 2, 21)) >C0_B2_v0 : Symbol(C0_B2_v0, Decl(main.js, 39, 5)) +>y : Symbol(y, Decl(decls.d.ts, 2, 21)) class C1_B0 extends C1 {} >C1_B0 : Symbol(C1_B0, Decl(main.js, 40, 30)) @@ -163,6 +173,7 @@ class C1_B1 extends C1 { constructor() { super(); +>super : Symbol(C1, Decl(decls.d.ts, 5, 1)) } } class C1_B2 extends C1 { @@ -171,6 +182,7 @@ class C1_B2 extends C1 { constructor() { super(1); +>super : Symbol(C1, Decl(decls.d.ts, 5, 1)) } } @@ -180,7 +192,9 @@ const C1_B0_v0 = new C1_B0(); const C1_B0_v0_y = C1_B0_v0.y; >C1_B0_v0_y : Symbol(C1_B0_v0_y, Decl(main.js, 55, 5)) +>C1_B0_v0.y : Symbol(y, Decl(decls.d.ts, 6, 33)) >C1_B0_v0 : Symbol(C1_B0_v0, Decl(main.js, 54, 5)) +>y : Symbol(y, Decl(decls.d.ts, 6, 33)) const C1_B0_v1 = new C1_B0(1); >C1_B0_v1 : Symbol(C1_B0_v1, Decl(main.js, 57, 5)) @@ -188,7 +202,9 @@ const C1_B0_v1 = new C1_B0(1); const C1_B0_v1_y = C1_B0_v1.y; >C1_B0_v1_y : Symbol(C1_B0_v1_y, Decl(main.js, 58, 5)) +>C1_B0_v1.y : Symbol(y, Decl(decls.d.ts, 6, 33)) >C1_B0_v1 : Symbol(C1_B0_v1, Decl(main.js, 57, 5)) +>y : Symbol(y, Decl(decls.d.ts, 6, 33)) const C1_B1_v0 = new C1_B1(); >C1_B1_v0 : Symbol(C1_B1_v0, Decl(main.js, 60, 5)) @@ -196,7 +212,9 @@ const C1_B1_v0 = new C1_B1(); const C1_B1_v0_y = C1_B1_v0.y; >C1_B1_v0_y : Symbol(C1_B1_v0_y, Decl(main.js, 61, 5)) +>C1_B1_v0.y : Symbol(y, Decl(decls.d.ts, 6, 33)) >C1_B1_v0 : Symbol(C1_B1_v0, Decl(main.js, 60, 5)) +>y : Symbol(y, Decl(decls.d.ts, 6, 33)) const C1_B2_v0 = new C1_B2(); >C1_B2_v0 : Symbol(C1_B2_v0, Decl(main.js, 63, 5)) @@ -204,5 +222,7 @@ const C1_B2_v0 = new C1_B2(); const C1_B2_v0_y = C1_B2_v0.y; >C1_B2_v0_y : Symbol(C1_B2_v0_y, Decl(main.js, 64, 5)) +>C1_B2_v0.y : Symbol(y, Decl(decls.d.ts, 6, 33)) >C1_B2_v0 : Symbol(C1_B2_v0, Decl(main.js, 63, 5)) +>y : Symbol(y, Decl(decls.d.ts, 6, 33)) diff --git a/testdata/baselines/reference/submodule/compiler/genericDefaultsJs.symbols.diff b/testdata/baselines/reference/submodule/compiler/genericDefaultsJs.symbols.diff index d8b4f85c1a..c77646be9f 100644 --- a/testdata/baselines/reference/submodule/compiler/genericDefaultsJs.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/genericDefaultsJs.symbols.diff @@ -66,112 +66,96 @@ class C0_B0 extends C0 {} >C0_B0 : Symbol(C0_B0, Decl(main.js, 16, 24)) -@@= skipped -14, +14 lines =@@ - - constructor() { - super(); -->super : Symbol(C0, Decl(decls.d.ts, 1, 50)) - } - } - class C0_B2 extends C0 { -@@= skipped -9, +8 lines =@@ - - constructor() { - super(1); -->super : Symbol(C0, Decl(decls.d.ts, 1, 50)) - } - } - -@@= skipped -10, +9 lines =@@ +@@= skipped -33, +33 lines =@@ const C0_B0_v0_y = C0_B0_v0.y; >C0_B0_v0_y : Symbol(C0_B0_v0_y, Decl(main.js, 31, 5)) ->C0_B0_v0.y : Symbol(C0.y, Decl(decls.d.ts, 2, 21)) ++>C0_B0_v0.y : Symbol(y, Decl(decls.d.ts, 2, 21)) >C0_B0_v0 : Symbol(C0_B0_v0, Decl(main.js, 30, 5)) ->y : Symbol(C0.y, Decl(decls.d.ts, 2, 21)) ++>y : Symbol(y, Decl(decls.d.ts, 2, 21)) const C0_B0_v1 = new C0_B0(1); >C0_B0_v1 : Symbol(C0_B0_v1, Decl(main.js, 33, 5)) -@@= skipped -10, +8 lines =@@ +@@= skipped -10, +10 lines =@@ const C0_B0_v1_y = C0_B0_v1.y; >C0_B0_v1_y : Symbol(C0_B0_v1_y, Decl(main.js, 34, 5)) ->C0_B0_v1.y : Symbol(C0.y, Decl(decls.d.ts, 2, 21)) ++>C0_B0_v1.y : Symbol(y, Decl(decls.d.ts, 2, 21)) >C0_B0_v1 : Symbol(C0_B0_v1, Decl(main.js, 33, 5)) ->y : Symbol(C0.y, Decl(decls.d.ts, 2, 21)) ++>y : Symbol(y, Decl(decls.d.ts, 2, 21)) const C0_B1_v0 = new C0_B1(); >C0_B1_v0 : Symbol(C0_B1_v0, Decl(main.js, 36, 5)) -@@= skipped -10, +8 lines =@@ +@@= skipped -10, +10 lines =@@ const C0_B1_v0_y = C0_B1_v0.y; >C0_B1_v0_y : Symbol(C0_B1_v0_y, Decl(main.js, 37, 5)) ->C0_B1_v0.y : Symbol(C0.y, Decl(decls.d.ts, 2, 21)) ++>C0_B1_v0.y : Symbol(y, Decl(decls.d.ts, 2, 21)) >C0_B1_v0 : Symbol(C0_B1_v0, Decl(main.js, 36, 5)) ->y : Symbol(C0.y, Decl(decls.d.ts, 2, 21)) ++>y : Symbol(y, Decl(decls.d.ts, 2, 21)) const C0_B2_v0 = new C0_B2(); >C0_B2_v0 : Symbol(C0_B2_v0, Decl(main.js, 39, 5)) -@@= skipped -10, +8 lines =@@ +@@= skipped -10, +10 lines =@@ const C0_B2_v0_y = C0_B2_v0.y; >C0_B2_v0_y : Symbol(C0_B2_v0_y, Decl(main.js, 40, 5)) ->C0_B2_v0.y : Symbol(C0.y, Decl(decls.d.ts, 2, 21)) ++>C0_B2_v0.y : Symbol(y, Decl(decls.d.ts, 2, 21)) >C0_B2_v0 : Symbol(C0_B2_v0, Decl(main.js, 39, 5)) ->y : Symbol(C0.y, Decl(decls.d.ts, 2, 21)) ++>y : Symbol(y, Decl(decls.d.ts, 2, 21)) class C1_B0 extends C1 {} >C1_B0 : Symbol(C1_B0, Decl(main.js, 40, 30)) -@@= skipped -14, +12 lines =@@ - - constructor() { - super(); -->super : Symbol(C1, Decl(decls.d.ts, 5, 1)) - } - } - class C1_B2 extends C1 { -@@= skipped -9, +8 lines =@@ - - constructor() { - super(1); -->super : Symbol(C1, Decl(decls.d.ts, 5, 1)) - } - } - -@@= skipped -10, +9 lines =@@ +@@= skipped -33, +33 lines =@@ const C1_B0_v0_y = C1_B0_v0.y; >C1_B0_v0_y : Symbol(C1_B0_v0_y, Decl(main.js, 55, 5)) ->C1_B0_v0.y : Symbol(C1.y, Decl(decls.d.ts, 6, 33)) ++>C1_B0_v0.y : Symbol(y, Decl(decls.d.ts, 6, 33)) >C1_B0_v0 : Symbol(C1_B0_v0, Decl(main.js, 54, 5)) ->y : Symbol(C1.y, Decl(decls.d.ts, 6, 33)) ++>y : Symbol(y, Decl(decls.d.ts, 6, 33)) const C1_B0_v1 = new C1_B0(1); >C1_B0_v1 : Symbol(C1_B0_v1, Decl(main.js, 57, 5)) -@@= skipped -10, +8 lines =@@ +@@= skipped -10, +10 lines =@@ const C1_B0_v1_y = C1_B0_v1.y; >C1_B0_v1_y : Symbol(C1_B0_v1_y, Decl(main.js, 58, 5)) ->C1_B0_v1.y : Symbol(C1.y, Decl(decls.d.ts, 6, 33)) ++>C1_B0_v1.y : Symbol(y, Decl(decls.d.ts, 6, 33)) >C1_B0_v1 : Symbol(C1_B0_v1, Decl(main.js, 57, 5)) ->y : Symbol(C1.y, Decl(decls.d.ts, 6, 33)) ++>y : Symbol(y, Decl(decls.d.ts, 6, 33)) const C1_B1_v0 = new C1_B1(); >C1_B1_v0 : Symbol(C1_B1_v0, Decl(main.js, 60, 5)) -@@= skipped -10, +8 lines =@@ +@@= skipped -10, +10 lines =@@ const C1_B1_v0_y = C1_B1_v0.y; >C1_B1_v0_y : Symbol(C1_B1_v0_y, Decl(main.js, 61, 5)) ->C1_B1_v0.y : Symbol(C1.y, Decl(decls.d.ts, 6, 33)) ++>C1_B1_v0.y : Symbol(y, Decl(decls.d.ts, 6, 33)) >C1_B1_v0 : Symbol(C1_B1_v0, Decl(main.js, 60, 5)) ->y : Symbol(C1.y, Decl(decls.d.ts, 6, 33)) ++>y : Symbol(y, Decl(decls.d.ts, 6, 33)) const C1_B2_v0 = new C1_B2(); >C1_B2_v0 : Symbol(C1_B2_v0, Decl(main.js, 63, 5)) -@@= skipped -10, +8 lines =@@ +@@= skipped -10, +10 lines =@@ const C1_B2_v0_y = C1_B2_v0.y; >C1_B2_v0_y : Symbol(C1_B2_v0_y, Decl(main.js, 64, 5)) ->C1_B2_v0.y : Symbol(C1.y, Decl(decls.d.ts, 6, 33)) ++>C1_B2_v0.y : Symbol(y, Decl(decls.d.ts, 6, 33)) >C1_B2_v0 : Symbol(C1_B2_v0, Decl(main.js, 63, 5)) ->y : Symbol(C1.y, Decl(decls.d.ts, 6, 33)) ++>y : Symbol(y, Decl(decls.d.ts, 6, 33)) diff --git a/testdata/baselines/reference/submodule/compiler/genericDefaultsJs.types b/testdata/baselines/reference/submodule/compiler/genericDefaultsJs.types index 7ae84a41c1..034f4c762b 100644 --- a/testdata/baselines/reference/submodule/compiler/genericDefaultsJs.types +++ b/testdata/baselines/reference/submodule/compiler/genericDefaultsJs.types @@ -98,51 +98,51 @@ const C1_v1_y = C1_v1.y; class C0_B0 extends C0 {} >C0_B0 : C0_B0 ->C0 : typeof C0 +>C0 : C0 class C0_B1 extends C0 { >C0_B1 : C0_B1 ->C0 : typeof C0 +>C0 : C0 constructor() { super(); >super() : void ->super : any +>super : typeof C0 } } class C0_B2 extends C0 { >C0_B2 : C0_B2 ->C0 : typeof C0 +>C0 : C0 constructor() { super(1); >super(1) : void ->super : any +>super : typeof C0 >1 : 1 } } const C0_B0_v0 = new C0_B0(); ->C0_B0_v0 : any ->new C0_B0() : any +>C0_B0_v0 : C0_B0 +>new C0_B0() : C0_B0 >C0_B0 : typeof C0_B0 const C0_B0_v0_y = C0_B0_v0.y; >C0_B0_v0_y : any >C0_B0_v0.y : any ->C0_B0_v0 : any +>C0_B0_v0 : C0_B0 >y : any const C0_B0_v1 = new C0_B0(1); ->C0_B0_v1 : any ->new C0_B0(1) : any +>C0_B0_v1 : C0_B0 +>new C0_B0(1) : C0_B0 >C0_B0 : typeof C0_B0 >1 : 1 const C0_B0_v1_y = C0_B0_v1.y; >C0_B0_v1_y : any >C0_B0_v1.y : any ->C0_B0_v1 : any +>C0_B0_v1 : C0_B0 >y : any const C0_B1_v0 = new C0_B1(); @@ -169,52 +169,52 @@ const C0_B2_v0_y = C0_B2_v0.y; class C1_B0 extends C1 {} >C1_B0 : C1_B0 ->C1 : typeof C1 +>C1 : C1 class C1_B1 extends C1 { >C1_B1 : C1_B1 ->C1 : typeof C1 +>C1 : C1 constructor() { super(); >super() : void ->super : any +>super : typeof C1 } } class C1_B2 extends C1 { >C1_B2 : C1_B2 ->C1 : typeof C1 +>C1 : C1 constructor() { super(1); >super(1) : void ->super : any +>super : typeof C1 >1 : 1 } } const C1_B0_v0 = new C1_B0(); ->C1_B0_v0 : any ->new C1_B0() : any +>C1_B0_v0 : C1_B0 +>new C1_B0() : C1_B0 >C1_B0 : typeof C1_B0 const C1_B0_v0_y = C1_B0_v0.y; ->C1_B0_v0_y : any ->C1_B0_v0.y : any ->C1_B0_v0 : any ->y : any +>C1_B0_v0_y : [any, number] +>C1_B0_v0.y : [any, number] +>C1_B0_v0 : C1_B0 +>y : [any, number] const C1_B0_v1 = new C1_B0(1); ->C1_B0_v1 : any ->new C1_B0(1) : any +>C1_B0_v1 : C1_B0 +>new C1_B0(1) : C1_B0 >C1_B0 : typeof C1_B0 >1 : 1 const C1_B0_v1_y = C1_B0_v1.y; ->C1_B0_v1_y : any ->C1_B0_v1.y : any ->C1_B0_v1 : any ->y : any +>C1_B0_v1_y : [any, number] +>C1_B0_v1.y : [any, number] +>C1_B0_v1 : C1_B0 +>y : [any, number] const C1_B1_v0 = new C1_B1(); >C1_B1_v0 : C1_B1 @@ -222,10 +222,10 @@ const C1_B1_v0 = new C1_B1(); >C1_B1 : typeof C1_B1 const C1_B1_v0_y = C1_B1_v0.y; ->C1_B1_v0_y : any ->C1_B1_v0.y : any +>C1_B1_v0_y : [any, number] +>C1_B1_v0.y : [any, number] >C1_B1_v0 : C1_B1 ->y : any +>y : [any, number] const C1_B2_v0 = new C1_B2(); >C1_B2_v0 : C1_B2 @@ -233,8 +233,8 @@ const C1_B2_v0 = new C1_B2(); >C1_B2 : typeof C1_B2 const C1_B2_v0_y = C1_B2_v0.y; ->C1_B2_v0_y : any ->C1_B2_v0.y : any +>C1_B2_v0_y : [any, number] +>C1_B2_v0.y : [any, number] >C1_B2_v0 : C1_B2 ->y : any +>y : [any, number] diff --git a/testdata/baselines/reference/submodule/compiler/isolatedDeclarationsAddUndefined2.errors.txt b/testdata/baselines/reference/submodule/compiler/isolatedDeclarationsAddUndefined2.errors.txt index 8e78de6fdd..638ebb2a88 100644 --- a/testdata/baselines/reference/submodule/compiler/isolatedDeclarationsAddUndefined2.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/isolatedDeclarationsAddUndefined2.errors.txt @@ -1,8 +1,8 @@ -isolatedDeclarationsAddUndefined2.ts(4,29): error TS2314: Generic type 'T[]' requires 1 type argument(s). -isolatedDeclarationsAddUndefined2.ts(8,29): error TS2314: Generic type 'T[]' requires 1 type argument(s). -isolatedDeclarationsAddUndefined2.ts(12,28): error TS2314: Generic type 'T[]' requires 1 type argument(s). -isolatedDeclarationsAddUndefined2.ts(16,28): error TS2314: Generic type 'T[]' requires 1 type argument(s). -isolatedDeclarationsAddUndefined2.ts(19,27): error TS2314: Generic type 'T[]' requires 1 type argument(s). +isolatedDeclarationsAddUndefined2.ts(4,29): error TS2314: Generic type 'Array' requires 1 type argument(s). +isolatedDeclarationsAddUndefined2.ts(8,29): error TS2314: Generic type 'Array' requires 1 type argument(s). +isolatedDeclarationsAddUndefined2.ts(12,28): error TS2314: Generic type 'Array' requires 1 type argument(s). +isolatedDeclarationsAddUndefined2.ts(16,28): error TS2314: Generic type 'Array' requires 1 type argument(s). +isolatedDeclarationsAddUndefined2.ts(19,27): error TS2314: Generic type 'Array' requires 1 type argument(s). isolatedDeclarationsAddUndefined2.ts(21,27): error TS2304: Cannot find name 'Unresolved'. isolatedDeclarationsAddUndefined2.ts(23,27): error TS2304: Cannot find name 'Unresolved'. @@ -13,30 +13,30 @@ isolatedDeclarationsAddUndefined2.ts(23,27): error TS2304: Cannot find name 'Unr export class Bar { constructor(private x?: Array | undefined) {} ~~~~~ -!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). +!!! error TS2314: Generic type 'Array' requires 1 type argument(s). } export class Bar2 { constructor(private x?: Array) {} ~~~~~ -!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). +!!! error TS2314: Generic type 'Array' requires 1 type argument(s). } export class Bar3 { constructor(private x: Array | undefined) {} ~~~~~ -!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). +!!! error TS2314: Generic type 'Array' requires 1 type argument(s). } export class Bar4 { constructor(private x: Array) {} ~~~~~ -!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). +!!! error TS2314: Generic type 'Array' requires 1 type argument(s). } export function test1(x?: Array | undefined): void {} ~~~~~ -!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). +!!! error TS2314: Generic type 'Array' requires 1 type argument(s). export function test2(x?: Unresolved | undefined): void {} ~~~~~~~~~~ diff --git a/testdata/baselines/reference/submodule/compiler/isolatedDeclarationsAddUndefined2.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/isolatedDeclarationsAddUndefined2.errors.txt.diff deleted file mode 100644 index 9e6867ca3f..0000000000 --- a/testdata/baselines/reference/submodule/compiler/isolatedDeclarationsAddUndefined2.errors.txt.diff +++ /dev/null @@ -1,52 +0,0 @@ ---- old.isolatedDeclarationsAddUndefined2.errors.txt -+++ new.isolatedDeclarationsAddUndefined2.errors.txt -@@= skipped -0, +0 lines =@@ --isolatedDeclarationsAddUndefined2.ts(4,29): error TS2314: Generic type 'Array' requires 1 type argument(s). --isolatedDeclarationsAddUndefined2.ts(8,29): error TS2314: Generic type 'Array' requires 1 type argument(s). --isolatedDeclarationsAddUndefined2.ts(12,28): error TS2314: Generic type 'Array' requires 1 type argument(s). --isolatedDeclarationsAddUndefined2.ts(16,28): error TS2314: Generic type 'Array' requires 1 type argument(s). --isolatedDeclarationsAddUndefined2.ts(19,27): error TS2314: Generic type 'Array' requires 1 type argument(s). -+isolatedDeclarationsAddUndefined2.ts(4,29): error TS2314: Generic type 'T[]' requires 1 type argument(s). -+isolatedDeclarationsAddUndefined2.ts(8,29): error TS2314: Generic type 'T[]' requires 1 type argument(s). -+isolatedDeclarationsAddUndefined2.ts(12,28): error TS2314: Generic type 'T[]' requires 1 type argument(s). -+isolatedDeclarationsAddUndefined2.ts(16,28): error TS2314: Generic type 'T[]' requires 1 type argument(s). -+isolatedDeclarationsAddUndefined2.ts(19,27): error TS2314: Generic type 'T[]' requires 1 type argument(s). - isolatedDeclarationsAddUndefined2.ts(21,27): error TS2304: Cannot find name 'Unresolved'. - isolatedDeclarationsAddUndefined2.ts(23,27): error TS2304: Cannot find name 'Unresolved'. - -@@= skipped -12, +12 lines =@@ - export class Bar { - constructor(private x?: Array | undefined) {} - ~~~~~ --!!! error TS2314: Generic type 'Array' requires 1 type argument(s). -+!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). - } - - export class Bar2 { - constructor(private x?: Array) {} - ~~~~~ --!!! error TS2314: Generic type 'Array' requires 1 type argument(s). -+!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). - } - - export class Bar3 { - constructor(private x: Array | undefined) {} - ~~~~~ --!!! error TS2314: Generic type 'Array' requires 1 type argument(s). -+!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). - } - - export class Bar4 { - constructor(private x: Array) {} - ~~~~~ --!!! error TS2314: Generic type 'Array' requires 1 type argument(s). -+!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). - } - - export function test1(x?: Array | undefined): void {} - ~~~~~ --!!! error TS2314: Generic type 'Array' requires 1 type argument(s). -+!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). - - export function test2(x?: Unresolved | undefined): void {} - ~~~~~~~~~~ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsExtendsImplicitAny.errors.txt b/testdata/baselines/reference/submodule/compiler/jsExtendsImplicitAny.errors.txt index 007a80d169..82c630fced 100644 --- a/testdata/baselines/reference/submodule/compiler/jsExtendsImplicitAny.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/jsExtendsImplicitAny.errors.txt @@ -1,40 +1,25 @@ -/b.js(1,17): error TS2314: Generic type 'A' requires 1 type argument(s). -/b.js(2,5): error TS2351: This expression is not constructable. - Type 'typeof B' has no construct signatures. -/b.js(5,17): error TS2314: Generic type 'A' requires 1 type argument(s). -/b.js(6,5): error TS2351: This expression is not constructable. - Type 'typeof C' has no construct signatures. -/b.js(9,17): error TS2314: Generic type 'A' requires 1 type argument(s). -/b.js(10,5): error TS2351: This expression is not constructable. - Type 'typeof D' has no construct signatures. +/b.js(1,17): error TS8026: Expected A type arguments; provide these with an '@extends' tag. +/b.js(5,17): error TS8026: Expected A type arguments; provide these with an '@extends' tag. +/b.js(9,17): error TS8026: Expected A type arguments; provide these with an '@extends' tag. ==== /a.d.ts (0 errors) ==== declare class A { x: T; } -==== /b.js (6 errors) ==== +==== /b.js (3 errors) ==== class B extends A {} ~ -!!! error TS2314: Generic type 'A' requires 1 type argument(s). +!!! error TS8026: Expected A type arguments; provide these with an '@extends' tag. new B().x; - ~ -!!! error TS2351: This expression is not constructable. -!!! error TS2351: Type 'typeof B' has no construct signatures. /** @augments A */ class C extends A { } ~ -!!! error TS2314: Generic type 'A' requires 1 type argument(s). +!!! error TS8026: Expected A type arguments; provide these with an '@extends' tag. new C().x; - ~ -!!! error TS2351: This expression is not constructable. -!!! error TS2351: Type 'typeof C' has no construct signatures. /** @augments A */ class D extends A {} ~ -!!! error TS2314: Generic type 'A' requires 1 type argument(s). - new D().x; - ~ -!!! error TS2351: This expression is not constructable. -!!! error TS2351: Type 'typeof D' has no construct signatures. \ No newline at end of file +!!! error TS8026: Expected A type arguments; provide these with an '@extends' tag. + new D().x; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsExtendsImplicitAny.symbols b/testdata/baselines/reference/submodule/compiler/jsExtendsImplicitAny.symbols index 470f6add96..59d8f30088 100644 --- a/testdata/baselines/reference/submodule/compiler/jsExtendsImplicitAny.symbols +++ b/testdata/baselines/reference/submodule/compiler/jsExtendsImplicitAny.symbols @@ -13,7 +13,9 @@ class B extends A {} >A : Symbol(A, Decl(a.d.ts, 0, 0)) new B().x; +>new B().x : Symbol(x, Decl(a.d.ts, 0, 20)) >B : Symbol(B, Decl(b.js, 0, 0)) +>x : Symbol(x, Decl(a.d.ts, 0, 20)) /** @augments A */ class C extends A { } @@ -21,7 +23,9 @@ class C extends A { } >A : Symbol(A, Decl(a.d.ts, 0, 0)) new C().x; +>new C().x : Symbol(x, Decl(a.d.ts, 0, 20)) >C : Symbol(C, Decl(b.js, 1, 10)) +>x : Symbol(x, Decl(a.d.ts, 0, 20)) /** @augments A */ class D extends A {} @@ -29,5 +33,7 @@ class D extends A {} >A : Symbol(A, Decl(a.d.ts, 0, 0)) new D().x; +>new D().x : Symbol(x, Decl(a.d.ts, 0, 20)) >D : Symbol(D, Decl(b.js, 5, 10)) +>x : Symbol(x, Decl(a.d.ts, 0, 20)) diff --git a/testdata/baselines/reference/submodule/compiler/jsExtendsImplicitAny.symbols.diff b/testdata/baselines/reference/submodule/compiler/jsExtendsImplicitAny.symbols.diff index 04de30e167..724644b5cc 100644 --- a/testdata/baselines/reference/submodule/compiler/jsExtendsImplicitAny.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/jsExtendsImplicitAny.symbols.diff @@ -14,25 +14,31 @@ new B().x; ->new B().x : Symbol(A.x, Decl(a.d.ts, 0, 20)) ++>new B().x : Symbol(x, Decl(a.d.ts, 0, 20)) >B : Symbol(B, Decl(b.js, 0, 0)) ->x : Symbol(A.x, Decl(a.d.ts, 0, 20)) ++>x : Symbol(x, Decl(a.d.ts, 0, 20)) /** @augments A */ class C extends A { } -@@= skipped -10, +8 lines =@@ +@@= skipped -10, +10 lines =@@ >A : Symbol(A, Decl(a.d.ts, 0, 0)) new C().x; ->new C().x : Symbol(A.x, Decl(a.d.ts, 0, 20)) ++>new C().x : Symbol(x, Decl(a.d.ts, 0, 20)) >C : Symbol(C, Decl(b.js, 1, 10)) ->x : Symbol(A.x, Decl(a.d.ts, 0, 20)) ++>x : Symbol(x, Decl(a.d.ts, 0, 20)) /** @augments A */ class D extends A {} -@@= skipped -10, +8 lines =@@ +@@= skipped -10, +10 lines =@@ >A : Symbol(A, Decl(a.d.ts, 0, 0)) new D().x; ->new D().x : Symbol(A.x, Decl(a.d.ts, 0, 20)) ++>new D().x : Symbol(x, Decl(a.d.ts, 0, 20)) >D : Symbol(D, Decl(b.js, 5, 10)) ->x : Symbol(A.x, Decl(a.d.ts, 0, 20)) ++>x : Symbol(x, Decl(a.d.ts, 0, 20)) diff --git a/testdata/baselines/reference/submodule/compiler/jsExtendsImplicitAny.types b/testdata/baselines/reference/submodule/compiler/jsExtendsImplicitAny.types index 23a5f263aa..ac723afb64 100644 --- a/testdata/baselines/reference/submodule/compiler/jsExtendsImplicitAny.types +++ b/testdata/baselines/reference/submodule/compiler/jsExtendsImplicitAny.types @@ -8,33 +8,33 @@ declare class A { x: T; } === /b.js === class B extends A {} >B : B ->A : typeof A +>A : A new B().x; >new B().x : any ->new B() : any +>new B() : B >B : typeof B >x : any /** @augments A */ class C extends A { } >C : C ->A : typeof A +>A : A new C().x; >new C().x : any ->new C() : any +>new C() : C >C : typeof C >x : any /** @augments A */ class D extends A {} >D : D ->A : typeof A +>A : A new D().x; ->new D().x : any ->new D() : any +>new D().x : number +>new D() : D >D : typeof D ->x : any +>x : number diff --git a/testdata/baselines/reference/submodule/compiler/jsNoImplicitAnyNoCascadingReferenceErrors.errors.txt b/testdata/baselines/reference/submodule/compiler/jsNoImplicitAnyNoCascadingReferenceErrors.errors.txt index 18fc4377a8..6155497229 100644 --- a/testdata/baselines/reference/submodule/compiler/jsNoImplicitAnyNoCascadingReferenceErrors.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/jsNoImplicitAnyNoCascadingReferenceErrors.errors.txt @@ -1,22 +1,19 @@ -index.js(3,21): error TS2314: Generic type 'Foo' requires 1 type argument(s). -index.js(6,14): error TS2339: Property 'prop' does not exist on type 'MyFoo'. +index.js(3,21): error TS8026: Expected Foo type arguments; provide these with an '@extends' tag. ==== somelib.d.ts (0 errors) ==== export declare class Foo { prop: T; } -==== index.js (2 errors) ==== +==== index.js (1 errors) ==== import {Foo} from "./somelib"; class MyFoo extends Foo { ~~~ -!!! error TS2314: Generic type 'Foo' requires 1 type argument(s). +!!! error TS8026: Expected Foo type arguments; provide these with an '@extends' tag. constructor() { super(); this.prop.alpha = 12; - ~~~~ -!!! error TS2339: Property 'prop' does not exist on type 'MyFoo'. } } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsNoImplicitAnyNoCascadingReferenceErrors.symbols b/testdata/baselines/reference/submodule/compiler/jsNoImplicitAnyNoCascadingReferenceErrors.symbols index 6ea3d626c1..902b961207 100644 --- a/testdata/baselines/reference/submodule/compiler/jsNoImplicitAnyNoCascadingReferenceErrors.symbols +++ b/testdata/baselines/reference/submodule/compiler/jsNoImplicitAnyNoCascadingReferenceErrors.symbols @@ -19,8 +19,12 @@ class MyFoo extends Foo { constructor() { super(); +>super : Symbol(Foo, Decl(somelib.d.ts, 0, 0)) + this.prop.alpha = 12; +>this.prop : Symbol(prop, Decl(somelib.d.ts, 0, 29)) >this : Symbol(MyFoo, Decl(index.js, 0, 30)) +>prop : Symbol(prop, Decl(somelib.d.ts, 0, 29)) } } diff --git a/testdata/baselines/reference/submodule/compiler/jsNoImplicitAnyNoCascadingReferenceErrors.symbols.diff b/testdata/baselines/reference/submodule/compiler/jsNoImplicitAnyNoCascadingReferenceErrors.symbols.diff index fcba71344b..44d3aac34f 100644 --- a/testdata/baselines/reference/submodule/compiler/jsNoImplicitAnyNoCascadingReferenceErrors.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/jsNoImplicitAnyNoCascadingReferenceErrors.symbols.diff @@ -22,10 +22,13 @@ constructor() { super(); ->super : Symbol(Foo, Decl(somelib.d.ts, --, --)) -- ++>super : Symbol(Foo, Decl(somelib.d.ts, 0, 0)) + this.prop.alpha = 12; ->this.prop : Symbol(Foo.prop, Decl(somelib.d.ts, --, --)) ++>this.prop : Symbol(prop, Decl(somelib.d.ts, 0, 29)) >this : Symbol(MyFoo, Decl(index.js, 0, 30)) ->prop : Symbol(Foo.prop, Decl(somelib.d.ts, --, --)) ++>prop : Symbol(prop, Decl(somelib.d.ts, 0, 29)) } } diff --git a/testdata/baselines/reference/submodule/compiler/jsNoImplicitAnyNoCascadingReferenceErrors.types b/testdata/baselines/reference/submodule/compiler/jsNoImplicitAnyNoCascadingReferenceErrors.types index 817ef82f37..fa16f7a815 100644 --- a/testdata/baselines/reference/submodule/compiler/jsNoImplicitAnyNoCascadingReferenceErrors.types +++ b/testdata/baselines/reference/submodule/compiler/jsNoImplicitAnyNoCascadingReferenceErrors.types @@ -13,12 +13,12 @@ import {Foo} from "./somelib"; class MyFoo extends Foo { >MyFoo : MyFoo ->Foo : typeof Foo +>Foo : Foo constructor() { super(); >super() : void ->super : any +>super : typeof Foo this.prop.alpha = 12; >this.prop.alpha = 12 : 12 diff --git a/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseImplicitAny.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseImplicitAny.errors.txt index 1d9b3df6af..1cc294cbf3 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseImplicitAny.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseImplicitAny.errors.txt @@ -1,17 +1,9 @@ -jsdocArrayObjectPromiseImplicitAny.js(1,12): error TS2314: Generic type 'T[]' requires 1 type argument(s). -jsdocArrayObjectPromiseImplicitAny.js(8,12): error TS2314: Generic type 'T[]' requires 1 type argument(s). -jsdocArrayObjectPromiseImplicitAny.js(9,13): error TS2314: Generic type 'T[]' requires 1 type argument(s). -jsdocArrayObjectPromiseImplicitAny.js(15,12): error TS2314: Generic type 'Promise' requires 1 type argument(s). -jsdocArrayObjectPromiseImplicitAny.js(22,12): error TS2314: Generic type 'Promise' requires 1 type argument(s). -jsdocArrayObjectPromiseImplicitAny.js(23,13): error TS2314: Generic type 'Promise' requires 1 type argument(s). jsdocArrayObjectPromiseImplicitAny.js(30,18): error TS2322: Type 'number' is not assignable to type '() => Object'. jsdocArrayObjectPromiseImplicitAny.js(32,12): error TS2315: Type 'Object' is not generic. -==== jsdocArrayObjectPromiseImplicitAny.js (8 errors) ==== +==== jsdocArrayObjectPromiseImplicitAny.js (2 errors) ==== /** @type {Array} */ - ~~~~~ -!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). var anyArray = [5]; /** @type {Array} */ @@ -19,19 +11,13 @@ jsdocArrayObjectPromiseImplicitAny.js(32,12): error TS2315: Type 'Object' is not /** * @param {Array} arr - ~~~~~ -!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). * @return {Array} - ~~~~~ -!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). */ function returnAnyArray(arr) { return arr; } /** @type {Promise} */ - ~~~~~~~ -!!! error TS2314: Generic type 'Promise' requires 1 type argument(s). var anyPromise = Promise.resolve(5); /** @type {Promise} */ @@ -39,11 +25,7 @@ jsdocArrayObjectPromiseImplicitAny.js(32,12): error TS2315: Type 'Object' is not /** * @param {Promise} pr - ~~~~~~~ -!!! error TS2314: Generic type 'Promise' requires 1 type argument(s). * @return {Promise} - ~~~~~~~ -!!! error TS2314: Generic type 'Promise' requires 1 type argument(s). */ function returnAnyPromise(pr) { return pr; diff --git a/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseImplicitAny.types b/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseImplicitAny.types index bc48d858c0..24869748d5 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseImplicitAny.types +++ b/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseImplicitAny.types @@ -3,7 +3,7 @@ === jsdocArrayObjectPromiseImplicitAny.js === /** @type {Array} */ var anyArray = [5]; ->anyArray : any +>anyArray : any[] >[5] : number[] >5 : 5 @@ -18,16 +18,16 @@ var numberArray = [5]; * @return {Array} */ function returnAnyArray(arr) { ->returnAnyArray : (arr: any) => any ->arr : any +>returnAnyArray : (arr: any[]) => any[] +>arr : any[] return arr; ->arr : any +>arr : any[] } /** @type {Promise} */ var anyPromise = Promise.resolve(5); ->anyPromise : any +>anyPromise : Promise >Promise.resolve(5) : Promise >Promise.resolve : { (): Promise; (value: T): Promise>; (value: T | PromiseLike): Promise>; } >Promise : PromiseConstructor @@ -48,11 +48,11 @@ var numberPromise = Promise.resolve(5); * @return {Promise} */ function returnAnyPromise(pr) { ->returnAnyPromise : (pr: any) => any ->pr : any +>returnAnyPromise : (pr: Promise) => Promise +>pr : Promise return pr; ->pr : any +>pr : Promise } /** @type {Object} */ diff --git a/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseNoImplicitAny.errors.txt b/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseNoImplicitAny.errors.txt index c88b521e45..5940696a86 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseNoImplicitAny.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseNoImplicitAny.errors.txt @@ -1,6 +1,6 @@ -jsdocArrayObjectPromiseNoImplicitAny.js(1,12): error TS2314: Generic type 'T[]' requires 1 type argument(s). -jsdocArrayObjectPromiseNoImplicitAny.js(8,12): error TS2314: Generic type 'T[]' requires 1 type argument(s). -jsdocArrayObjectPromiseNoImplicitAny.js(9,13): error TS2314: Generic type 'T[]' requires 1 type argument(s). +jsdocArrayObjectPromiseNoImplicitAny.js(1,12): error TS2314: Generic type 'Array' requires 1 type argument(s). +jsdocArrayObjectPromiseNoImplicitAny.js(8,12): error TS2314: Generic type 'Array' requires 1 type argument(s). +jsdocArrayObjectPromiseNoImplicitAny.js(9,13): error TS2314: Generic type 'Array' requires 1 type argument(s). jsdocArrayObjectPromiseNoImplicitAny.js(15,12): error TS2314: Generic type 'Promise' requires 1 type argument(s). jsdocArrayObjectPromiseNoImplicitAny.js(22,12): error TS2314: Generic type 'Promise' requires 1 type argument(s). jsdocArrayObjectPromiseNoImplicitAny.js(23,13): error TS2314: Generic type 'Promise' requires 1 type argument(s). @@ -11,7 +11,7 @@ jsdocArrayObjectPromiseNoImplicitAny.js(32,12): error TS2315: Type 'Object' is n ==== jsdocArrayObjectPromiseNoImplicitAny.js (8 errors) ==== /** @type {Array} */ ~~~~~ -!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). +!!! error TS2314: Generic type 'Array' requires 1 type argument(s). var notAnyArray = [5]; /** @type {Array} */ @@ -20,10 +20,10 @@ jsdocArrayObjectPromiseNoImplicitAny.js(32,12): error TS2315: Type 'Object' is n /** * @param {Array} arr ~~~~~ -!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). +!!! error TS2314: Generic type 'Array' requires 1 type argument(s). * @return {Array} ~~~~~ -!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). +!!! error TS2314: Generic type 'Array' requires 1 type argument(s). */ function returnNotAnyArray(arr) { return arr; diff --git a/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseNoImplicitAny.types b/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseNoImplicitAny.types index 87eee09470..3b7748c4ba 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseNoImplicitAny.types +++ b/testdata/baselines/reference/submodule/compiler/jsdocArrayObjectPromiseNoImplicitAny.types @@ -3,7 +3,7 @@ === jsdocArrayObjectPromiseNoImplicitAny.js === /** @type {Array} */ var notAnyArray = [5]; ->notAnyArray : any +>notAnyArray : any[] >[5] : number[] >5 : 5 @@ -18,16 +18,16 @@ var numberArray = [5]; * @return {Array} */ function returnNotAnyArray(arr) { ->returnNotAnyArray : (arr: any) => any ->arr : any +>returnNotAnyArray : (arr: any[]) => any[] +>arr : any[] return arr; ->arr : any +>arr : any[] } /** @type {Promise} */ var notAnyPromise = Promise.resolve(5); ->notAnyPromise : any +>notAnyPromise : Promise >Promise.resolve(5) : Promise >Promise.resolve : { (): Promise; (value: T): Promise>; (value: T | PromiseLike): Promise>; } >Promise : PromiseConstructor @@ -48,11 +48,11 @@ var numberPromise = Promise.resolve(5); * @return {Promise} */ function returnNotAnyPromise(pr) { ->returnNotAnyPromise : (pr: any) => any ->pr : any +>returnNotAnyPromise : (pr: Promise) => Promise +>pr : Promise return pr; ->pr : any +>pr : Promise } /** @type {Object} */ diff --git a/testdata/baselines/reference/submodule/compiler/jsdocClassMissingTypeArguments.types b/testdata/baselines/reference/submodule/compiler/jsdocClassMissingTypeArguments.types index 4ea043d906..cf0f14ca4d 100644 --- a/testdata/baselines/reference/submodule/compiler/jsdocClassMissingTypeArguments.types +++ b/testdata/baselines/reference/submodule/compiler/jsdocClassMissingTypeArguments.types @@ -7,6 +7,6 @@ class C {} /** @param {C} p */ function f(p) {} ->f : (p: any) => void ->p : any +>f : (p: C) => void +>p : C diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingGenerics.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingGenerics.errors.txt deleted file mode 100644 index d4557d9119..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingGenerics.errors.txt +++ /dev/null @@ -1,17 +0,0 @@ -file.js(2,12): error TS2314: Generic type 'T[]' requires 1 type argument(s). -file.js(6,12): error TS2314: Generic type 'Promise' requires 1 type argument(s). - - -==== file.js (2 errors) ==== - /** - * @param {Array} x - ~~~~~ -!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). - */ - function x(x) {} - /** - * @param {Promise} x - ~~~~~~~ -!!! error TS2314: Generic type 'Promise' requires 1 type argument(s). - */ - function y(x) {} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingGenerics.js b/testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingGenerics.js index aeb030f791..2c0479618c 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingGenerics.js +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingGenerics.js @@ -30,3 +30,26 @@ declare function x(x: Array): void; * @param {Promise} x */ declare function y(x: Promise): void; + + +//// [DtsFileErrors] + + +out/file.d.ts(4,23): error TS2314: Generic type 'Array' requires 1 type argument(s). +out/file.d.ts(8,23): error TS2314: Generic type 'Promise' requires 1 type argument(s). + + +==== out/file.d.ts (2 errors) ==== + /** + * @param {Array} x + */ + declare function x(x: Array): void; + ~~~~~ +!!! error TS2314: Generic type 'Array' requires 1 type argument(s). + /** + * @param {Promise} x + */ + declare function y(x: Promise): void; + ~~~~~~~ +!!! error TS2314: Generic type 'Promise' requires 1 type argument(s). + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingGenerics.js.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingGenerics.js.diff index 3b0d2bc189..2b4a65312f 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingGenerics.js.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingGenerics.js.diff @@ -10,4 +10,27 @@ * @param {Promise} x */ -declare function y(x: Promise): void; -+declare function y(x: Promise): void; \ No newline at end of file ++declare function y(x: Promise): void; ++ ++ ++//// [DtsFileErrors] ++ ++ ++out/file.d.ts(4,23): error TS2314: Generic type 'Array' requires 1 type argument(s). ++out/file.d.ts(8,23): error TS2314: Generic type 'Promise' requires 1 type argument(s). ++ ++ ++==== out/file.d.ts (2 errors) ==== ++ /** ++ * @param {Array} x ++ */ ++ declare function x(x: Array): void; ++ ~~~~~ ++!!! error TS2314: Generic type 'Array' requires 1 type argument(s). ++ /** ++ * @param {Promise} x ++ */ ++ declare function y(x: Promise): void; ++ ~~~~~~~ ++!!! error TS2314: Generic type 'Promise' requires 1 type argument(s). ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingGenerics.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingGenerics.types index b4f32652c6..0adee3ad5e 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingGenerics.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingGenerics.types @@ -5,13 +5,13 @@ * @param {Array} x */ function x(x) {} ->x : (x: any) => void ->x : any +>x : (x: any[]) => void +>x : any[] /** * @param {Promise} x */ function y(x) {} ->y : (x: any) => void ->x : any +>y : (x: Promise) => void +>x : Promise diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingTypeParameters.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingTypeParameters.errors.txt index 809ccf10b2..7d37afc7c5 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingTypeParameters.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingTypeParameters.errors.txt @@ -1,15 +1,10 @@ -file.js(2,13): error TS2314: Generic type 'T[]' requires 1 type argument(s). -file.js(12,14): error TS2314: Generic type 'T[]' requires 1 type argument(s). file.js(12,19): error TS8020: JSDoc types can only be used inside documentation comments. file.js(12,20): error TS1099: Type argument list cannot be empty. -file.js(18,14): error TS2314: Generic type 'Promise' requires 1 type argument(s). -==== file.js (5 errors) ==== +==== file.js (2 errors) ==== /** * @param {Array=} y desc - ~~~~~ -!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). */ function x(y) { } @@ -20,8 +15,6 @@ file.js(18,14): error TS2314: Generic type 'Promise' requires 1 type argument /** * @return {(Array.<> | null)} list of devices - ~~~~~~~~ -!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). ~ !!! error TS8020: JSDoc types can only be used inside documentation comments. ~~ @@ -32,7 +25,5 @@ file.js(18,14): error TS2314: Generic type 'Promise' requires 1 type argument /** * * @return {?Promise} A promise - ~~~~~~~ -!!! error TS2314: Generic type 'Promise' requires 1 type argument(s). */ function w() { return null; } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingTypeParameters.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingTypeParameters.types index d93c648b87..c022df373c 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingTypeParameters.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsMissingTypeParameters.types @@ -5,8 +5,8 @@ * @param {Array=} y desc */ function x(y) { } ->x : (y?: any) => void ->y : any +>x : (y?: any[]) => void +>y : any[] // @ts-ignore /** @param {function (Array)} func Invoked @@ -19,12 +19,12 @@ function y(func) { return; } * @return {(Array.<> | null)} list of devices */ function z() { return null ;} ->z : () => any +>z : () => any[] /** * * @return {?Promise} A promise */ function w() { return null; } ->w : () => any +>w : () => Promise diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeTag.types b/testdata/baselines/reference/submodule/conformance/jsdocTypeTag.types index c9e5a39cda..5dcf391c3c 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeTag.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeTag.types @@ -59,7 +59,7 @@ var nl; /** @type {Array} */ var A; ->A : any +>A : any[] /** @type {array} */ var a; @@ -67,7 +67,7 @@ var a; /** @type {Promise} */ var P; ->P : any +>P : Promise /** @type {promise} */ var p; @@ -141,13 +141,13 @@ var nl: null; >nl : null var A: any[]; ->A : any +>A : any[] var a: any[]; >a : array var P: Promise; ->P : any +>P : Promise var p: Promise; >p : promise diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/defaultPropsEmptyCurlyBecomesAnyForJs.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/defaultPropsEmptyCurlyBecomesAnyForJs.errors.txt.diff deleted file mode 100644 index d8c6d3f9dd..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/defaultPropsEmptyCurlyBecomesAnyForJs.errors.txt.diff +++ /dev/null @@ -1,39 +0,0 @@ ---- old.defaultPropsEmptyCurlyBecomesAnyForJs.errors.txt -+++ new.defaultPropsEmptyCurlyBecomesAnyForJs.errors.txt -@@= skipped -0, +0 lines =@@ -- -+typed_component.ts(5,20): error TS2339: Property 'x' does not exist on type '{}'. -+typed_component.ts(6,20): error TS2339: Property 'y' does not exist on type '{}'. -+typed_component.ts(7,20): error TS2339: Property 'value' does not exist on type '{}'. -+ -+ -+==== library.d.ts (0 errors) ==== -+ export class Foo { -+ props: T; -+ state: U; -+ constructor(props: T, state: U); -+ } -+ -+==== component.js (0 errors) ==== -+ import { Foo } from "./library"; -+ export class MyFoo extends Foo { -+ member; -+ } -+ -+==== typed_component.ts (3 errors) ==== -+ import { MyFoo } from "./component"; -+ export class TypedFoo extends MyFoo { -+ constructor() { -+ super({x: "string", y: 42}, { value: undefined }); -+ this.props.x; -+ ~ -+!!! error TS2339: Property 'x' does not exist on type '{}'. -+ this.props.y; -+ ~ -+!!! error TS2339: Property 'y' does not exist on type '{}'. -+ this.state.value; -+ ~~~~~ -+!!! error TS2339: Property 'value' does not exist on type '{}'. -+ this.member; -+ } -+ } \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/defaultPropsEmptyCurlyBecomesAnyForJs.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/defaultPropsEmptyCurlyBecomesAnyForJs.types.diff deleted file mode 100644 index dae17ba508..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/defaultPropsEmptyCurlyBecomesAnyForJs.types.diff +++ /dev/null @@ -1,41 +0,0 @@ ---- old.defaultPropsEmptyCurlyBecomesAnyForJs.types -+++ new.defaultPropsEmptyCurlyBecomesAnyForJs.types -@@= skipped -20, +20 lines =@@ - - export class MyFoo extends Foo { - >MyFoo : MyFoo -->Foo : Foo -+>Foo : Foo<{}, {}> - - member; - >member : any -@@= skipped -29, +29 lines =@@ - - this.props.x; - >this.props.x : any -->this.props : any -+>this.props : {} - >this : this -->props : any -+>props : {} - >x : any - - this.props.y; - >this.props.y : any -->this.props : any -+>this.props : {} - >this : this -->props : any -+>props : {} - >y : any - - this.state.value; - >this.state.value : any -->this.state : any -+>this.state : {} - >this : this -->state : any -+>state : {} - >value : any - - this.member; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/fillInMissingTypeArgsOnJSConstructCalls.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/fillInMissingTypeArgsOnJSConstructCalls.errors.txt.diff index 6a23053aa3..4c2ce91c3f 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/fillInMissingTypeArgsOnJSConstructCalls.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/fillInMissingTypeArgsOnJSConstructCalls.errors.txt.diff @@ -8,11 +8,10 @@ BaseB.js(4,25): error TS2304: Cannot find name 'Class'. -BaseB.js(4,25): error TS8010: Type annotations can only be used in TypeScript files. -SubB.js(3,41): error TS8011: Type arguments can only be used in TypeScript files. -+SubB.js(3,35): error TS2314: Generic type 'B' requires 2 type argument(s). ==== BaseA.js (0 errors) ==== -@@= skipped -13, +10 lines =@@ +@@= skipped -13, +9 lines =@@ import BaseA from './BaseA'; export default class SubA extends BaseA { } @@ -37,14 +36,13 @@ this._AClass = AClass; } } -@@= skipped -24, +18 lines =@@ +-==== SubB.js (1 errors) ==== ++==== SubB.js (0 errors) ==== import SubA from './SubA'; import BaseB from './BaseB'; export default class SubB extends BaseB { - ~~~~ -!!! error TS8011: Type arguments can only be used in TypeScript files. -+ ~~~~~~~~~~~ -+!!! error TS2314: Generic type 'B' requires 2 type argument(s). constructor() { super(SubA); } \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/fillInMissingTypeArgsOnJSConstructCalls.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/fillInMissingTypeArgsOnJSConstructCalls.types.diff deleted file mode 100644 index ad86675bb1..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/fillInMissingTypeArgsOnJSConstructCalls.types.diff +++ /dev/null @@ -1,17 +0,0 @@ ---- old.fillInMissingTypeArgsOnJSConstructCalls.types -+++ new.fillInMissingTypeArgsOnJSConstructCalls.types -@@= skipped -41, +41 lines =@@ - - export default class SubB extends BaseB { - >SubB : SubB -->BaseB : BaseB -+>BaseB : typeof BaseB - - constructor() { - super(SubA); - >super(SubA) : void -->super : typeof BaseB -+>super : any - >SubA : typeof SubA - } - } \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/genericDefaultsJs.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/genericDefaultsJs.errors.txt.diff deleted file mode 100644 index 7eea9f8642..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/genericDefaultsJs.errors.txt.diff +++ /dev/null @@ -1,134 +0,0 @@ ---- old.genericDefaultsJs.errors.txt -+++ new.genericDefaultsJs.errors.txt -@@= skipped -0, +0 lines =@@ -- -+main.js(19,21): error TS2314: Generic type 'C0' requires 1 type argument(s). -+main.js(20,21): error TS2314: Generic type 'C0' requires 1 type argument(s). -+main.js(25,21): error TS2314: Generic type 'C0' requires 1 type argument(s). -+main.js(31,22): error TS2351: This expression is not constructable. -+ Type 'typeof C0_B0' has no construct signatures. -+main.js(34,22): error TS2351: This expression is not constructable. -+ Type 'typeof C0_B0' has no construct signatures. -+main.js(38,29): error TS2339: Property 'y' does not exist on type 'C0_B1'. -+main.js(41,29): error TS2339: Property 'y' does not exist on type 'C0_B2'. -+main.js(43,21): error TS2707: Generic type 'C1' requires between 1 and 2 type arguments. -+main.js(44,21): error TS2707: Generic type 'C1' requires between 1 and 2 type arguments. -+main.js(49,21): error TS2707: Generic type 'C1' requires between 1 and 2 type arguments. -+main.js(55,22): error TS2351: This expression is not constructable. -+ Type 'typeof C1_B0' has no construct signatures. -+main.js(58,22): error TS2351: This expression is not constructable. -+ Type 'typeof C1_B0' has no construct signatures. -+main.js(62,29): error TS2339: Property 'y' does not exist on type 'C1_B1'. -+main.js(65,29): error TS2339: Property 'y' does not exist on type 'C1_B2'. -+ -+ -+==== decls.d.ts (0 errors) ==== -+ declare function f0(x?: T): T; -+ declare function f1(x?: T): [T, U]; -+ declare class C0 { -+ y: T; -+ constructor(x?: T); -+ } -+ declare class C1 { -+ y: [T, U]; -+ constructor(x?: T); -+ } -+==== main.js (14 errors) ==== -+ const f0_v0 = f0(); -+ const f0_v1 = f0(1); -+ -+ const f1_c0 = f1(); -+ const f1_c1 = f1(1); -+ -+ const C0_v0 = new C0(); -+ const C0_v0_y = C0_v0.y; -+ -+ const C0_v1 = new C0(1); -+ const C0_v1_y = C0_v1.y; -+ -+ const C1_v0 = new C1(); -+ const C1_v0_y = C1_v0.y; -+ -+ const C1_v1 = new C1(1); -+ const C1_v1_y = C1_v1.y; -+ -+ class C0_B0 extends C0 {} -+ ~~ -+!!! error TS2314: Generic type 'C0' requires 1 type argument(s). -+ class C0_B1 extends C0 { -+ ~~ -+!!! error TS2314: Generic type 'C0' requires 1 type argument(s). -+ constructor() { -+ super(); -+ } -+ } -+ class C0_B2 extends C0 { -+ ~~ -+!!! error TS2314: Generic type 'C0' requires 1 type argument(s). -+ constructor() { -+ super(1); -+ } -+ } -+ -+ const C0_B0_v0 = new C0_B0(); -+ ~~~~~ -+!!! error TS2351: This expression is not constructable. -+!!! error TS2351: Type 'typeof C0_B0' has no construct signatures. -+ const C0_B0_v0_y = C0_B0_v0.y; -+ -+ const C0_B0_v1 = new C0_B0(1); -+ ~~~~~ -+!!! error TS2351: This expression is not constructable. -+!!! error TS2351: Type 'typeof C0_B0' has no construct signatures. -+ const C0_B0_v1_y = C0_B0_v1.y; -+ -+ const C0_B1_v0 = new C0_B1(); -+ const C0_B1_v0_y = C0_B1_v0.y; -+ ~ -+!!! error TS2339: Property 'y' does not exist on type 'C0_B1'. -+ -+ const C0_B2_v0 = new C0_B2(); -+ const C0_B2_v0_y = C0_B2_v0.y; -+ ~ -+!!! error TS2339: Property 'y' does not exist on type 'C0_B2'. -+ -+ class C1_B0 extends C1 {} -+ ~~ -+!!! error TS2707: Generic type 'C1' requires between 1 and 2 type arguments. -+ class C1_B1 extends C1 { -+ ~~ -+!!! error TS2707: Generic type 'C1' requires between 1 and 2 type arguments. -+ constructor() { -+ super(); -+ } -+ } -+ class C1_B2 extends C1 { -+ ~~ -+!!! error TS2707: Generic type 'C1' requires between 1 and 2 type arguments. -+ constructor() { -+ super(1); -+ } -+ } -+ -+ const C1_B0_v0 = new C1_B0(); -+ ~~~~~ -+!!! error TS2351: This expression is not constructable. -+!!! error TS2351: Type 'typeof C1_B0' has no construct signatures. -+ const C1_B0_v0_y = C1_B0_v0.y; -+ -+ const C1_B0_v1 = new C1_B0(1); -+ ~~~~~ -+!!! error TS2351: This expression is not constructable. -+!!! error TS2351: Type 'typeof C1_B0' has no construct signatures. -+ const C1_B0_v1_y = C1_B0_v1.y; -+ -+ const C1_B1_v0 = new C1_B1(); -+ const C1_B1_v0_y = C1_B1_v0.y; -+ ~ -+!!! error TS2339: Property 'y' does not exist on type 'C1_B1'. -+ -+ const C1_B2_v0 = new C1_B2(); -+ const C1_B2_v0_y = C1_B2_v0.y; -+ ~ -+!!! error TS2339: Property 'y' does not exist on type 'C1_B2'. -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/genericDefaultsJs.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/genericDefaultsJs.types.diff index 085fe4d76c..4f4ad24255 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/genericDefaultsJs.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/genericDefaultsJs.types.diff @@ -65,162 +65,4 @@ +>y : [unknown, number] const C1_v1 = new C1(1); - >C1_v1 : C1 -@@= skipped -24, +24 lines =@@ - - class C0_B0 extends C0 {} - >C0_B0 : C0_B0 -->C0 : C0 -+>C0 : typeof C0 - - class C0_B1 extends C0 { - >C0_B1 : C0_B1 -->C0 : C0 -+>C0 : typeof C0 - - constructor() { - super(); - >super() : void -->super : typeof C0 -+>super : any - } - } - class C0_B2 extends C0 { - >C0_B2 : C0_B2 -->C0 : C0 -+>C0 : typeof C0 - - constructor() { - super(1); - >super(1) : void -->super : typeof C0 -+>super : any - >1 : 1 - } - } - - const C0_B0_v0 = new C0_B0(); -->C0_B0_v0 : C0_B0 -->new C0_B0() : C0_B0 -+>C0_B0_v0 : any -+>new C0_B0() : any - >C0_B0 : typeof C0_B0 - - const C0_B0_v0_y = C0_B0_v0.y; - >C0_B0_v0_y : any - >C0_B0_v0.y : any -->C0_B0_v0 : C0_B0 -+>C0_B0_v0 : any - >y : any - - const C0_B0_v1 = new C0_B0(1); -->C0_B0_v1 : C0_B0 -->new C0_B0(1) : C0_B0 -+>C0_B0_v1 : any -+>new C0_B0(1) : any - >C0_B0 : typeof C0_B0 - >1 : 1 - - const C0_B0_v1_y = C0_B0_v1.y; - >C0_B0_v1_y : any - >C0_B0_v1.y : any -->C0_B0_v1 : C0_B0 -+>C0_B0_v1 : any - >y : any - - const C0_B1_v0 = new C0_B1(); -@@= skipped -71, +71 lines =@@ - - class C1_B0 extends C1 {} - >C1_B0 : C1_B0 -->C1 : C1 -+>C1 : typeof C1 - - class C1_B1 extends C1 { - >C1_B1 : C1_B1 -->C1 : C1 -+>C1 : typeof C1 - - constructor() { - super(); - >super() : void -->super : typeof C1 -+>super : any - } - } - class C1_B2 extends C1 { - >C1_B2 : C1_B2 -->C1 : C1 -+>C1 : typeof C1 - - constructor() { - super(1); - >super(1) : void -->super : typeof C1 -+>super : any - >1 : 1 - } - } - - const C1_B0_v0 = new C1_B0(); -->C1_B0_v0 : C1_B0 -->new C1_B0() : C1_B0 -+>C1_B0_v0 : any -+>new C1_B0() : any - >C1_B0 : typeof C1_B0 - - const C1_B0_v0_y = C1_B0_v0.y; -->C1_B0_v0_y : [any, number] -->C1_B0_v0.y : [any, number] -->C1_B0_v0 : C1_B0 -->y : [any, number] -+>C1_B0_v0_y : any -+>C1_B0_v0.y : any -+>C1_B0_v0 : any -+>y : any - - const C1_B0_v1 = new C1_B0(1); -->C1_B0_v1 : C1_B0 -->new C1_B0(1) : C1_B0 -+>C1_B0_v1 : any -+>new C1_B0(1) : any - >C1_B0 : typeof C1_B0 - >1 : 1 - - const C1_B0_v1_y = C1_B0_v1.y; -->C1_B0_v1_y : [any, number] -->C1_B0_v1.y : [any, number] -->C1_B0_v1 : C1_B0 -->y : [any, number] -+>C1_B0_v1_y : any -+>C1_B0_v1.y : any -+>C1_B0_v1 : any -+>y : any - - const C1_B1_v0 = new C1_B1(); - >C1_B1_v0 : C1_B1 -@@= skipped -53, +53 lines =@@ - >C1_B1 : typeof C1_B1 - - const C1_B1_v0_y = C1_B1_v0.y; -->C1_B1_v0_y : [any, number] -->C1_B1_v0.y : [any, number] -+>C1_B1_v0_y : any -+>C1_B1_v0.y : any - >C1_B1_v0 : C1_B1 -->y : [any, number] -+>y : any - - const C1_B2_v0 = new C1_B2(); - >C1_B2_v0 : C1_B2 -@@= skipped -11, +11 lines =@@ - >C1_B2 : typeof C1_B2 - - const C1_B2_v0_y = C1_B2_v0.y; -->C1_B2_v0_y : [any, number] -->C1_B2_v0.y : [any, number] -+>C1_B2_v0_y : any -+>C1_B2_v0.y : any - >C1_B2_v0 : C1_B2 -->y : [any, number] -+>y : any + >C1_v1 : C1 \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsExtendsImplicitAny.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsExtendsImplicitAny.errors.txt.diff index 6975e1fa0b..135c21c283 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsExtendsImplicitAny.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsExtendsImplicitAny.errors.txt.diff @@ -1,52 +1,29 @@ --- old.jsExtendsImplicitAny.errors.txt +++ new.jsExtendsImplicitAny.errors.txt @@= skipped -0, +0 lines =@@ --/b.js(1,17): error TS8026: Expected A type arguments; provide these with an '@extends' tag. + /b.js(1,17): error TS8026: Expected A type arguments; provide these with an '@extends' tag. -/b.js(4,15): error TS2314: Generic type 'A' requires 1 type argument(s). -/b.js(8,15): error TS2314: Generic type 'A' requires 1 type argument(s). -+/b.js(1,17): error TS2314: Generic type 'A' requires 1 type argument(s). -+/b.js(2,5): error TS2351: This expression is not constructable. -+ Type 'typeof B' has no construct signatures. -+/b.js(5,17): error TS2314: Generic type 'A' requires 1 type argument(s). -+/b.js(6,5): error TS2351: This expression is not constructable. -+ Type 'typeof C' has no construct signatures. -+/b.js(9,17): error TS2314: Generic type 'A' requires 1 type argument(s). -+/b.js(10,5): error TS2351: This expression is not constructable. -+ Type 'typeof D' has no construct signatures. ++/b.js(5,17): error TS8026: Expected A type arguments; provide these with an '@extends' tag. ++/b.js(9,17): error TS8026: Expected A type arguments; provide these with an '@extends' tag. ==== /a.d.ts (0 errors) ==== - declare class A { x: T; } - --==== /b.js (3 errors) ==== -+==== /b.js (6 errors) ==== - class B extends A {} - ~ --!!! error TS8026: Expected A type arguments; provide these with an '@extends' tag. -+!!! error TS2314: Generic type 'A' requires 1 type argument(s). +@@= skipped -12, +12 lines =@@ new B().x; -+ ~ -+!!! error TS2351: This expression is not constructable. -+!!! error TS2351: Type 'typeof B' has no construct signatures. /** @augments A */ - ~ -!!! error TS2314: Generic type 'A' requires 1 type argument(s). class C extends A { } + ~ -+!!! error TS2314: Generic type 'A' requires 1 type argument(s). ++!!! error TS8026: Expected A type arguments; provide these with an '@extends' tag. new C().x; -+ ~ -+!!! error TS2351: This expression is not constructable. -+!!! error TS2351: Type 'typeof C' has no construct signatures. /** @augments A */ - ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2314: Generic type 'A' requires 1 type argument(s). class D extends A {} + ~ -+!!! error TS2314: Generic type 'A' requires 1 type argument(s). - new D().x; -+ ~ -+!!! error TS2351: This expression is not constructable. -+!!! error TS2351: Type 'typeof D' has no construct signatures. \ No newline at end of file ++!!! error TS8026: Expected A type arguments; provide these with an '@extends' tag. + new D().x; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsExtendsImplicitAny.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsExtendsImplicitAny.types.diff deleted file mode 100644 index 8a27e72101..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsExtendsImplicitAny.types.diff +++ /dev/null @@ -1,43 +0,0 @@ ---- old.jsExtendsImplicitAny.types -+++ new.jsExtendsImplicitAny.types -@@= skipped -7, +7 lines =@@ - === /b.js === - class B extends A {} - >B : B -->A : A -+>A : typeof A - - new B().x; - >new B().x : any -->new B() : B -+>new B() : any - >B : typeof B - >x : any - - /** @augments A */ - class C extends A { } - >C : C -->A : A -+>A : typeof A - - new C().x; - >new C().x : any -->new C() : C -+>new C() : any - >C : typeof C - >x : any - - /** @augments A */ - class D extends A {} - >D : D -->A : A -+>A : typeof A - - new D().x; -->new D().x : number -->new D() : D -+>new D().x : any -+>new D() : any - >D : typeof D -->x : number -+>x : any diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsNoImplicitAnyNoCascadingReferenceErrors.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsNoImplicitAnyNoCascadingReferenceErrors.errors.txt.diff deleted file mode 100644 index 56419f2b29..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsNoImplicitAnyNoCascadingReferenceErrors.errors.txt.diff +++ /dev/null @@ -1,28 +0,0 @@ ---- old.jsNoImplicitAnyNoCascadingReferenceErrors.errors.txt -+++ new.jsNoImplicitAnyNoCascadingReferenceErrors.errors.txt -@@= skipped -0, +0 lines =@@ --index.js(3,21): error TS8026: Expected Foo type arguments; provide these with an '@extends' tag. -+index.js(3,21): error TS2314: Generic type 'Foo' requires 1 type argument(s). -+index.js(6,14): error TS2339: Property 'prop' does not exist on type 'MyFoo'. - - - ==== somelib.d.ts (0 errors) ==== - export declare class Foo { - prop: T; - } --==== index.js (1 errors) ==== -+==== index.js (2 errors) ==== - import {Foo} from "./somelib"; - - class MyFoo extends Foo { - ~~~ --!!! error TS8026: Expected Foo type arguments; provide these with an '@extends' tag. -+!!! error TS2314: Generic type 'Foo' requires 1 type argument(s). - constructor() { - super(); - this.prop.alpha = 12; -+ ~~~~ -+!!! error TS2339: Property 'prop' does not exist on type 'MyFoo'. - } - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsNoImplicitAnyNoCascadingReferenceErrors.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsNoImplicitAnyNoCascadingReferenceErrors.types.diff deleted file mode 100644 index f7a83e3722..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsNoImplicitAnyNoCascadingReferenceErrors.types.diff +++ /dev/null @@ -1,17 +0,0 @@ ---- old.jsNoImplicitAnyNoCascadingReferenceErrors.types -+++ new.jsNoImplicitAnyNoCascadingReferenceErrors.types -@@= skipped -12, +12 lines =@@ - - class MyFoo extends Foo { - >MyFoo : MyFoo -->Foo : Foo -+>Foo : typeof Foo - - constructor() { - super(); - >super() : void -->super : typeof Foo -+>super : any - - this.prop.alpha = 12; - >this.prop.alpha = 12 : 12 \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocArrayObjectPromiseImplicitAny.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocArrayObjectPromiseImplicitAny.errors.txt.diff index e75c771f81..7281d6f678 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocArrayObjectPromiseImplicitAny.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocArrayObjectPromiseImplicitAny.errors.txt.diff @@ -2,20 +2,12 @@ +++ new.jsdocArrayObjectPromiseImplicitAny.errors.txt @@= skipped -0, +0 lines =@@ - -+jsdocArrayObjectPromiseImplicitAny.js(1,12): error TS2314: Generic type 'T[]' requires 1 type argument(s). -+jsdocArrayObjectPromiseImplicitAny.js(8,12): error TS2314: Generic type 'T[]' requires 1 type argument(s). -+jsdocArrayObjectPromiseImplicitAny.js(9,13): error TS2314: Generic type 'T[]' requires 1 type argument(s). -+jsdocArrayObjectPromiseImplicitAny.js(15,12): error TS2314: Generic type 'Promise' requires 1 type argument(s). -+jsdocArrayObjectPromiseImplicitAny.js(22,12): error TS2314: Generic type 'Promise' requires 1 type argument(s). -+jsdocArrayObjectPromiseImplicitAny.js(23,13): error TS2314: Generic type 'Promise' requires 1 type argument(s). +jsdocArrayObjectPromiseImplicitAny.js(30,18): error TS2322: Type 'number' is not assignable to type '() => Object'. +jsdocArrayObjectPromiseImplicitAny.js(32,12): error TS2315: Type 'Object' is not generic. + + -+==== jsdocArrayObjectPromiseImplicitAny.js (8 errors) ==== ++==== jsdocArrayObjectPromiseImplicitAny.js (2 errors) ==== + /** @type {Array} */ -+ ~~~~~ -+!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). + var anyArray = [5]; + + /** @type {Array} */ @@ -23,19 +15,13 @@ + + /** + * @param {Array} arr -+ ~~~~~ -+!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). + * @return {Array} -+ ~~~~~ -+!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). + */ + function returnAnyArray(arr) { + return arr; + } + + /** @type {Promise} */ -+ ~~~~~~~ -+!!! error TS2314: Generic type 'Promise' requires 1 type argument(s). + var anyPromise = Promise.resolve(5); + + /** @type {Promise} */ @@ -43,11 +29,7 @@ + + /** + * @param {Promise} pr -+ ~~~~~~~ -+!!! error TS2314: Generic type 'Promise' requires 1 type argument(s). + * @return {Promise} -+ ~~~~~~~ -+!!! error TS2314: Generic type 'Promise' requires 1 type argument(s). + */ + function returnAnyPromise(pr) { + return pr; diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocArrayObjectPromiseImplicitAny.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocArrayObjectPromiseImplicitAny.types.diff index 9b61d7acfb..61a0878dd0 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocArrayObjectPromiseImplicitAny.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocArrayObjectPromiseImplicitAny.types.diff @@ -1,48 +1,6 @@ --- old.jsdocArrayObjectPromiseImplicitAny.types +++ new.jsdocArrayObjectPromiseImplicitAny.types -@@= skipped -2, +2 lines =@@ - === jsdocArrayObjectPromiseImplicitAny.js === - /** @type {Array} */ - var anyArray = [5]; -->anyArray : any[] -+>anyArray : any - >[5] : number[] - >5 : 5 - -@@= skipped -15, +15 lines =@@ - * @return {Array} - */ - function returnAnyArray(arr) { -->returnAnyArray : (arr: any[]) => any[] -->arr : any[] -+>returnAnyArray : (arr: any) => any -+>arr : any - - return arr; -->arr : any[] -+>arr : any - } - - /** @type {Promise} */ - var anyPromise = Promise.resolve(5); -->anyPromise : Promise -+>anyPromise : any - >Promise.resolve(5) : Promise - >Promise.resolve : { (): Promise; (value: T): Promise>; (value: T | PromiseLike): Promise>; } - >Promise : PromiseConstructor -@@= skipped -30, +30 lines =@@ - * @return {Promise} - */ - function returnAnyPromise(pr) { -->returnAnyPromise : (pr: Promise) => Promise -->pr : Promise -+>returnAnyPromise : (pr: any) => any -+>pr : any - - return pr; -->pr : Promise -+>pr : any - } +@@= skipped -56, +56 lines =@@ /** @type {Object} */ var anyObject = {valueOf: 1}; // not an error since assigning to any. @@ -59,7 +17,7 @@ >{valueOf: 1} : { valueOf: number; } >valueOf : number >1 : 1 -@@= skipped -26, +26 lines =@@ +@@= skipped -17, +17 lines =@@ * @return {Object} */ function returnAnyObject(obj) { diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocArrayObjectPromiseNoImplicitAny.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocArrayObjectPromiseNoImplicitAny.errors.txt.diff index 149e0933f7..9f407cd4d4 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocArrayObjectPromiseNoImplicitAny.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocArrayObjectPromiseNoImplicitAny.errors.txt.diff @@ -1,13 +1,6 @@ --- old.jsdocArrayObjectPromiseNoImplicitAny.errors.txt +++ new.jsdocArrayObjectPromiseNoImplicitAny.errors.txt -@@= skipped -0, +0 lines =@@ --jsdocArrayObjectPromiseNoImplicitAny.js(1,12): error TS2314: Generic type 'Array' requires 1 type argument(s). --jsdocArrayObjectPromiseNoImplicitAny.js(8,12): error TS2314: Generic type 'Array' requires 1 type argument(s). --jsdocArrayObjectPromiseNoImplicitAny.js(9,13): error TS2314: Generic type 'Array' requires 1 type argument(s). -+jsdocArrayObjectPromiseNoImplicitAny.js(1,12): error TS2314: Generic type 'T[]' requires 1 type argument(s). -+jsdocArrayObjectPromiseNoImplicitAny.js(8,12): error TS2314: Generic type 'T[]' requires 1 type argument(s). -+jsdocArrayObjectPromiseNoImplicitAny.js(9,13): error TS2314: Generic type 'T[]' requires 1 type argument(s). - jsdocArrayObjectPromiseNoImplicitAny.js(15,12): error TS2314: Generic type 'Promise' requires 1 type argument(s). +@@= skipped -4, +4 lines =@@ jsdocArrayObjectPromiseNoImplicitAny.js(22,12): error TS2314: Generic type 'Promise' requires 1 type argument(s). jsdocArrayObjectPromiseNoImplicitAny.js(23,13): error TS2314: Generic type 'Promise' requires 1 type argument(s). jsdocArrayObjectPromiseNoImplicitAny.js(30,21): error TS2322: Type 'number' is not assignable to type '() => Object'. @@ -20,25 +13,8 @@ +==== jsdocArrayObjectPromiseNoImplicitAny.js (8 errors) ==== /** @type {Array} */ ~~~~~ --!!! error TS2314: Generic type 'Array' requires 1 type argument(s). -+!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). - var notAnyArray = [5]; - - /** @type {Array} */ -@@= skipped -18, +19 lines =@@ - /** - * @param {Array} arr - ~~~~~ --!!! error TS2314: Generic type 'Array' requires 1 type argument(s). -+!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). - * @return {Array} - ~~~~~ --!!! error TS2314: Generic type 'Array' requires 1 type argument(s). -+!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). - */ - function returnNotAnyArray(arr) { - return arr; -@@= skipped -35, +35 lines =@@ + !!! error TS2314: Generic type 'Array' requires 1 type argument(s). +@@= skipped -49, +50 lines =@@ !!! error TS2322: Type 'number' is not assignable to type '() => Object'. /** @type {Object} */ diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocArrayObjectPromiseNoImplicitAny.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocArrayObjectPromiseNoImplicitAny.types.diff index 1f7d46a62b..07347fb1e0 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocArrayObjectPromiseNoImplicitAny.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocArrayObjectPromiseNoImplicitAny.types.diff @@ -1,51 +1,6 @@ --- old.jsdocArrayObjectPromiseNoImplicitAny.types +++ new.jsdocArrayObjectPromiseNoImplicitAny.types -@@= skipped -2, +2 lines =@@ - === jsdocArrayObjectPromiseNoImplicitAny.js === - /** @type {Array} */ - var notAnyArray = [5]; -->notAnyArray : any[] -+>notAnyArray : any - >[5] : number[] - >5 : 5 - -@@= skipped -15, +15 lines =@@ - * @return {Array} - */ - function returnNotAnyArray(arr) { -->returnNotAnyArray : (arr: any[]) => any[] -->arr : any[] -+>returnNotAnyArray : (arr: any) => any -+>arr : any - - return arr; -->arr : any[] -+>arr : any - } - - /** @type {Promise} */ - var notAnyPromise = Promise.resolve(5); -->notAnyPromise : Promise -+>notAnyPromise : any - >Promise.resolve(5) : Promise - >Promise.resolve : { (): Promise; (value: T): Promise>; (value: T | PromiseLike): Promise>; } - >Promise : PromiseConstructor -@@= skipped -30, +30 lines =@@ - * @return {Promise} - */ - function returnNotAnyPromise(pr) { -->returnNotAnyPromise : (pr: Promise) => Promise -->pr : Promise -+>returnNotAnyPromise : (pr: any) => any -+>pr : any - - return pr; -->pr : Promise -+>pr : any - } - - /** @type {Object} */ -@@= skipped -16, +16 lines =@@ +@@= skipped -63, +63 lines =@@ /** @type {Object} */ var paramedObject = {valueOf: 1}; diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocClassMissingTypeArguments.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsdocClassMissingTypeArguments.types.diff deleted file mode 100644 index 3039241e4f..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsdocClassMissingTypeArguments.types.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.jsdocClassMissingTypeArguments.types -+++ new.jsdocClassMissingTypeArguments.types -@@= skipped -6, +6 lines =@@ - - /** @param {C} p */ - function f(p) {} -->f : (p: C) => void -->p : C -+>f : (p: any) => void -+>p : any diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsMissingGenerics.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsMissingGenerics.errors.txt.diff deleted file mode 100644 index f8159ea052..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsMissingGenerics.errors.txt.diff +++ /dev/null @@ -1,21 +0,0 @@ ---- old.jsDeclarationsMissingGenerics.errors.txt -+++ new.jsDeclarationsMissingGenerics.errors.txt -@@= skipped -0, +0 lines =@@ -- -+file.js(2,12): error TS2314: Generic type 'T[]' requires 1 type argument(s). -+file.js(6,12): error TS2314: Generic type 'Promise' requires 1 type argument(s). -+ -+ -+==== file.js (2 errors) ==== -+ /** -+ * @param {Array} x -+ ~~~~~ -+!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). -+ */ -+ function x(x) {} -+ /** -+ * @param {Promise} x -+ ~~~~~~~ -+!!! error TS2314: Generic type 'Promise' requires 1 type argument(s). -+ */ -+ function y(x) {} \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsMissingGenerics.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsMissingGenerics.types.diff deleted file mode 100644 index c4e8c50835..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsMissingGenerics.types.diff +++ /dev/null @@ -1,19 +0,0 @@ ---- old.jsDeclarationsMissingGenerics.types -+++ new.jsDeclarationsMissingGenerics.types -@@= skipped -4, +4 lines =@@ - * @param {Array} x - */ - function x(x) {} -->x : (x: any[]) => void -->x : any[] -+>x : (x: any) => void -+>x : any - - /** - * @param {Promise} x - */ - function y(x) {} -->y : (x: Promise) => void -->x : Promise -+>y : (x: any) => void -+>x : any diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsMissingTypeParameters.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsMissingTypeParameters.errors.txt.diff index b081b71e16..4740647901 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsMissingTypeParameters.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsMissingTypeParameters.errors.txt.diff @@ -2,18 +2,13 @@ +++ new.jsDeclarationsMissingTypeParameters.errors.txt @@= skipped -0, +0 lines =@@ - -+file.js(2,13): error TS2314: Generic type 'T[]' requires 1 type argument(s). -+file.js(12,14): error TS2314: Generic type 'T[]' requires 1 type argument(s). +file.js(12,19): error TS8020: JSDoc types can only be used inside documentation comments. +file.js(12,20): error TS1099: Type argument list cannot be empty. -+file.js(18,14): error TS2314: Generic type 'Promise' requires 1 type argument(s). + + -+==== file.js (5 errors) ==== ++==== file.js (2 errors) ==== + /** + * @param {Array=} y desc -+ ~~~~~ -+!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). + */ + function x(y) { } + @@ -24,8 +19,6 @@ + + /** + * @return {(Array.<> | null)} list of devices -+ ~~~~~~~~ -+!!! error TS2314: Generic type 'T[]' requires 1 type argument(s). + ~ +!!! error TS8020: JSDoc types can only be used inside documentation comments. + ~~ @@ -36,7 +29,5 @@ + /** + * + * @return {?Promise} A promise -+ ~~~~~~~ -+!!! error TS2314: Generic type 'Promise' requires 1 type argument(s). + */ + function w() { return null; } \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsMissingTypeParameters.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsMissingTypeParameters.types.diff index c58adf65b8..a8c8c0343f 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsMissingTypeParameters.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsMissingTypeParameters.types.diff @@ -5,9 +5,8 @@ */ function x(y) { } ->x : (y?: any[] | undefined) => void -->y : any[] -+>x : (y?: any) => void -+>y : any ++>x : (y?: any[]) => void + >y : any[] // @ts-ignore /** @param {function (Array)} func Invoked @@ -23,7 +22,7 @@ */ function z() { return null ;} ->z : () => (any[] | null) -+>z : () => any ++>z : () => any[] /** * @@ -31,4 +30,4 @@ */ function w() { return null; } ->w : () => Promise | null -+>w : () => any ++>w : () => Promise diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTag.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTag.types.diff index 7a983bddd9..f40bf0bc34 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTag.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeTag.types.diff @@ -63,12 +63,7 @@ /** @type {null} */ var nl; -@@= skipped -8, +8 lines =@@ - - /** @type {Array} */ - var A; -->A : any[] -+>A : any +@@= skipped -12, +12 lines =@@ /** @type {array} */ var a; @@ -77,8 +72,7 @@ /** @type {Promise} */ var P; -->P : Promise -+>P : any +@@= skipped -8, +8 lines =@@ /** @type {promise} */ var p; @@ -87,7 +81,7 @@ /** @type {?number} */ var nullable; -@@= skipped -20, +20 lines =@@ +@@= skipped -8, +8 lines =@@ /** @type {Object} */ var Obj; @@ -152,18 +146,15 @@ var nl: null; >nl : null - - var A: any[]; -->A : any[] -+>A : any +@@= skipped -45, +45 lines =@@ + >A : any[] var a: any[]; ->a : any[] +>a : array var P: Promise; -->P : Promise -+>P : any + >P : Promise var p: Promise; ->p : Promise diff --git a/testdata/tests/cases/compiler/superCallInJSWithWrongBaseTypeArgumentCount1.ts b/testdata/tests/cases/compiler/superCallInJSWithWrongBaseTypeArgumentCount1.ts new file mode 100644 index 0000000000..04a6e257fe --- /dev/null +++ b/testdata/tests/cases/compiler/superCallInJSWithWrongBaseTypeArgumentCount1.ts @@ -0,0 +1,28 @@ +// @module: nodenext +// @checkJs: true +// @declaration: true +// @strict: true, false + +// @filename: a.ts +export class A {} + +// @filename: b.js +import { A } from './a.js'; + +export class B1 extends A { + constructor() { + super(); + } +} + +export class B2 extends A { + constructor() { + super(); + } +} + +export class B3 extends A { + constructor() { + super(); + } +} \ No newline at end of file diff --git a/testdata/tests/cases/compiler/superCallInJSWithWrongBaseTypeArgumentCount2.ts b/testdata/tests/cases/compiler/superCallInJSWithWrongBaseTypeArgumentCount2.ts new file mode 100644 index 0000000000..78cc64b180 --- /dev/null +++ b/testdata/tests/cases/compiler/superCallInJSWithWrongBaseTypeArgumentCount2.ts @@ -0,0 +1,31 @@ +// @module: nodenext +// @checkJs: true +// @declaration: true +// @strict: true, false + +// @filename: a.ts +export class A {} + +// @filename: b.js +import { A } from './a.js'; + +/** @extends {A} */ +export class B1 extends A { + constructor() { + super(); + } +} + +/** @extends {A} */ +export class B2 extends A { + constructor() { + super(); + } +} + +/** @extends {A} */ +export class B3 extends A { + constructor() { + super(); + } +} \ No newline at end of file