mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-06 11:54:44 -06:00
Code review comments
This commit is contained in:
parent
15f07e6231
commit
15640492c4
@ -16247,10 +16247,8 @@ namespace ts {
|
||||
function writeBaseConstructorTypeOfClass(node: ClassLikeDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter) {
|
||||
const classType = <InterfaceType>getDeclaredTypeOfSymbol(getSymbolOfNode(node));
|
||||
resolveBaseTypesOfClass(classType);
|
||||
const baseType = classType.resolvedBaseTypes[0];
|
||||
if (baseType) {
|
||||
getSymbolDisplayBuilder().buildTypeDisplay(baseType, writer, enclosingDeclaration, flags);
|
||||
}
|
||||
const baseType = classType.resolvedBaseTypes.length ? classType.resolvedBaseTypes[0] : unknownType;
|
||||
getSymbolDisplayBuilder().buildTypeDisplay(baseType, writer, enclosingDeclaration, flags);
|
||||
}
|
||||
|
||||
function hasGlobalName(name: string): boolean {
|
||||
|
||||
@ -0,0 +1,35 @@
|
||||
tests/cases/compiler/declarationEmit_expressionInExtends4.ts(2,10): error TS4060: Return type of exported function has or is using private name 'D'.
|
||||
tests/cases/compiler/declarationEmit_expressionInExtends4.ts(6,17): error TS2315: Type 'D' is not generic.
|
||||
tests/cases/compiler/declarationEmit_expressionInExtends4.ts(10,18): error TS2304: Cannot find name 'SomeUndefinedFunction'.
|
||||
tests/cases/compiler/declarationEmit_expressionInExtends4.ts(15,18): error TS2304: Cannot find name 'SomeUndefinedFunction'.
|
||||
tests/cases/compiler/declarationEmit_expressionInExtends4.ts(15,18): error TS4020: Extends clause of exported class 'C3' has or is using private name 'SomeUndefinedFunction'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/declarationEmit_expressionInExtends4.ts (5 errors) ====
|
||||
|
||||
function getSomething() {
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS4060: Return type of exported function has or is using private name 'D'.
|
||||
return class D { }
|
||||
}
|
||||
|
||||
class C extends getSomething()<number, string> {
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2315: Type 'D' is not generic.
|
||||
|
||||
}
|
||||
|
||||
class C2 extends SomeUndefinedFunction()<number, string> {
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'SomeUndefinedFunction'.
|
||||
|
||||
}
|
||||
|
||||
|
||||
class C3 extends SomeUndefinedFunction {
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'SomeUndefinedFunction'.
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS4020: Extends clause of exported class 'C3' has or is using private name 'SomeUndefinedFunction'.
|
||||
|
||||
}
|
||||
@ -0,0 +1,53 @@
|
||||
//// [declarationEmit_expressionInExtends4.ts]
|
||||
|
||||
function getSomething() {
|
||||
return class D { }
|
||||
}
|
||||
|
||||
class C extends getSomething()<number, string> {
|
||||
|
||||
}
|
||||
|
||||
class C2 extends SomeUndefinedFunction()<number, string> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
class C3 extends SomeUndefinedFunction {
|
||||
|
||||
}
|
||||
|
||||
//// [declarationEmit_expressionInExtends4.js]
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
function getSomething() {
|
||||
return (function () {
|
||||
function D() {
|
||||
}
|
||||
return D;
|
||||
}());
|
||||
}
|
||||
var C = (function (_super) {
|
||||
__extends(C, _super);
|
||||
function C() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
return C;
|
||||
}(getSomething()));
|
||||
var C2 = (function (_super) {
|
||||
__extends(C2, _super);
|
||||
function C2() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
return C2;
|
||||
}(SomeUndefinedFunction()));
|
||||
var C3 = (function (_super) {
|
||||
__extends(C3, _super);
|
||||
function C3() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
return C3;
|
||||
}(SomeUndefinedFunction));
|
||||
18
tests/cases/compiler/declarationEmit_expressionInExtends4.ts
Normal file
18
tests/cases/compiler/declarationEmit_expressionInExtends4.ts
Normal file
@ -0,0 +1,18 @@
|
||||
// @declaration: true
|
||||
|
||||
function getSomething() {
|
||||
return class D { }
|
||||
}
|
||||
|
||||
class C extends getSomething()<number, string> {
|
||||
|
||||
}
|
||||
|
||||
class C2 extends SomeUndefinedFunction()<number, string> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
class C3 extends SomeUndefinedFunction {
|
||||
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user