Typescript optional function


function test(msg: string, func?: (m: string)=>void) {
	func?.(a, b);
}

test('nothing');

test('something', (m)=>console.log(m));

No comments:

Post a Comment