Skip to content

Commit 8e8787d

Browse files
committed
fix: mematuhi peraturan ESLint
1 parent e30e481 commit 8e8787d

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed
Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
import { StringUtility } from "./Decorators";
1+
import { StringUtility } from './Decorators';
22

3-
test("[TypeScriptBasic/0x_Decorators] Pengecekan Class Decorator", () => {
4-
expect(new StringUtility(["Test"]).data[0]).toBe("Teks pengganti argumen pertama");
5-
})
3+
test('[TypeScriptBasic/0x_Decorators] Pengecekan Class Decorator', () => {
4+
expect(new StringUtility(['Test']).data[0]).toBe('Teks pengganti argumen pertama');
5+
});
66

7-
test("[TypeScriptBasic/0x_Decorators] Pengecekan Property Decorator", () => {
8-
// @ts-expect-error
9-
expect(new StringUtility("abc")).toThrowError();
10-
})
7+
test('[TypeScriptBasic/0x_Decorators] Pengecekan Property Decorator', () => {
8+
expect(new StringUtility(['abc'])).toThrowError();
9+
});
1110

12-
test("[TypeScriptBasic/0x_Decorators] Pengecekan Method Decorator", () => {
13-
expect(StringUtility.prototype.sambungData = () => { return "" }).toThrowError();
14-
})
11+
test('[TypeScriptBasic/0x_Decorators] Pengecekan Method Decorator', () => {
12+
expect(StringUtility.prototype.sambungData = () => { return ''; }).toThrowError();
13+
});

TypeScriptBasic/0x_Decorators/Decorators.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
// Penjelasan akan ditulis nanti.
22

3-
function gantiArgumenConstructor(constructor: typeof StringUtility): any {
3+
function gantiArgumenConstructor(constructor: typeof StringUtility): typeof StringUtility {
44
return class extends constructor {
55
constructor(args: string[]) {
6-
super(["Teks pengganti argumen pertama", ...args]);
6+
super(['Teks pengganti argumen pertama', ...args]);
77
}
8-
}
8+
};
99
}
1010

11-
function buatMethodTidakDapatDiubah(target: any, key: string, descriptor: PropertyDescriptor) {
11+
function buatMethodTidakDapatDiubah(target: StringUtility, key: string, descriptor: PropertyDescriptor) {
1212
descriptor.writable = false;
1313
}
1414

15-
function harusBerupaArray(target: any, key: string) {
15+
function harusBerupaArray(target: StringUtility, key: string) {
16+
// @ts-expect-error ignore error
1617
if (!Array.isArray(target[key])) {
1718
throw new Error(`${key} harus berupa array`);
1819
}
@@ -41,4 +42,4 @@ class StringUtility {
4142

4243
export {
4344
StringUtility
44-
}
45+
};

0 commit comments

Comments
 (0)