Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions step00c_type_error/app.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
let message = "Hello World";
console.loger(message);

// A type error in TypeScript occurs when a value is used in a way that is incompatible with its declared type.

let myName: string = "unknown person"
myName = 4 // Here, try to assign the number 4 to variable `myName`. Since `myName` is type string, TypeScript will throw a type error: Type 'number' is not assignable to type 'string'.

console.log(myName);