Files
scriptc/tests/corpus/local-class-detached-method.ts
T
2026-10-20 17:56:44 -05:00

17 lines
384 B
TypeScript

// A method that never reads `this`, taken off an instance of a class
// declared inside a function: the detached method runs without a receiver.
function helper(): string {
return "helper";
}
function make() {
return class Local {
tag = "t";
plain(): string {
return helper();
}
};
}
const C = make();
const detached = new C().plain;
console.log(detached());