Skip to content

scrapbox-jp/types

Repository files navigation

@cosense/types

JSR npm test

Node.js & npm Notice (since 0.11.1)

Now also published on npm.

Node.js support is experimental: I mainly target Deno and browsers, so I don't actively maintain Node.js compatibility. Some tests run, but there may still be runtime or type gaps remaining. Please use it with that understanding.

That said, issues / PRs to improve Node support are very welcome!

If you don't need a public npm package, you can consume the JSR version directly—npm via a custom registry in .npmrc; yarn or pnpm need no extra config. See the JSR docs.

Type definitions for cosense

Getting Started

This library provides TypeScript type definitions for Scrapbox/Cosense and supports both JSR (JavaScript Registry) and npm installation methods.

Installation

Option 1: JSR (Recommended for Deno projects)

If you want to use type definitions for REST API, run

deno add jsr:@cosense/types/rest

If you want to use type definitions for UserScript, run

deno add jsr:@cosense/types/userscript

Option 2: npm (For Node.js projects)

Install via npm:

npm install @cosense/types

Import the library:

// ESM syntax
import type { PageList } from "@cosense/types/rest";
import type { Scrapbox } from "@cosense/types/userscript";

Usage Examples

// Example for JSR (Deno)
import type { PageList } from "jsr:@cosense/types/rest";

const pages: PageList = {
  projectName: "example-project",
  skip: 0,
  limit: 100,
  count: 42,
  pages: [],
};

For npm users:

// Example for npm (Node.js)
import type { PageList } from "@cosense/types/rest";
import type { Scrapbox } from "@cosense/types/userscript";

// Use the types in your Node.js application
const pageData: PageList = {
  projectName: "my-project",
  skip: 0,
  limit: 50,
  count: 10,
  pages: [],
};

About

Type definitions for Cosense

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •