Skip to content

Instantly share code, notes, and snippets.

@glaucia86
Created August 26, 2018 22:10
Show Gist options
  • Save glaucia86/af9f78d79da2ad5fe082bd37df5f8691 to your computer and use it in GitHub Desktop.
Save glaucia86/af9f78d79da2ad5fe082bd37df5f8691 to your computer and use it in GitHub Desktop.
/**
* Arquivo: unknown-type.ts
* Author: Glaucia Lemos
* Data: 23/08/2018
*/
let textoExemplo: unknown = 10;
// O código abaixo não irá executar uma vez que 'textoExemplo' é do tipo 'unknown'
textoExemplo.x.prop;
textoExemplo.y.prop;
textoExemplo.z.prop;
textoExemplo();
new tetextoExemplost();
upperCase(textoExemplo);
textoExemplo `Oi Pessoal!`;
function upperCase(x: string) {
return x.toUpperCase();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment