1/* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15/**--- 16 description: > 17 a call signature's return type annotation specifies the type of the value computed and returned by a call operation. 18 A void return type annotation is used to indicate that a function has no return value. 19 module: ESNext 20 isCurrent: true 21 ---*/ 22 23 24import { Assert } from '../../../../../../suite/assert.js' 25 26function returnNum(a: number, b: number): number { 27 return a + b; 28} 29let aa = returnNum(1, 2); 30Assert.equal(aa, 3); 31function returnString(name: string): string { 32 return name + " b!"; 33} 34let bb = returnString("rush"); 35Assert.equal(bb, "rush b!"); 36function returnBoolean(a: number, b: number): Boolean { 37 return a > b ? true : false; 38} 39let cc = returnBoolean(1, 2); 40Assert.equal(cc, false); 41function returnUndefine(a: undefined): undefined { 42 return a; 43} 44let ad: undefined; 45let dd = returnUndefine(ad); 46Assert.equal(dd, undefined); 47function returnVoid(a: number): void { } 48let ee = returnVoid(1); 49Assert.equal(ee, null);