Skip to content

Commit

Permalink
Update typescript.html.markdown with appropriate example names
Browse files Browse the repository at this point in the history
  • Loading branch information
vc-vishakha authored Oct 29, 2024
1 parent 6c2f1c7 commit 234f4f5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions typescript.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ notSure = "maybe a string instead";
notSure = false; // okay, definitely a boolean

// When we are not sure about the type, and don't want to use "any", we can use "unknown" type
let unknownVariable: unknown = 'Abc'; // we don't fully know yet the type
unknownVariable = 1234; // possible
let unknownVariable: unknown = 'Some string'; // we don't fully know yet the type
unknownVariable = 2; // possible
const someVariable: string = unknownVariable; // Invalid; we can't assign unknownVariable to any other type (without an explicit assertion), unlike any

// Use const keyword for constants
Expand Down

0 comments on commit 234f4f5

Please sign in to comment.