TypeScript/tests/baselines/reference/logicalAssignment5(target=esnext).errors.txt
Kagami Sascha Rosylight f4d0ea6539
Add target: ES2021 (#41239)
* Support `target: es2020`

* use CRLF

* update symbols

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2021-03-10 13:31:25 -08:00

45 lines
1.6 KiB
Plaintext

tests/cases/conformance/es2021/logicalAssignment/logicalAssignment5.ts(13,5): error TS2722: Cannot invoke an object which is possibly 'undefined'.
tests/cases/conformance/es2021/logicalAssignment/logicalAssignment5.ts(17,12): error TS2532: Object is possibly 'undefined'.
tests/cases/conformance/es2021/logicalAssignment/logicalAssignment5.ts(22,12): error TS2532: Object is possibly 'undefined'.
tests/cases/conformance/es2021/logicalAssignment/logicalAssignment5.ts(28,5): error TS2722: Cannot invoke an object which is possibly 'undefined'.
==== tests/cases/conformance/es2021/logicalAssignment/logicalAssignment5.ts (4 errors) ====
function foo1 (f?: (a: number) => void) {
f ??= (a => a)
f(42)
}
function foo2 (f?: (a: number) => void) {
f ||= (a => a)
f(42)
}
function foo3 (f?: (a: number) => void) {
f &&= (a => a)
f(42)
~
!!! error TS2722: Cannot invoke an object which is possibly 'undefined'.
}
function bar1 (f?: (a: number) => void) {
f ??= (f.toString(), (a => a))
~
!!! error TS2532: Object is possibly 'undefined'.
f(42)
}
function bar2 (f?: (a: number) => void) {
f ||= (f.toString(), (a => a))
~
!!! error TS2532: Object is possibly 'undefined'.
f(42)
}
function bar3 (f?: (a: number) => void) {
f &&= (f.toString(), (a => a))
f(42)
~
!!! error TS2722: Cannot invoke an object which is possibly 'undefined'.
}