namespace StrongerTypingUsingUnknown { class User { name : string ; constructor ( name ) { this . name = name ; } } function deserialize ( input ) { return JSON . parse ( input ) ; } function greet ( user ) { console . log ( `Hi ${ user . name }!` ) ; } function isUser ( user ) { if ( user === null || user === undefined ) return false ; return typeof user . name === 'string' ; } let user = deserialize ( '{ "name": "Alice" }' ) ; if ( isUser ( user ) ) greet ( user ) ; user = deserialize ( "null" ) ; if ( isUser ( user ) ) greet ( user ) ; }