npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

tw5-typed

v0.5.10

Published

Types for tiddlywiki

Downloads

278

Readme

TW5-Typed

TypeScript type definitions for TiddlyWiki5.

Doc Site - tiddly-gittly.github.io/TW5-Typed

Usage

First, install it as dev-dependency:

npm i -D tw5-typed

Add tw5-typed to your tsconfig.json's compilerOptions

{
  "compilerOptions": {
    "types": ["node", "tw5-typed"] /* Type declaration files to be included in compilation. */
  }
}

Then you will have global types like $tw automatically. You can import the rest of the types using import type statement:

import type { ISearchOptions, SourceIterator, IFilterOperatorParamOperator } from 'tiddlywiki';

Alias

Sometimes you may want to use a modified version of tw, you can re-export types like this in your src/type.d.ts:

declare module '@tiddlygit/tiddlywiki' {
  export * from 'tiddlywiki';
}

Development

Firstly, Install eslint using npm:

npm i

You can add new *.d.ts file to contain your types:

  1. use declare module 'tiddlywiki' { } to wrap all your types.
  2. don't forget to export all your types.
  3. to add type for global variable, add global { } inside that declare module 'tiddlywiki' { }, like global { var $tw: I$TW; }
  4. add type import like /// <reference path="ast.d.ts" /> in the tw.d.ts

Importing type from other files

  • add type import like /// <reference path="parser.d.ts" />
  • using normal import, like import { parse } from './parser'; will not work

Test in your node_modules

To rapid prototype the type, just right click a type to open .d.ts file in the node_modules, and try create new file there, and copy to this repo after a success.

Before publish

Make sure doc build and test are passed.

  1. Doc: pnpm run docs:generate && pnpm run docs:dev, see .github\workflows\deploy-docs-to-github-pages.yml
  2. Tests: pnpm run check, see .github\workflows\test.yml