Closed Strajk closed 1 year ago
Latest commit: 74f6dc35a505cbe972978eaf46f67f3f378ad081
The changes in this PR will be included in the next version bump.
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Snippet to explore TS behaviour
interface BaseOpts {
cwd: string;
apiKey: string;
}
class Base {
constructor(readonly opts: BaseOpts) {
// ...
}
}
// ---
interface SubOpts extends BaseOpts {
onStdErr: () => void;
}
class Sub extends Base {
readonly filesystem: any;
constructor(opts: SubOpts) {
super(opts);
this.filesystem = {}
}
doSth() {
this.opts.onStdErr; // this.opts is BaseOpts
(this.opts as SubOpts).onStdErr();
}
}
Snippet to explore TS behaviour
interface BaseOpts {
cwd: string;
apiKey: string;
}
class Base {
constructor(readonly opts: BaseOpts) {
// ...
}
}
// ---
interface SubOpts extends BaseOpts {
onStdErr: () => void;
}
class Sub extends Base {
readonly filesystem: any;
constructor(opts: SubOpts) {
super(opts);
this.filesystem = {}
}
doSth() {
this.opts.onStdErr; // this.opts is BaseOpts
(this.opts as SubOpts).onStdErr();
}
}