11## @cosense/types
22
33[ ![ JSR] ( https://jsr.io/badges/@cosense/types )] ( https://jsr.io/@cosense/types )
4+ [ ![ npm] ( https://img.shields.io/npm/v/@cosense/types )] ( https://www.npmjs.com/package/@cosense/types )
45[ ![ test] ( https://github.com/scrapbox-jp/types/workflows/ci/badge.svg )] ( https://github.com/scrapbox-jp/types/actions?query=workflow%3Aci )
56
67Type definitions for [ cosense] ( https://cosen.se )
78
89## Getting Started
910
11+ This library provides TypeScript type definitions for Scrapbox/Cosense and
12+ supports both JSR (JavaScript Registry) and npm installation methods.
13+
14+ ### Installation
15+
16+ #### Option 1: JSR (Recommended for Deno projects)
17+
1018If you want to use type definitions for REST API, run
1119
1220``` bash
@@ -18,3 +26,51 @@ If you want to use type definitions for UserScript, run
1826``` bash
1927deno add jsr:@cosense/types/userscript
2028```
29+
30+ #### Option 2: npm (For Node.js projects)
31+
32+ Install via npm:
33+
34+ ``` bash
35+ npm install @cosense/types
36+ ```
37+
38+ Import the library:
39+
40+ ``` ts
41+ // ESM syntax
42+ import type { PageList } from " @cosense/types/rest" ;
43+ import type { Scrapbox } from " @cosense/types/userscript" ;
44+ ```
45+
46+ ### Usage Examples
47+
48+ ``` ts
49+ // Example for JSR (Deno)
50+ import type { PageList } from " jsr:@cosense/types/rest" ;
51+
52+ const pages: PageList = {
53+ projectName: " example-project" ,
54+ skip: 0 ,
55+ limit: 100 ,
56+ count: 42 ,
57+ pages: [],
58+ };
59+ ```
60+
61+ For npm users:
62+
63+ ``` ts
64+ // Example for npm (Node.js)
65+ import type { PageList } from " @cosense/types/rest" ;
66+ import type { Scrapbox } from " @cosense/types/userscript" ;
67+
68+ // Use the types in your Node.js application
69+ const pageData: PageList = {
70+ projectName: " my-project" ,
71+ skip: 0 ,
72+ limit: 50 ,
73+ count: 10 ,
74+ pages: [],
75+ };
76+ ```
0 commit comments