mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
42 lines
615 B
TypeScript
42 lines
615 B
TypeScript
//// [tests/cases/conformance/types/thisType/fluentClasses.ts] ////
|
|
|
|
//// [fluentClasses.ts]
|
|
class A {
|
|
foo() {
|
|
return this;
|
|
}
|
|
}
|
|
class B extends A {
|
|
bar() {
|
|
return this;
|
|
}
|
|
}
|
|
class C extends B {
|
|
baz() {
|
|
return this;
|
|
}
|
|
}
|
|
var c: C;
|
|
var z = c.foo().bar().baz(); // Fluent pattern
|
|
|
|
|
|
//// [fluentClasses.js]
|
|
"use strict";
|
|
class A {
|
|
foo() {
|
|
return this;
|
|
}
|
|
}
|
|
class B extends A {
|
|
bar() {
|
|
return this;
|
|
}
|
|
}
|
|
class C extends B {
|
|
baz() {
|
|
return this;
|
|
}
|
|
}
|
|
var c;
|
|
var z = c.foo().bar().baz(); // Fluent pattern
|