JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 21
  • Score
    100M100P100Q57219F
  • License MIT

Type definitions for cosense

Package Exports

  • @cosense/types/rest
  • @cosense/types/userscript
  • @cosense/types/websocket

Readme

@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

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: [],
};