If you pass a string to
multiply(), VS Code will show you an error by underlying the problematic part of your code:
Hover that with the mouse, VS Code will tell you more:
Now, regarding TypeScript errors, sometimes they are a bit cryptic. Not in this case. But there is a VS Code extension that helps you by giving actionable information, and it’s called Pretty TypeScript Errors.
Install that, you’ll see different error messages:
This is what happens in the editor.
Lessons this unit:
|1:||Your first TypeScript program|
|4:||▶︎ The editor helps you with type errors|
|5:||Running TypeScript code|
|7:||Type aliases and interfaces|
|9:||Typing arrays with generics|
|10:||The DX of editing TypeScript|
|12:||tsconfig.json COMING SOON|
|13:||Installing types COMING SOON|