mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
44 lines
880 B
TypeScript
44 lines
880 B
TypeScript
//// [tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorImplementationWithDefaultValues2.ts] ////
|
|
|
|
//// [constructorImplementationWithDefaultValues2.ts]
|
|
class C {
|
|
constructor(x);
|
|
constructor(public x: string = 1) { // error
|
|
var y = x;
|
|
}
|
|
}
|
|
|
|
class D<T, U> {
|
|
constructor(x: T, y: U);
|
|
constructor(x: T = 1, public y: U = x) { // error
|
|
var z = x;
|
|
}
|
|
}
|
|
|
|
class E<T extends Date> {
|
|
constructor(x);
|
|
constructor(x: T = new Date()) { // error
|
|
var y = x;
|
|
}
|
|
}
|
|
|
|
//// [constructorImplementationWithDefaultValues2.js]
|
|
"use strict";
|
|
class C {
|
|
constructor(x = 1) {
|
|
this.x = x;
|
|
var y = x;
|
|
}
|
|
}
|
|
class D {
|
|
constructor(x = 1, y = x) {
|
|
this.y = y;
|
|
var z = x;
|
|
}
|
|
}
|
|
class E {
|
|
constructor(x = new Date()) {
|
|
var y = x;
|
|
}
|
|
}
|