Closed
Description
input:
let s: string | null = null
declare function log(s: string): void
/** Calculates the n-th Fibonacci number. */
export function fib(n: i32): i32 {
s != null ? log("not null") : log("null") // <--------------- error
return 123
}
error:
;; INFO asc module.ts --textFile module.wat --binaryFile module.wasm -O3 --runtime stub
;; ERROR TS2322: Type 'void' is not assignable to type 'void'.
;;
;; s != null ? log("not null") : log("null")
;; ~~~~~~~~~~~
;; in module.ts(7,33)
;;
;; ERROR TS2355: A function whose declared type is not 'void' must return a value.
;;
;; export function fib(n: i32): i32 {
;; ~~~
;; in module.ts(6,30)
(module
;; FAILURE 2 compile error(s)
)