Skip to content

Commit f8109e3

Browse files
committed
fix: use Array<T> syntax consistently in exercises
- Changed array type annotations from `type[]` to `Array<type>` in problem files and test files - This ensures consistency between hints, solutions, and tests This ensures consistency between problem hints and solutions, reducing learner confusion.
1 parent 0672fd5 commit f8109e3

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

exercises/02.arrays/01.problem.array-basics/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Working with basic arrays
33

44
// 🐨 Create an array of product names
5-
// 💰 const products: string[] = ['Laptop', 'Mouse', 'Keyboard']
5+
// 💰 const products: Array<string> = ['Laptop', 'Mouse', 'Keyboard']
66

77
// 🐨 Add a new product 'Monitor' using push
88

exercises/02.arrays/01.solution.array-basics/index.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import './index.ts'
44
await testStep(
55
'Products array should have correct initial values',
66
async () => {
7-
const products: string[] = ['Laptop', 'Mouse', 'Keyboard']
7+
const products: Array<string> = ['Laptop', 'Mouse', 'Keyboard']
88
expect(
99
products[0],
1010
'🚨 products[0] should be "Laptop" - arrays are zero-indexed, so [0] is the first element',
@@ -44,7 +44,7 @@ await testStep('Products array should support push operation', async () => {
4444
await testStep(
4545
'Products array should access first and last elements correctly',
4646
async () => {
47-
const products: string[] = ['Laptop', 'Mouse', 'Keyboard', 'Monitor']
47+
const products: Array<string> = ['Laptop', 'Mouse', 'Keyboard', 'Monitor']
4848
expect(
4949
products[0],
5050
'🚨 products[0] should be "Laptop" - the first element is at index 0',

exercises/03.tuples/02.solution.tuple-patterns/index.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ await testStep(
3939
await testStep(
4040
'getMinMax should return correct min and max values',
4141
async () => {
42-
function getMinMax(nums: number[]): [number, number] {
42+
function getMinMax(nums: Array<number>): [number, number] {
4343
return [Math.min(...nums), Math.max(...nums)]
4444
}
4545
const [min, max] = getMinMax([5, 2, 8, 1, 9])
@@ -57,7 +57,7 @@ await testStep(
5757
await testStep(
5858
'getMinMax should work with different number arrays',
5959
async () => {
60-
function getMinMax(nums: number[]): [number, number] {
60+
function getMinMax(nums: Array<number>): [number, number] {
6161
return [Math.min(...nums), Math.max(...nums)]
6262
}
6363
const [min, max] = getMinMax([10, 20, 5, 15])

0 commit comments

Comments
 (0)