Skip to content

Commit 8a0dbee

Browse files
committed
📝 Add JSDoc to variable interfaces
JSDoc written in the implementation is not referenced from LSP etc.
1 parent bd02d51 commit 8a0dbee

File tree

1 file changed

+34
-9
lines changed

1 file changed

+34
-9
lines changed

denops_std/variable/types.ts

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,46 @@
11
import type { Denops } from "https://deno.land/x/denops_core@v4.0.0/mod.ts";
22

3+
/**
4+
* Represents a getter method for retrieving property value.
5+
*/
36
export type Getter = {
4-
get<T = unknown>(
5-
denops: Denops,
6-
prop: string,
7-
defaultValue: T,
8-
): Promise<T>;
9-
get<T = unknown>(
10-
denops: Denops,
11-
prop: string,
12-
): Promise<T | null>;
7+
/**
8+
* Gets the value of the specified property, or default value if it doesn't exist.
9+
* @param prop - The name of the property.
10+
* @param defaultValue - The default value to be returned if the property doesn't exist.
11+
* @returns A promise that resolves to the value of the property.
12+
*/
13+
get<T = unknown>(denops: Denops, prop: string, defaultValue?: T): Promise<T>;
14+
15+
/**
16+
* Gets the value of the specified property, or null if it doesn't exist.
17+
* @param prop - The name of the property.
18+
* @returns A promise that resolves to the value of the property.
19+
*/
20+
get<T = unknown>(denops: Denops, prop: string): Promise<T | null>;
1321
};
1422

23+
/**
24+
* Represents a setter method for setting property value.
25+
*/
1526
export type Setter = {
27+
/**
28+
* Sets the value of the specified property.
29+
* @param prop - The name of the property.
30+
* @param value - The value to be set.
31+
* @returns A promise that resolves when the value has been set.
32+
*/
1633
set<T = unknown>(denops: Denops, prop: string, value: T): Promise<void>;
1734
};
1835

36+
/**
37+
* Represents a remover method for removing property value.
38+
*/
1939
export type Remover = {
40+
/**
41+
* Removes the value of the specified property or resets to its default value.
42+
* @param prop - The name of the property.
43+
* @returns A promise that resolves when the value has been removed or reset.
44+
*/
2045
remove(denops: Denops, prop: string): Promise<void>;
2146
};

0 commit comments

Comments
 (0)