Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

typescript "variable!: type" notation

// Writing ! after any expression is effectively a type assertion 
// that the value isn’t null or undefined
function liveDangerously(x?: number | null) {  // No error  console.log(x!.toFixed());}Try
Source by www.typescriptlang.org #
 
PREVIOUS NEXT
Tagged: #typescript #notation
ADD COMMENT
Topic
Name
4+7 =