diff --git a/internal/parser/reparser.go b/internal/parser/reparser.go index 2cc6973abb..d2a8ccc812 100644 --- a/internal/parser/reparser.go +++ b/internal/parser/reparser.go @@ -271,7 +271,55 @@ func (p *Parser) reparseHosted(tag *ast.Node, parent *ast.Node, jsDoc *ast.Node) fun.FunctionLikeData().Type = p.makeNewType(tag.AsJSDocReturnTag().TypeExpression, fun) } } + case ast.KindJSDocImplementsTag: + if class := getClassLikeData(parent); class != nil { + implementsTag := tag.AsJSDocImplementsTag() + + if class.HeritageClauses != nil { + if implementsClause := core.Find(class.HeritageClauses.Nodes, func(node *ast.Node) bool { + return node.AsHeritageClause().Token == ast.KindImplementsKeyword + }); implementsClause != nil { + implementsClause.AsHeritageClause().Types.Nodes = append(implementsClause.AsHeritageClause().Types.Nodes, implementsTag.ClassName) + return + } + } + types := p.nodeSlicePool.NewSlice(1) + types[0] = implementsTag.ClassName + implementsTag.ClassName.Flags |= ast.NodeFlagsReparsed + typesList := p.newNodeList(implementsTag.ClassName.Loc, types) + + heritageClause := p.factory.NewHeritageClause(ast.KindImplementsKeyword, typesList) + heritageClause.Loc = implementsTag.ClassName.Loc + heritageClause.Flags = p.contextFlags | ast.NodeFlagsReparsed + + if class.HeritageClauses == nil { + heritageClauses := p.newNodeList(implementsTag.ClassName.Loc, p.nodeSlicePool.NewSlice(1)) + heritageClauses.Nodes[0] = heritageClause + class.HeritageClauses = heritageClauses + } else { + class.HeritageClauses.Nodes = append(class.HeritageClauses.Nodes, heritageClause) + } + } + case ast.KindJSDocAugmentsTag: + if class := getClassLikeData(parent); class != nil && class.HeritageClauses != nil { + if extendsClause := core.Find(class.HeritageClauses.Nodes, func(node *ast.Node) bool { + return node.AsHeritageClause().Token == ast.KindExtendsKeyword + }); extendsClause != nil && len(extendsClause.AsHeritageClause().Types.Nodes) == 1 { + target := extendsClause.AsHeritageClause().Types.Nodes[0].AsExpressionWithTypeArguments() + source := tag.AsJSDocAugmentsTag().ClassName.AsExpressionWithTypeArguments() + if hasSamePropertyAccessName(target.Expression, source.Expression) { + if target.TypeArguments == nil && source.TypeArguments != nil { + target.TypeArguments = source.TypeArguments + for _, typeArg := range source.TypeArguments.Nodes { + typeArg.Flags |= ast.NodeFlagsReparsed + } + } + return + } + } + } } + // !!! other attached tags (@this, @satisfies) support goes here } func (p *Parser) makeQuestionIfOptional(parameter *ast.JSDocParameterTag) *ast.Node { @@ -338,3 +386,23 @@ func (p *Parser) makeNewType(typeExpression *ast.TypeNode, host *ast.Node) *ast. t.Flags |= ast.NodeFlagsReparsed return t } + +func hasSamePropertyAccessName(node1, node2 *ast.Node) bool { + if node1.Kind == ast.KindIdentifier && node2.Kind == ast.KindIdentifier { + return node1.Text() == node2.Text() + } else if node1.Kind == ast.KindPropertyAccessExpression && node2.Kind == ast.KindPropertyAccessExpression { + return node1.AsPropertyAccessExpression().Name().Text() == node2.AsPropertyAccessExpression().Name().Text() && + hasSamePropertyAccessName(node1.AsPropertyAccessExpression().Expression, node2.AsPropertyAccessExpression().Expression) + } + return false +} + +func getClassLikeData(parent *ast.Node) *ast.ClassLikeBase { + var class *ast.ClassLikeBase + if parent.Kind == ast.KindClassDeclaration { + class = parent.AsClassDeclaration().ClassLikeData() + } else if parent.Kind == ast.KindClassExpression { + class = parent.AsClassExpression().ClassLikeData() + } + return class +} diff --git a/testdata/baselines/reference/submodule/conformance/extendsTag1.types b/testdata/baselines/reference/submodule/conformance/extendsTag1.types index 1fe7b48839..d897271871 100644 --- a/testdata/baselines/reference/submodule/conformance/extendsTag1.types +++ b/testdata/baselines/reference/submodule/conformance/extendsTag1.types @@ -7,5 +7,5 @@ */ class My extends Set {} >My : My ->Set : Set +>Set : Set diff --git a/testdata/baselines/reference/submodule/conformance/extendsTag5.errors.txt b/testdata/baselines/reference/submodule/conformance/extendsTag5.errors.txt index 8e78b2b91f..c513efe5ed 100644 --- a/testdata/baselines/reference/submodule/conformance/extendsTag5.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/extendsTag5.errors.txt @@ -1,10 +1,12 @@ -/a.js(26,17): error TS2314: Generic type 'A' requires 1 type argument(s). -/a.js(34,17): error TS2314: Generic type 'A' requires 1 type argument(s). -/a.js(39,17): error TS2314: Generic type 'A' requires 1 type argument(s). -/a.js(44,17): error TS2314: Generic type 'A' requires 1 type argument(s). +/a.js(29,16): error TS2344: Type '{ a: string; b: string; }' does not satisfy the constraint '{ a: string | number; b: boolean | string[]; }'. + Types of property 'b' are incompatible. + Type 'string' is not assignable to type 'boolean | string[]'. +/a.js(42,16): error TS2344: Type '{ a: string; b: string; }' does not satisfy the constraint '{ a: string | number; b: boolean | string[]; }'. + Types of property 'b' are incompatible. + Type 'string' is not assignable to type 'boolean | string[]'. -==== /a.js (4 errors) ==== +==== /a.js (2 errors) ==== /** * @typedef {{ * a: number | string; @@ -31,30 +33,33 @@ * }>} */ class B extends A {} - ~ -!!! error TS2314: Generic type 'A' requires 1 type argument(s). /** * @extends {A<{ + ~ * a: string, + ~~~~~~~~~~~~~~~~~ * b: string + ~~~~~~~~~~~~~~~~ * }>} + ~~~~ +!!! error TS2344: Type '{ a: string; b: string; }' does not satisfy the constraint '{ a: string | number; b: boolean | string[]; }'. +!!! error TS2344: Types of property 'b' are incompatible. +!!! error TS2344: Type 'string' is not assignable to type 'boolean | string[]'. */ class C extends A {} - ~ -!!! error TS2314: Generic type 'A' requires 1 type argument(s). /** * @extends {A<{a: string, b: string[]}>} */ class D extends A {} - ~ -!!! error TS2314: Generic type 'A' requires 1 type argument(s). /** * @extends {A<{a: string, b: string}>} + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2344: Type '{ a: string; b: string; }' does not satisfy the constraint '{ a: string | number; b: boolean | string[]; }'. +!!! error TS2344: Types of property 'b' are incompatible. +!!! error TS2344: Type 'string' is not assignable to type 'boolean | string[]'. */ class E extends A {} - ~ -!!! error TS2314: Generic type 'A' requires 1 type argument(s). \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/extendsTag5.types b/testdata/baselines/reference/submodule/conformance/extendsTag5.types index ac03511a17..4dd2595d24 100644 --- a/testdata/baselines/reference/submodule/conformance/extendsTag5.types +++ b/testdata/baselines/reference/submodule/conformance/extendsTag5.types @@ -33,7 +33,7 @@ class A { */ class B extends A {} >B : B ->A : typeof A +>A : A<{ a: string; b: string[]; }> /** * @extends {A<{ @@ -43,19 +43,19 @@ class B extends A {} */ class C extends A {} >C : C ->A : typeof A +>A : A<{ a: string; b: string; }> /** * @extends {A<{a: string, b: string[]}>} */ class D extends A {} >D : D ->A : typeof A +>A : A<{ a: string; b: string[]; }> /** * @extends {A<{a: string, b: string}>} */ class E extends A {} >E : E ->A : typeof A +>A : A<{ a: string; b: string; }> diff --git a/testdata/baselines/reference/submodule/conformance/importTag23.errors.txt b/testdata/baselines/reference/submodule/conformance/importTag23.errors.txt new file mode 100644 index 0000000000..bb525a810c --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/importTag23.errors.txt @@ -0,0 +1,25 @@ +/b.js(5,18): error TS1361: 'NS' cannot be used as a value because it was imported using 'import type'. +/b.js(6,14): error TS2420: Class 'C' incorrectly implements interface 'I'. + Property 'foo' is missing in type 'C' but required in type 'I'. + + +==== /a.ts (0 errors) ==== + export interface I { + foo(): void; + } + +==== /b.js (2 errors) ==== + /** + * @import * as NS from './a' + */ + + /** @implements {NS.I} */ + ~~ +!!! error TS1361: 'NS' cannot be used as a value because it was imported using 'import type'. +!!! related TS1376 /b.js:2:17: 'NS' was imported here. + export class C {} + ~ +!!! error TS2420: Class 'C' incorrectly implements interface 'I'. +!!! error TS2420: Property 'foo' is missing in type 'C' but required in type 'I'. +!!! related TS2728 /a.ts:2:5: 'foo' is declared here. + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassImplementsGenericsSerialization.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassImplementsGenericsSerialization.errors.txt new file mode 100644 index 0000000000..bdc889fdf9 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassImplementsGenericsSerialization.errors.txt @@ -0,0 +1,29 @@ +lib.js(3,17): error TS2552: Cannot find name 'IEncoder'. Did you mean 'Encoder'? + + +==== interface.ts (0 errors) ==== + export interface Encoder { + encode(value: T): Uint8Array + } +==== lib.js (1 errors) ==== + /** + * @template T + * @implements {IEncoder} + ~~~~~~~~ +!!! error TS2552: Cannot find name 'IEncoder'. Did you mean 'Encoder'? +!!! related TS2728 lib.js:5:14: 'Encoder' is declared here. + */ + export class Encoder { + /** + * @param {T} value + */ + encode(value) { + return new Uint8Array(0) + } + } + + + /** + * @template T + * @typedef {import('./interface').Encoder} IEncoder + */ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClasses.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClasses.errors.txt deleted file mode 100644 index e16dd6d33a..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClasses.errors.txt +++ /dev/null @@ -1,200 +0,0 @@ -index.js(173,24): error TS2314: Generic type 'N' requires 1 type argument(s). - - -==== index.js (1 errors) ==== - export class A {} - - export class B { - static cat = "cat"; - } - - export class C { - static Cls = class {} - } - - export class D { - /** - * @param {number} a - * @param {number} b - */ - constructor(a, b) {} - } - - /** - * @template T,U - */ - export class E { - /** - * @type {T & U} - */ - field; - - // @readonly is currently unsupported, it seems - included here just in case that changes - /** - * @type {T & U} - * @readonly - */ - readonlyField; - - initializedField = 12; - - /** - * @return {U} - */ - get f1() { return /** @type {*} */(null); } - - /** - * @param {U} _p - */ - set f1(_p) {} - - /** - * @return {U} - */ - get f2() { return /** @type {*} */(null); } - - /** - * @param {U} _p - */ - set f3(_p) {} - - /** - * @param {T} a - * @param {U} b - */ - constructor(a, b) {} - - - /** - * @type {string} - */ - static staticField; - - // @readonly is currently unsupported, it seems - included here just in case that changes - /** - * @type {string} - * @readonly - */ - static staticReadonlyField; - - static staticInitializedField = 12; - - /** - * @return {string} - */ - static get s1() { return ""; } - - /** - * @param {string} _p - */ - static set s1(_p) {} - - /** - * @return {string} - */ - static get s2() { return ""; } - - /** - * @param {string} _p - */ - static set s3(_p) {} - } - - /** - * @template T,U - */ - export class F { - /** - * @type {T & U} - */ - field; - /** - * @param {T} a - * @param {U} b - */ - constructor(a, b) {} - - /** - * @template A,B - * @param {A} a - * @param {B} b - */ - static create(a, b) { return new F(a, b); } - } - - class G {} - - export { G }; - - class HH {} - - export { HH as H }; - - export class I {} - export { I as II }; - - export { J as JJ }; - export class J {} - - - export class K { - constructor() { - this.p1 = 12; - this.p2 = "ok"; - } - - method() { - return this.p1; - } - } - - export class L extends K {} - - export class M extends null { - constructor() { - this.prop = 12; - } - } - - - /** - * @template T - */ - export class N extends L { - /** - * @param {T} param - */ - constructor(param) { - super(); - this.another = param; - } - } - - /** - * @template U - * @extends {N} - */ - export class O extends N { - ~ -!!! error TS2314: Generic type 'N' requires 1 type argument(s). - /** - * @param {U} param - */ - constructor(param) { - super(param); - this.another2 = param; - } - } - - var x = /** @type {*} */(null); - - export class VariableBase extends x {} - - export class HasStatics { - static staticMethod() {} - } - - export class ExtendsStatics extends HasStatics { - static also() {} - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClasses.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClasses.symbols index 124066f56a..0604162db1 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClasses.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClasses.symbols @@ -274,6 +274,7 @@ export class O extends N { >param : Symbol(param, Decl(index.js, 176, 16)) super(param); +>super : Symbol(N, Decl(index.js, 152, 1)) >param : Symbol(param, Decl(index.js, 176, 16)) this.another2 = param; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClasses.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClasses.symbols.diff index 1280b00e2f..a64fae6b17 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClasses.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClasses.symbols.diff @@ -192,11 +192,7 @@ >param : Symbol(param, Decl(index.js, 162, 16)) } } -@@= skipped -22, +22 lines =@@ - >param : Symbol(param, Decl(index.js, 176, 16)) - - super(param); -->super : Symbol(N, Decl(index.js, 152, 1)) +@@= skipped -26, +26 lines =@@ >param : Symbol(param, Decl(index.js, 176, 16)) this.another2 = param; @@ -208,7 +204,7 @@ >param : Symbol(param, Decl(index.js, 176, 16)) } } -@@= skipped -22, +21 lines =@@ +@@= skipped -18, +18 lines =@@ >HasStatics : Symbol(HasStatics, Decl(index.js, 184, 38)) static staticMethod() {} diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClasses.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClasses.types index 55d8ff591b..29e702a072 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClasses.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClasses.types @@ -284,7 +284,7 @@ export class N extends L { */ export class O extends N { >O : O ->N : typeof N +>N : N /** * @param {U} param @@ -294,7 +294,7 @@ export class O extends N { super(param); >super(param) : void ->super : any +>super : typeof N >param : U this.another2 = param; diff --git a/testdata/baselines/reference/submodule/conformance/jsdocAugments_withTypeParameter.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocAugments_withTypeParameter.errors.txt deleted file mode 100644 index ba632a5bd9..0000000000 --- a/testdata/baselines/reference/submodule/conformance/jsdocAugments_withTypeParameter.errors.txt +++ /dev/null @@ -1,19 +0,0 @@ -/b.js(2,17): error TS2314: Generic type 'A' requires 1 type argument(s). -/b.js(4,21): error TS2339: Property 'x' does not exist on type 'B'. - - -==== /a.d.ts (0 errors) ==== - declare class A { x: T } - -==== /b.js (2 errors) ==== - /** @augments A */ - class B extends A { - ~ -!!! error TS2314: Generic type 'A' requires 1 type argument(s). - m() { - return this.x; - ~ -!!! error TS2339: Property 'x' does not exist on type 'B'. - } - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocAugments_withTypeParameter.symbols b/testdata/baselines/reference/submodule/conformance/jsdocAugments_withTypeParameter.symbols index 33db310e3e..2bdbf50657 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocAugments_withTypeParameter.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsdocAugments_withTypeParameter.symbols @@ -17,7 +17,9 @@ class B extends A { >m : Symbol(m, Decl(b.js, 1, 19)) return this.x; +>this.x : Symbol(x, Decl(a.d.ts, 0, 20)) >this : Symbol(B, Decl(b.js, 0, 0)) +>x : Symbol(x, Decl(a.d.ts, 0, 20)) } } diff --git a/testdata/baselines/reference/submodule/conformance/jsdocAugments_withTypeParameter.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsdocAugments_withTypeParameter.symbols.diff index c0378c0a9a..3938c0b14b 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocAugments_withTypeParameter.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocAugments_withTypeParameter.symbols.diff @@ -18,7 +18,9 @@ return this.x; ->this.x : Symbol(A.x, Decl(a.d.ts, 0, 20)) ++>this.x : Symbol(x, Decl(a.d.ts, 0, 20)) >this : 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)) } } diff --git a/testdata/baselines/reference/submodule/conformance/jsdocAugments_withTypeParameter.types b/testdata/baselines/reference/submodule/conformance/jsdocAugments_withTypeParameter.types index 25dfaa7053..406bd34555 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocAugments_withTypeParameter.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocAugments_withTypeParameter.types @@ -9,15 +9,15 @@ declare class A { x: T } /** @augments A */ class B extends A { >B : B ->A : typeof A +>A : A m() { ->m : () => any +>m : () => number return this.x; ->this.x : any +>this.x : number >this : this ->x : any +>x : number } } diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImplements_class.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocImplements_class.errors.txt index f4862136ae..d45743d568 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocImplements_class.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocImplements_class.errors.txt @@ -1,8 +1,13 @@ +/a.js(13,5): error TS2416: Property 'method' in type 'B2' is not assignable to the same property in base type 'A'. + Type '() => string' is not assignable to type '() => number'. + Type 'string' is not assignable to type 'number'. +/a.js(17,7): error TS2720: Class 'B3' incorrectly implements class 'A'. Did you mean to extend 'A' and inherit its members as a subclass? + Property 'method' is missing in type 'B3' but required in type 'A'. /a.js(23,4): error TS2339: Property 'C1' does not exist on type '{}'. /a.js(47,4): error TS2339: Property 'C5' does not exist on type '{}'. -==== /a.js (2 errors) ==== +==== /a.js (4 errors) ==== class A { /** @return {number} */ method() { throw new Error(); } @@ -16,10 +21,18 @@ class B2 { /** @return {string} */ method() { return "" } + ~~~~~~ +!!! error TS2416: Property 'method' in type 'B2' is not assignable to the same property in base type 'A'. +!!! error TS2416: Type '() => string' is not assignable to type '() => number'. +!!! error TS2416: Type 'string' is not assignable to type 'number'. } /** @implements {A} */ class B3 { + ~~ +!!! error TS2720: Class 'B3' incorrectly implements class 'A'. Did you mean to extend 'A' and inherit its members as a subclass? +!!! error TS2720: Property 'method' is missing in type 'B3' but required in type 'A'. +!!! related TS2728 /a.js:3:5: 'method' is declared here. } diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImplements_interface.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocImplements_interface.errors.txt new file mode 100644 index 0000000000..ed55466360 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocImplements_interface.errors.txt @@ -0,0 +1,36 @@ +/a.js(9,5): error TS2416: Property 'mNumber' in type 'B2' is not assignable to the same property in base type 'A'. + Type '() => string' is not assignable to type '() => number'. + Type 'string' is not assignable to type 'number'. +/a.js(14,7): error TS2420: Class 'B3' incorrectly implements interface 'A'. + Property 'mNumber' is missing in type 'B3' but required in type 'A'. + + +==== /defs.d.ts (0 errors) ==== + interface A { + mNumber(): number; + } +==== /a.js (2 errors) ==== + /** @implements A */ + class B { + mNumber() { + return 0; + } + } + /** @implements {A} */ + class B2 { + mNumber() { + ~~~~~~~ +!!! error TS2416: Property 'mNumber' in type 'B2' is not assignable to the same property in base type 'A'. +!!! error TS2416: Type '() => string' is not assignable to type '() => number'. +!!! error TS2416: Type 'string' is not assignable to type 'number'. + return ""; + } + } + /** @implements A */ + class B3 { + ~~ +!!! error TS2420: Class 'B3' incorrectly implements interface 'A'. +!!! error TS2420: Property 'mNumber' is missing in type 'B3' but required in type 'A'. +!!! related TS2728 /defs.d.ts:2:5: 'mNumber' is declared here. + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImplements_interface_multiple.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocImplements_interface_multiple.errors.txt new file mode 100644 index 0000000000..334422ee60 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocImplements_interface_multiple.errors.txt @@ -0,0 +1,37 @@ +/a.js(17,7): error TS2420: Class 'BadSquare' incorrectly implements interface 'Drawable'. + Property 'draw' is missing in type 'BadSquare' but required in type 'Drawable'. + + +==== /defs.d.ts (0 errors) ==== + interface Drawable { + draw(): number; + } + interface Sizable { + size(): number; + } +==== /a.js (1 errors) ==== + /** + * @implements {Drawable} + * @implements Sizable + **/ + class Square { + draw() { + return 0; + } + size() { + return 0; + } + } + /** + * @implements Drawable + * @implements {Sizable} + **/ + class BadSquare { + ~~~~~~~~~ +!!! error TS2420: Class 'BadSquare' incorrectly implements interface 'Drawable'. +!!! error TS2420: Property 'draw' is missing in type 'BadSquare' but required in type 'Drawable'. +!!! related TS2728 /defs.d.ts:2:5: 'draw' is declared here. + size() { + return 0; + } + } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImplements_properties.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocImplements_properties.errors.txt new file mode 100644 index 0000000000..5d509a500f --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocImplements_properties.errors.txt @@ -0,0 +1,23 @@ +/a.js(3,7): error TS2720: Class 'B' incorrectly implements class 'A'. Did you mean to extend 'A' and inherit its members as a subclass? + Property 'x' is missing in type 'B' but required in type 'A'. + + +==== /a.js (1 errors) ==== + class A { constructor() { this.x = 0; } } + /** @implements A*/ + class B {} + ~ +!!! error TS2720: Class 'B' incorrectly implements class 'A'. Did you mean to extend 'A' and inherit its members as a subclass? +!!! error TS2720: Property 'x' is missing in type 'B' but required in type 'A'. +!!! related TS2728 /a.js:1:27: 'x' is declared here. + + /** @implements A*/ + class B2 { + x = 10 + } + + /** @implements {A}*/ + class B3 { + constructor() { this.x = 10 } + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImplements_signatures.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocImplements_signatures.errors.txt new file mode 100644 index 0000000000..1ababbc2c2 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsdocImplements_signatures.errors.txt @@ -0,0 +1,16 @@ +/a.js(2,7): error TS2420: Class 'B' incorrectly implements interface 'Sig'. + Index signature for type 'string' is missing in type 'B'. + + +==== /defs.d.ts (0 errors) ==== + interface Sig { + [index: string]: string + } +==== /a.js (1 errors) ==== + /** @implements {Sig} */ + class B { + ~ +!!! error TS2420: Class 'B' incorrectly implements interface 'Sig'. +!!! error TS2420: Index signature for type 'string' is missing in type 'B'. + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/extendsTag1.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/extendsTag1.types.diff deleted file mode 100644 index bf05d9fe10..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/extendsTag1.types.diff +++ /dev/null @@ -1,8 +0,0 @@ ---- old.extendsTag1.types -+++ new.extendsTag1.types -@@= skipped -6, +6 lines =@@ - */ - class My extends Set {} - >My : My -->Set : Set -+>Set : Set diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/extendsTag5.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/extendsTag5.errors.txt.diff index e8f700a5ea..120ca7a587 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/extendsTag5.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/extendsTag5.errors.txt.diff @@ -2,63 +2,29 @@ +++ new.extendsTag5.errors.txt @@= skipped -0, +0 lines =@@ -/a.js(29,16): error TS2344: Type '{ a: string; b: string; }' does not satisfy the constraint 'Foo'. -- Types of property 'b' are incompatible. -- Type 'string' is not assignable to type 'boolean | string[]'. ++/a.js(29,16): error TS2344: Type '{ a: string; b: string; }' does not satisfy the constraint '{ a: string | number; b: boolean | string[]; }'. + Types of property 'b' are incompatible. + Type 'string' is not assignable to type 'boolean | string[]'. -/a.js(42,16): error TS2344: Type '{ a: string; b: string; }' does not satisfy the constraint 'Foo'. -- Types of property 'b' are incompatible. -- Type 'string' is not assignable to type 'boolean | string[]'. -- -- --==== /a.js (2 errors) ==== -+/a.js(26,17): error TS2314: Generic type 'A' requires 1 type argument(s). -+/a.js(34,17): error TS2314: Generic type 'A' requires 1 type argument(s). -+/a.js(39,17): error TS2314: Generic type 'A' requires 1 type argument(s). -+/a.js(44,17): error TS2314: Generic type 'A' requires 1 type argument(s). -+ -+ -+==== /a.js (4 errors) ==== - /** - * @typedef {{ - * a: number | string; -@@= skipped -32, +30 lines =@@ - * }>} - */ - class B extends A {} -+ ~ -+!!! error TS2314: Generic type 'A' requires 1 type argument(s). - - /** - * @extends {A<{ -- ~ - * a: string, -- ~~~~~~~~~~~~~~~~~ - * b: string -- ~~~~~~~~~~~~~~~~ ++/a.js(42,16): error TS2344: Type '{ a: string; b: string; }' does not satisfy the constraint '{ a: string | number; b: boolean | string[]; }'. + Types of property 'b' are incompatible. + Type 'string' is not assignable to type 'boolean | string[]'. + +@@= skipped -42, +42 lines =@@ + ~~~~~~~~~~~~~~~~ * }>} -- ~~~~ + ~~~~ -!!! error TS2344: Type '{ a: string; b: string; }' does not satisfy the constraint 'Foo'. --!!! error TS2344: Types of property 'b' are incompatible. --!!! error TS2344: Type 'string' is not assignable to type 'boolean | string[]'. ++!!! error TS2344: Type '{ a: string; b: string; }' does not satisfy the constraint '{ a: string | number; b: boolean | string[]; }'. + !!! error TS2344: Types of property 'b' are incompatible. + !!! error TS2344: Type 'string' is not assignable to type 'boolean | string[]'. */ - class C extends A {} -+ ~ -+!!! error TS2314: Generic type 'A' requires 1 type argument(s). - - /** - * @extends {A<{a: string, b: string[]}>} - */ - class D extends A {} -+ ~ -+!!! error TS2314: Generic type 'A' requires 1 type argument(s). - +@@= skipped -14, +14 lines =@@ /** * @extends {A<{a: string, b: string}>} -- ~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2344: Type '{ a: string; b: string; }' does not satisfy the constraint 'Foo'. --!!! error TS2344: Types of property 'b' are incompatible. --!!! error TS2344: Type 'string' is not assignable to type 'boolean | string[]'. - */ - class E extends A {} -+ ~ -+!!! error TS2314: Generic type 'A' requires 1 type argument(s). - \ No newline at end of file ++!!! error TS2344: Type '{ a: string; b: string; }' does not satisfy the constraint '{ a: string | number; b: boolean | string[]; }'. + !!! error TS2344: Types of property 'b' are incompatible. + !!! error TS2344: Type 'string' is not assignable to type 'boolean | string[]'. + */ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/extendsTag5.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/extendsTag5.types.diff deleted file mode 100644 index 028ff59b5f..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/extendsTag5.types.diff +++ /dev/null @@ -1,33 +0,0 @@ ---- old.extendsTag5.types -+++ new.extendsTag5.types -@@= skipped -32, +32 lines =@@ - */ - class B extends A {} - >B : B -->A : A<{ a: string; b: string[]; }> -+>A : typeof A - - /** - * @extends {A<{ -@@= skipped -10, +10 lines =@@ - */ - class C extends A {} - >C : C -->A : A<{ a: string; b: string; }> -+>A : typeof A - - /** - * @extends {A<{a: string, b: string[]}>} - */ - class D extends A {} - >D : D -->A : A<{ a: string; b: string[]; }> -+>A : typeof A - - /** - * @extends {A<{a: string, b: string}>} - */ - class E extends A {} - >E : E -->A : A<{ a: string; b: string; }> -+>A : typeof A diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/importTag23.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/importTag23.errors.txt.diff index 63eec7a4cd..cf12acd1a3 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/importTag23.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/importTag23.errors.txt.diff @@ -1,25 +1,24 @@ --- old.importTag23.errors.txt +++ new.importTag23.errors.txt @@= skipped -0, +0 lines =@@ --/b.js(6,14): error TS2420: Class 'C' incorrectly implements interface 'I'. -- Property 'foo' is missing in type 'C' but required in type 'I'. -- -- --==== /a.ts (0 errors) ==== -- export interface I { -- foo(): void; -- } -- ++/b.js(5,18): error TS1361: 'NS' cannot be used as a value because it was imported using 'import type'. + /b.js(6,14): error TS2420: Class 'C' incorrectly implements interface 'I'. + Property 'foo' is missing in type 'C' but required in type 'I'. + +@@= skipped -6, +7 lines =@@ + foo(): void; + } + -==== /b.js (1 errors) ==== -- /** -- * @import * as NS from './a' -- */ -- -- /** @implements {NS.I} */ -- export class C {} -- ~ --!!! error TS2420: Class 'C' incorrectly implements interface 'I'. --!!! error TS2420: Property 'foo' is missing in type 'C' but required in type 'I'. --!!! related TS2728 /a.ts:2:5: 'foo' is declared here. -- -+ \ No newline at end of file ++==== /b.js (2 errors) ==== + /** + * @import * as NS from './a' + */ + + /** @implements {NS.I} */ ++ ~~ ++!!! error TS1361: 'NS' cannot be used as a value because it was imported using 'import type'. ++!!! related TS1376 /b.js:2:17: 'NS' was imported here. + export class C {} + ~ + !!! error TS2420: Class 'C' incorrectly implements interface 'I'. \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassImplementsGenericsSerialization.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassImplementsGenericsSerialization.errors.txt.diff new file mode 100644 index 0000000000..2198dd5e69 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassImplementsGenericsSerialization.errors.txt.diff @@ -0,0 +1,33 @@ +--- old.jsDeclarationsClassImplementsGenericsSerialization.errors.txt ++++ new.jsDeclarationsClassImplementsGenericsSerialization.errors.txt +@@= skipped -0, +0 lines =@@ +- ++lib.js(3,17): error TS2552: Cannot find name 'IEncoder'. Did you mean 'Encoder'? ++ ++ ++==== interface.ts (0 errors) ==== ++ export interface Encoder { ++ encode(value: T): Uint8Array ++ } ++==== lib.js (1 errors) ==== ++ /** ++ * @template T ++ * @implements {IEncoder} ++ ~~~~~~~~ ++!!! error TS2552: Cannot find name 'IEncoder'. Did you mean 'Encoder'? ++!!! related TS2728 lib.js:5:14: 'Encoder' is declared here. ++ */ ++ export class Encoder { ++ /** ++ * @param {T} value ++ */ ++ encode(value) { ++ return new Uint8Array(0) ++ } ++ } ++ ++ ++ /** ++ * @template T ++ * @typedef {import('./interface').Encoder} IEncoder ++ */ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClasses.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClasses.errors.txt.diff deleted file mode 100644 index 8c3d7e2a84..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClasses.errors.txt.diff +++ /dev/null @@ -1,204 +0,0 @@ ---- old.jsDeclarationsClasses.errors.txt -+++ new.jsDeclarationsClasses.errors.txt -@@= skipped -0, +0 lines =@@ -- -+index.js(173,24): error TS2314: Generic type 'N' requires 1 type argument(s). -+ -+ -+==== index.js (1 errors) ==== -+ export class A {} -+ -+ export class B { -+ static cat = "cat"; -+ } -+ -+ export class C { -+ static Cls = class {} -+ } -+ -+ export class D { -+ /** -+ * @param {number} a -+ * @param {number} b -+ */ -+ constructor(a, b) {} -+ } -+ -+ /** -+ * @template T,U -+ */ -+ export class E { -+ /** -+ * @type {T & U} -+ */ -+ field; -+ -+ // @readonly is currently unsupported, it seems - included here just in case that changes -+ /** -+ * @type {T & U} -+ * @readonly -+ */ -+ readonlyField; -+ -+ initializedField = 12; -+ -+ /** -+ * @return {U} -+ */ -+ get f1() { return /** @type {*} */(null); } -+ -+ /** -+ * @param {U} _p -+ */ -+ set f1(_p) {} -+ -+ /** -+ * @return {U} -+ */ -+ get f2() { return /** @type {*} */(null); } -+ -+ /** -+ * @param {U} _p -+ */ -+ set f3(_p) {} -+ -+ /** -+ * @param {T} a -+ * @param {U} b -+ */ -+ constructor(a, b) {} -+ -+ -+ /** -+ * @type {string} -+ */ -+ static staticField; -+ -+ // @readonly is currently unsupported, it seems - included here just in case that changes -+ /** -+ * @type {string} -+ * @readonly -+ */ -+ static staticReadonlyField; -+ -+ static staticInitializedField = 12; -+ -+ /** -+ * @return {string} -+ */ -+ static get s1() { return ""; } -+ -+ /** -+ * @param {string} _p -+ */ -+ static set s1(_p) {} -+ -+ /** -+ * @return {string} -+ */ -+ static get s2() { return ""; } -+ -+ /** -+ * @param {string} _p -+ */ -+ static set s3(_p) {} -+ } -+ -+ /** -+ * @template T,U -+ */ -+ export class F { -+ /** -+ * @type {T & U} -+ */ -+ field; -+ /** -+ * @param {T} a -+ * @param {U} b -+ */ -+ constructor(a, b) {} -+ -+ /** -+ * @template A,B -+ * @param {A} a -+ * @param {B} b -+ */ -+ static create(a, b) { return new F(a, b); } -+ } -+ -+ class G {} -+ -+ export { G }; -+ -+ class HH {} -+ -+ export { HH as H }; -+ -+ export class I {} -+ export { I as II }; -+ -+ export { J as JJ }; -+ export class J {} -+ -+ -+ export class K { -+ constructor() { -+ this.p1 = 12; -+ this.p2 = "ok"; -+ } -+ -+ method() { -+ return this.p1; -+ } -+ } -+ -+ export class L extends K {} -+ -+ export class M extends null { -+ constructor() { -+ this.prop = 12; -+ } -+ } -+ -+ -+ /** -+ * @template T -+ */ -+ export class N extends L { -+ /** -+ * @param {T} param -+ */ -+ constructor(param) { -+ super(); -+ this.another = param; -+ } -+ } -+ -+ /** -+ * @template U -+ * @extends {N} -+ */ -+ export class O extends N { -+ ~ -+!!! error TS2314: Generic type 'N' requires 1 type argument(s). -+ /** -+ * @param {U} param -+ */ -+ constructor(param) { -+ super(param); -+ this.another2 = param; -+ } -+ } -+ -+ var x = /** @type {*} */(null); -+ -+ export class VariableBase extends x {} -+ -+ export class HasStatics { -+ static staticMethod() {} -+ } -+ -+ export class ExtendsStatics extends HasStatics { -+ static also() {} -+ } -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClasses.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClasses.types.diff index 73b2d9e987..94bd748104 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClasses.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClasses.types.diff @@ -61,22 +61,7 @@ >param : T } } -@@= skipped -13, +13 lines =@@ - */ - export class O extends N { - >O : O -->N : N -+>N : typeof N - - /** - * @param {U} param -@@= skipped -10, +10 lines =@@ - - super(param); - >super(param) : void -->super : typeof N -+>super : any - >param : U +@@= skipped -28, +28 lines =@@ this.another2 = param; >this.another2 = param : U @@ -88,7 +73,7 @@ >param : U } } -@@= skipped -15, +15 lines =@@ +@@= skipped -10, +10 lines =@@ var x = /** @type {*} */(null); >x : any >(null) : any diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocAugments_withTypeParameter.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocAugments_withTypeParameter.errors.txt.diff deleted file mode 100644 index 5f177f41ec..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocAugments_withTypeParameter.errors.txt.diff +++ /dev/null @@ -1,23 +0,0 @@ ---- old.jsdocAugments_withTypeParameter.errors.txt -+++ new.jsdocAugments_withTypeParameter.errors.txt -@@= skipped -0, +0 lines =@@ -- -+/b.js(2,17): error TS2314: Generic type 'A' requires 1 type argument(s). -+/b.js(4,21): error TS2339: Property 'x' does not exist on type 'B'. -+ -+ -+==== /a.d.ts (0 errors) ==== -+ declare class A { x: T } -+ -+==== /b.js (2 errors) ==== -+ /** @augments A */ -+ class B extends A { -+ ~ -+!!! error TS2314: Generic type 'A' requires 1 type argument(s). -+ m() { -+ return this.x; -+ ~ -+!!! error TS2339: Property 'x' does not exist on type 'B'. -+ } -+ } -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocAugments_withTypeParameter.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocAugments_withTypeParameter.types.diff deleted file mode 100644 index 69fafa635e..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocAugments_withTypeParameter.types.diff +++ /dev/null @@ -1,21 +0,0 @@ ---- old.jsdocAugments_withTypeParameter.types -+++ new.jsdocAugments_withTypeParameter.types -@@= skipped -8, +8 lines =@@ - /** @augments A */ - class B extends A { - >B : B -->A : A -+>A : typeof A - - m() { -->m : () => number -+>m : () => any - - return this.x; -->this.x : number -+>this.x : any - >this : this -->x : number -+>x : any - } - } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImplements_class.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImplements_class.errors.txt.diff index 38e40ed60b..35ad61ace8 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImplements_class.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImplements_class.errors.txt.diff @@ -1,35 +1,21 @@ --- old.jsdocImplements_class.errors.txt +++ new.jsdocImplements_class.errors.txt -@@= skipped -0, +0 lines =@@ --/a.js(13,5): error TS2416: Property 'method' in type 'B2' is not assignable to the same property in base type 'A'. -- Type '() => string' is not assignable to type '() => number'. -- Type 'string' is not assignable to type 'number'. --/a.js(17,7): error TS2720: Class 'B3' incorrectly implements class 'A'. Did you mean to extend 'A' and inherit its members as a subclass? -- Property 'method' is missing in type 'B3' but required in type 'A'. +@@= skipped -2, +2 lines =@@ + Type 'string' is not assignable to type 'number'. + /a.js(17,7): error TS2720: Class 'B3' incorrectly implements class 'A'. Did you mean to extend 'A' and inherit its members as a subclass? + Property 'method' is missing in type 'B3' but required in type 'A'. +- +- +-==== /a.js (2 errors) ==== +/a.js(23,4): error TS2339: Property 'C1' does not exist on type '{}'. +/a.js(47,4): error TS2339: Property 'C5' does not exist on type '{}'. - - - ==== /a.js (2 errors) ==== -@@= skipped -18, +15 lines =@@ - class B2 { - /** @return {string} */ - method() { return "" } -- ~~~~~~ --!!! error TS2416: Property 'method' in type 'B2' is not assignable to the same property in base type 'A'. --!!! error TS2416: Type '() => string' is not assignable to type '() => number'. --!!! error TS2416: Type 'string' is not assignable to type 'number'. - } - - /** @implements {A} */ - class B3 { -- ~~ --!!! error TS2720: Class 'B3' incorrectly implements class 'A'. Did you mean to extend 'A' and inherit its members as a subclass? --!!! error TS2720: Property 'method' is missing in type 'B3' but required in type 'A'. --!!! related TS2728 /a.js:3:5: 'method' is declared here. - } - - ++ ++ ++==== /a.js (4 errors) ==== + class A { + /** @return {number} */ + method() { throw new Error(); } +@@= skipped -34, +36 lines =@@ var Ns = {}; /** @implements {A} */ Ns.C1 = class { @@ -38,7 +24,7 @@ method() { return 11; } } /** @implements {A} */ -@@= skipped -42, +36 lines =@@ +@@= skipped -24, +26 lines =@@ var C5; /** @implements {A} */ Ns.C5 = C5 || class { diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImplements_interface.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImplements_interface.errors.txt.diff deleted file mode 100644 index 2ea0b412c2..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImplements_interface.errors.txt.diff +++ /dev/null @@ -1,40 +0,0 @@ ---- old.jsdocImplements_interface.errors.txt -+++ new.jsdocImplements_interface.errors.txt -@@= skipped -0, +0 lines =@@ --/a.js(9,5): error TS2416: Property 'mNumber' in type 'B2' is not assignable to the same property in base type 'A'. -- Type '() => string' is not assignable to type '() => number'. -- Type 'string' is not assignable to type 'number'. --/a.js(14,7): error TS2420: Class 'B3' incorrectly implements interface 'A'. -- Property 'mNumber' is missing in type 'B3' but required in type 'A'. -- -- --==== /defs.d.ts (0 errors) ==== -- interface A { -- mNumber(): number; -- } --==== /a.js (2 errors) ==== -- /** @implements A */ -- class B { -- mNumber() { -- return 0; -- } -- } -- /** @implements {A} */ -- class B2 { -- mNumber() { -- ~~~~~~~ --!!! error TS2416: Property 'mNumber' in type 'B2' is not assignable to the same property in base type 'A'. --!!! error TS2416: Type '() => string' is not assignable to type '() => number'. --!!! error TS2416: Type 'string' is not assignable to type 'number'. -- return ""; -- } -- } -- /** @implements A */ -- class B3 { -- ~~ --!!! error TS2420: Class 'B3' incorrectly implements interface 'A'. --!!! error TS2420: Property 'mNumber' is missing in type 'B3' but required in type 'A'. --!!! related TS2728 /defs.d.ts:2:5: 'mNumber' is declared here. -- } -- -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImplements_interface_multiple.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImplements_interface_multiple.errors.txt.diff deleted file mode 100644 index 20910e83dd..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImplements_interface_multiple.errors.txt.diff +++ /dev/null @@ -1,41 +0,0 @@ ---- old.jsdocImplements_interface_multiple.errors.txt -+++ new.jsdocImplements_interface_multiple.errors.txt -@@= skipped -0, +0 lines =@@ --/a.js(17,7): error TS2420: Class 'BadSquare' incorrectly implements interface 'Drawable'. -- Property 'draw' is missing in type 'BadSquare' but required in type 'Drawable'. -- -- --==== /defs.d.ts (0 errors) ==== -- interface Drawable { -- draw(): number; -- } -- interface Sizable { -- size(): number; -- } --==== /a.js (1 errors) ==== -- /** -- * @implements {Drawable} -- * @implements Sizable -- **/ -- class Square { -- draw() { -- return 0; -- } -- size() { -- return 0; -- } -- } -- /** -- * @implements Drawable -- * @implements {Sizable} -- **/ -- class BadSquare { -- ~~~~~~~~~ --!!! error TS2420: Class 'BadSquare' incorrectly implements interface 'Drawable'. --!!! error TS2420: Property 'draw' is missing in type 'BadSquare' but required in type 'Drawable'. --!!! related TS2728 /defs.d.ts:2:5: 'draw' is declared here. -- size() { -- return 0; -- } -- } -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImplements_properties.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImplements_properties.errors.txt.diff deleted file mode 100644 index c8e1b90061..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImplements_properties.errors.txt.diff +++ /dev/null @@ -1,27 +0,0 @@ ---- old.jsdocImplements_properties.errors.txt -+++ new.jsdocImplements_properties.errors.txt -@@= skipped -0, +0 lines =@@ --/a.js(3,7): error TS2720: Class 'B' incorrectly implements class 'A'. Did you mean to extend 'A' and inherit its members as a subclass? -- Property 'x' is missing in type 'B' but required in type 'A'. -- -- --==== /a.js (1 errors) ==== -- class A { constructor() { this.x = 0; } } -- /** @implements A*/ -- class B {} -- ~ --!!! error TS2720: Class 'B' incorrectly implements class 'A'. Did you mean to extend 'A' and inherit its members as a subclass? --!!! error TS2720: Property 'x' is missing in type 'B' but required in type 'A'. --!!! related TS2728 /a.js:1:27: 'x' is declared here. -- -- /** @implements A*/ -- class B2 { -- x = 10 -- } -- -- /** @implements {A}*/ -- class B3 { -- constructor() { this.x = 10 } -- } -- -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImplements_signatures.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImplements_signatures.errors.txt.diff deleted file mode 100644 index 131ec97618..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImplements_signatures.errors.txt.diff +++ /dev/null @@ -1,20 +0,0 @@ ---- old.jsdocImplements_signatures.errors.txt -+++ new.jsdocImplements_signatures.errors.txt -@@= skipped -0, +0 lines =@@ --/a.js(2,7): error TS2420: Class 'B' incorrectly implements interface 'Sig'. -- Index signature for type 'string' is missing in type 'B'. -- -- --==== /defs.d.ts (0 errors) ==== -- interface Sig { -- [index: string]: string -- } --==== /a.js (1 errors) ==== -- /** @implements {Sig} */ -- class B { -- ~ --!!! error TS2420: Class 'B' incorrectly implements interface 'Sig'. --!!! error TS2420: Index signature for type 'string' is missing in type 'B'. -- } -- -+ \ No newline at end of file