Skip to content

Commit

Permalink
0.2.5
Browse files Browse the repository at this point in the history
  • Loading branch information
Oaphi committed May 13, 2022
1 parent 77e2e0f commit 4db9a85
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
| Name | @userscripters/global-types |
| Description | Type definitions for global UserScripters objects |
| License | [GPL-3.0-or-later](https://spdx.org/licenses/GPL-3.0-or-later) |
| Version | 0.2.4 |
| Version | 0.2.5 |


# Support
Expand Down
6 changes: 3 additions & 3 deletions STACKAPPS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ library


<!-- thumbnail: -->
<!-- version: 0.2.4 -->
<!-- version: 0.2.5 -->
<!-- tag: library -->
<!-- excerpt: UserScripters global types is a type definitions package for helpers common to the UserScripters namespace -->

Expand All @@ -22,7 +22,7 @@ The script is licensed under the [GPL-3.0-or-later](https://spdx.org/licenses/GP

### Download

Latest version: 0.2.4
Latest version: 0.2.5

[Install](https://www.npmjs.com/package/@userscripters/global-types)

Expand All @@ -38,7 +38,7 @@ Version number means "last tested on":

| Version | Description |
| ---------- | ----------- |
| 0.2.4 | |
| 0.2.5 | |

## Contact

Expand Down
4 changes: 3 additions & 1 deletion lib/configurer.d.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import Store, { type AsyncStorage } from "@userscripters/storage";

export type UserscriptOptionType = "text" | "select" | "checkbox";

export interface UserscriptOption {
name: string;
desc: string;
def?: unknown;
type: UserscriptOptionType;
};
}

export declare class Userscript<T extends Storage | AsyncStorage> extends Store {
option(name: string, config: Omit<UserscriptOption, "name">): Userscript<T>;
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@userscripters/global-types",
"description": "Type definitions for global UserScripters objects",
"version": "0.2.4",
"version": "0.2.5",
"scripts": {
"test": "tsd",
"readme": "generate-readme",
Expand Down
6 changes: 5 additions & 1 deletion spec/index.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ const userscript = configurer?.register("test-script");

expectType<Userscript<any> | undefined>(userscript);

expectType<Userscript<any>>(userscript!.option("test-option", "Option for tsd testing", "ok"));
expectType<Userscript<any>>(userscript!.option("test-option", {
desc: "Option for tsd testing",
def: "ok",
type: "text"
}));

expectType<Promise<string | undefined>>(userscript!.load("test-option"));
expectType<Promise<void>>(userscript!.save("test-option", "not ok"));
Expand Down

0 comments on commit 4db9a85

Please sign in to comment.