6.1.0 • Published 2 months ago

@small-web/kitten v6.1.0

Weekly downloads
-
License
AGPL-version-3.0
Repository
-
Last release
2 months ago

Type-safe Kitten globals

Adds type safety to global kitten object in Kitten.

Install

npm install @small-web/kitten

Use

Kitten has a global kitten namespace that makes it easy to get started building Small Web sites and apps with it.

If you’re building something quick, that might be all you need.

e.g., In a quick Hello World example, your index.page.js might look like this:

export default () => kitten.html`
  <h1>Hello, world!</h1>
`

While that works, if you use JSDoc to implement type checking for your larger projects, and you use an editor with language intelligence (like Helix) and have static type checking turned on (e.g., as shown below or in a jsconfig.json file) you will get a “Cannot find name ‘kitten’” error.

// @ts-check
export default () => kitten.html` ← Cannot find name 'kitten'
  <h1>Hello, world!</h1>
`

To fix that, simply install the module and import the default export and it will behave exactly like the default global kitten namespace but with type safety and language intelligence while authoring.

// @ts-check
import kitten from '@small-web/kitten'

export default () => kitten.html`
  <h1>Hello, world!</h1>
`

💡 You can also import specific exports from the package, e.g., import { html } from '@small-web/kitten'.

🔗 For more help in using this module, please see the Kitten Type Safety Tutorial.

Database type safety

Kitten by default has at least two databases per project:

An internal database called _db and a custom one for you to use in your project called db.

This package provides a type-safe _db export for the internal database as the structure is well known.

If you want type safety for your custom project database, please create and use a type-safe database app module.

🔗 For a more in-depth look into database type safety, please see the Database App Modules Kitten Tutorial.

Like this? Fund us!

Small Technology Foundation is a tiny, independent not-for-profit.

We exist in part thanks to patronage by people like you. If you share our vision and want to support our work, please become a patron or donate to us today and help us continue to exist.

License

Copyright © 2023-present Aral Balkan, Small Technology Foundation Released under AGPL 3.0.

5.5.1

3 months ago

5.5.0

3 months ago

5.3.0

4 months ago

5.1.0

6 months ago

6.1.0

2 months ago

4.0.5

6 months ago

4.0.4

6 months ago

4.0.10

6 months ago

4.0.7

6 months ago

4.0.6

6 months ago

4.0.1

6 months ago

4.0.0

6 months ago

4.0.3

6 months ago

4.0.2

6 months ago

5.4.2

3 months ago

5.4.1

3 months ago

5.4.0

3 months ago

5.2.0

5 months ago

5.0.0

6 months ago

6.0.0

2 months ago

4.0.9

6 months ago

4.0.8

6 months ago

3.0.4

11 months ago

3.0.3

11 months ago

3.1.1

11 months ago

3.0.2

12 months ago

3.1.0

11 months ago

3.0.1

12 months ago

3.0.0

12 months ago

1.2.0

2 years ago

2.10.1

2 years ago

2.3.0

2 years ago

2.10.2

2 years ago

2.2.0

2 years ago

2.5.0

2 years ago

2.3.2

2 years ago

2.10.0

2 years ago

2.4.0

2 years ago

2.3.1

2 years ago

2.7.0

2 years ago

2.5.2

2 years ago

2.6.0

2 years ago

2.5.1

2 years ago

2.9.0

2 years ago

2.8.1

2 years ago

2.8.0

2 years ago

2.7.1

2 years ago

2.1.0

2 years ago

2.0.0

2 years ago

1.1.0

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago