Files
2026-07-22 18:08:04 -05:00

28 lines
672 B
JavaScript

// The commander shape in miniature: a getter/setter method whose declared
// OVERLOADS (index.d.ts) say `name(): string` / `name(v): this`, while the
// JS body infers the union `string | Chainy` — chained program-side calls
// typecheck against the .d.ts and FAIL against the inferred surface.
'use strict';
class Chainy {
constructor() {
this._name = '';
this._tag = '';
}
name(v) {
if (v === undefined) return this._name;
this._name = v;
return this;
}
tag(v) {
if (v === undefined) return this._tag;
this._tag = v;
return this;
}
render() {
return this._name + '#' + this._tag;
}
}
module.exports = { Chainy };