TypeScript/tests/cases/conformance/types/thisType/thisTypeSyntacticContext.ts
Nathan Shively-Sanders 11eabc0946
Skip parens and non-null assertions when looking for this-context (#23097)
* Skip parens and ! for getting this-context of call

* Add test and improve code a bit

* Use skipOuterExpressions instead
2018-04-03 06:23:59 -07:00

14 lines
192 B
TypeScript

function f(this: { n: number }) {
}
const o: { n: number, test?: (this: { n: number }) => void } = { n: 1 }
o.test = f
o.test();
o!.test();
o.test!();
o.test!!!();
(o.test!)();
(o.test)();