Skip to content

Commit 599968c

Browse files
committed
soften hints
1 parent 517f463 commit 599968c

16 files changed

Lines changed: 18 additions & 105 deletions

File tree

exercises/01.classes/01.problem.class-basics/README.mdx

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,6 @@ system.
99
2. Create a `ShoppingCart` class that holds products
1010
3. Instantiate and use these classes
1111

12-
💰 Class syntax:
13-
14-
```ts
15-
class ClassName {
16-
field: Type
17-
18-
constructor(param: Type) {
19-
this.field = param
20-
}
21-
22-
method(): ReturnType {
23-
return value
24-
}
25-
}
26-
```
12+
💰 A class includes fields, a constructor, and methods.
2713

2814
📜 [TypeScript Handbook - Classes](https://www.typescriptlang.org/docs/handbook/2/classes.html)

exercises/01.classes/01.problem.class-basics/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@
2020
// console.log(cart.getTotal())
2121

2222
// 🐨 Export your classes so we can verify your work
23-
// 💰 export { Product, ShoppingCart }
23+
// 💰 Export the classes you created

exercises/01.classes/02.problem.constructors/README.mdx

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -42,22 +42,8 @@ account.#balance // ❌ Error! Private field not accessible
4242
2. Use default parameter values
4343
3. Use `#` prefix for fields that should be private
4444

45-
💰 Parameter property shorthand (reference only):
45+
💰 This runtime doesn’t support parameter property shorthand.
4646

47-
```ts
48-
constructor(public name: string, public email: string) {}
49-
```
50-
51-
💰 Private field syntax:
52-
53-
```ts
54-
class Counter {
55-
#count: number = 0
56-
57-
increment() {
58-
this.#count++
59-
}
60-
}
61-
```
47+
💰 Use `#` to declare a private field.
6248

6349
📜 [MDN - Private class features](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/Private_class_fields)

exercises/01.classes/02.problem.constructors/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@
2828
// const customConfig = new Config('example.com', 8080, true)
2929

3030
// 🐨 Export your classes so we can verify your work
31-
// 💰 export { User, BankAccount, Config }
31+
// 💰 Export the classes you created

exercises/02.interfaces-and-classes/01.problem.implementing-interfaces/README.mdx

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,6 @@ interfaces to ensure all payment methods follow the same contract.
1010
3. Create a `PayPal` class that implements `PaymentMethod`
1111
4. Each class should have its own implementation of `pay()`
1212

13-
💰 Interface syntax:
14-
15-
```ts
16-
interface InterfaceName {
17-
method(): ReturnType
18-
}
19-
20-
class ClassName implements InterfaceName {
21-
method(): ReturnType {
22-
// Implementation
23-
}
24-
}
25-
```
26-
27-
💰 The class must implement all methods defined in the interface.
13+
💰 Classes that implement an interface must define all its methods.
2814

2915
📜 [TypeScript Handbook - Interfaces](https://www.typescriptlang.org/docs/handbook/2/objects.html#interfaces-vs-intersections)

exercises/02.interfaces-and-classes/01.problem.implementing-interfaces/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@
2020
// console.log(paypal.pay(50))
2121

2222
// 🐨 Export your classes so we can verify your work
23-
// 💰 export { CreditCard, PayPal }
23+
// 💰 Export the classes you created

exercises/02.interfaces-and-classes/02.problem.programming-to-abstractions/README.mdx

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,6 @@ concrete classes.
1111
3. Write a function that processes payments using the interface type
1212
4. Test with different payment method implementations
1313

14-
💰 Use interfaces as parameter types:
15-
16-
```ts
17-
function processPayment(method: PaymentMethod, amount: number) {
18-
return method.pay(amount) // Works with any PaymentMethod implementation
19-
}
20-
```
21-
22-
💰 This makes your code flexible—you can add new payment methods without
23-
changing the processor code.
14+
💰 Use the interface type for parameters so different implementations work.
2415

2516
📜 [TypeScript Handbook - Using Interfaces](https://www.typescriptlang.org/docs/handbook/2/objects.html#using-interfaces)

exercises/02.interfaces-and-classes/02.problem.programming-to-abstractions/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@
2525
// console.log(processPayment(paypal, 50))
2626

2727
// 🐨 Export your classes and function so we can verify your work
28-
// 💰 export { CreditCard, PayPal, processPayment }
28+
// 💰 Export the classes and function you created

exercises/03.inheritance/01.problem.extends/README.mdx

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,7 @@ it with specific shapes like `Circle` and `Rectangle`.
1111
4. Create a `Rectangle` class that extends `Shape`
1212
5. Add `width` and `height` fields to `Rectangle`
1313

14-
💰 Inheritance syntax:
15-
16-
```ts
17-
class Base {
18-
field: Type
19-
}
20-
21-
class Derived extends Base {
22-
// Inherits field from Base
23-
// Can add more fields and methods
24-
}
25-
```
14+
💰 Use `extends` to inherit fields and methods from a base class.
2615

2716
💰 Don't forget to call `super()` in the constructor if the parent has a
2817
constructor.

exercises/03.inheritance/01.problem.extends/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@
2323
// console.log(rectangle.width, rectangle.height) // ✅ Should work
2424

2525
// 🐨 Export your classes so we can verify your work
26-
// 💰 export { Shape, Circle, Rectangle }
26+
// 💰 Export the classes you created

0 commit comments

Comments
 (0)