tests(39373): add addition tests (#39631)

This commit is contained in:
Alexander T 2020-07-17 23:30:57 +03:00 committed by GitHub
parent f19c610d91
commit 92f41c81fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 53 additions and 3 deletions

View File

@ -10,6 +10,6 @@
==== /node_modules/@types/node/index.d.ts (0 errors) ====
declare const require: any;
==== /a.ts (0 errors) ====
==== /a.js (0 errors) ====
export class Foo {}

View File

@ -3,7 +3,7 @@
//// [index.d.ts]
declare const require: any;
//// [a.ts]
//// [a.js]
export class Foo {}
//// [b.ts]

View File

@ -0,0 +1,11 @@
tests/cases/compiler/declarationEmitExpressionInExtends7.ts(1,30): error TS2304: Cannot find name 'SomeUndefinedFunction'.
tests/cases/compiler/declarationEmitExpressionInExtends7.ts(1,30): error TS4021: 'extends' clause of exported class has or is using private name 'SomeUndefinedFunction'.
==== tests/cases/compiler/declarationEmitExpressionInExtends7.ts (2 errors) ====
export default class extends SomeUndefinedFunction {}
~~~~~~~~~~~~~~~~~~~~~
!!! error TS2304: Cannot find name 'SomeUndefinedFunction'.
~~~~~~~~~~~~~~~~~~~~~
!!! error TS4021: 'extends' clause of exported class has or is using private name 'SomeUndefinedFunction'.

View File

@ -0,0 +1,28 @@
//// [declarationEmitExpressionInExtends7.ts]
export default class extends SomeUndefinedFunction {}
//// [declarationEmitExpressionInExtends7.js]
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
exports.__esModule = true;
var default_1 = /** @class */ (function (_super) {
__extends(default_1, _super);
function default_1() {
return _super !== null && _super.apply(this, arguments) || this;
}
return default_1;
}(SomeUndefinedFunction));
exports["default"] = default_1;

View File

@ -0,0 +1,4 @@
=== tests/cases/compiler/declarationEmitExpressionInExtends7.ts ===
export default class extends SomeUndefinedFunction {}
No type information for this code.
No type information for this code.

View File

@ -0,0 +1,4 @@
=== tests/cases/compiler/declarationEmitExpressionInExtends7.ts ===
export default class extends SomeUndefinedFunction {}
>SomeUndefinedFunction : any

View File

@ -1,12 +1,13 @@
// @module: commonjs
// @declaration: true
// @allowJs: true
// @types: node
// @currentDirectory: /
// @Filename: /node_modules/@types/node/index.d.ts
declare const require: any;
// @Filename: /a.ts
// @Filename: /a.js
export class Foo {}
// @Filename: /b.ts

View File

@ -0,0 +1,2 @@
// @declaration: true
export default class extends SomeUndefinedFunction {}