function fooA < T > ( x ) { if ( typeof x === "function" ) { } } console . log ( fooA ( ( word ) => `Hello, ${ word }!` ) ) ; console . log ( fooA ( ( ) => `Hello, world!` ) ) ; function fooB < T extends { word : string ; } > ( x ) { if ( typeof x === "function" ) { return x ( ) ; } return `Hello, ${ x . word }` ; } console . log ( fooB ( ( ) => `Hello, TypeScript!` ) ) ; console . log ( fooB ( { word : "world" } ) ) ; const func = ( name ) => `Hello, ${ name }` ; func . word = "invalid" ; console . log ( fooB ( func ) ) ; export { } ;