TypeScript/tests/baselines/reference/divergentAccessorsTypes2.js
Ryan Cavanaugh ff233a9ac2
Variant accessors (#42425)
Allows accessors to have different access modifiers and types

Fixes #2845, #2521
2021-03-26 20:11:02 -07:00

25 lines
419 B
TypeScript

//// [divergentAccessorsTypes2.ts]
class Test1<T> {
get foo(): T { return null as any }
set foo(s: T | undefined ) {
}
}
const s = new Test1<string>();
s.foo = undefined;
s.foo = "hello";
s.foo = 42;
//// [divergentAccessorsTypes2.js]
"use strict";
class Test1 {
get foo() { return null; }
set foo(s) {
}
}
const s = new Test1();
s.foo = undefined;
s.foo = "hello";
s.foo = 42;