Skip to content
Closed
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@
"express": "^4.18.1",
"zod": "^3.17.10"
}
}
}
30 changes: 30 additions & 0 deletions src/01-number.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Parameter X implicitly has an 'any' type

```typescript
const addTwoNumbers = (a, b) => {
return a + b
}
```

> Parameter 'a' implicitly has an 'any' type.
>
> Parameter 'b' implicitly has an 'any' type.

## What is going on?

Missing type annotation to a parameter in a function.

It is turned on by strict mode.

```json
// tsconfig.json
{
"compilerOptions": {
"strict": true
}
}
```

## Why is this important?

This is the essence of Typescript, without it the code is loosely typed and errors are prone to happen.
2 changes: 1 addition & 1 deletion src/01-number.problem.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect, it } from "vitest";

export const addTwoNumbers = (a, b) => {
export const addTwoNumbers = (a: number, b:number) => {
return a + b;
};

Expand Down