Skip to content
oks-ui

oks-ui 1.2.2 Release: Badge Numbers and a License File

Release notes · on · by oks-ui team

An inbox list with red and blue count badges on the icons and a 1.2.2 version tag, showing the Badge fix in the release.
ShareXLinkedIn
On this page
  1. Badge accepts a number for content
  2. The MIT license now ships in the package
  3. The bug-report link works
  4. Upgrading

oks-ui 1.2.2 is available on npm. It is a small release with two changes you can feel and one you cannot see. Nothing was removed and no behaviour changed at runtime, so upgrading is safe.

npm install oks-ui@^1.2.2

Badge accepts a number for content

The most common use of a badge is a count: unread messages, items in a cart, open tasks. Until now, passing that count straight to content was a TypeScript error, even though it worked at runtime.

import { Badge } from "oks-ui/badge";
import "oks-ui/badge.css";

export function UnreadCount({ count }: { count: number }) {
  return (
    <Badge content={count} color="danger">
      <span>Inbox</span>
    </Badge>
  );
}

The cause was in the props type. Badge extends the standard HTML attributes, and the HTML content attribute is a string. The two definitions were intersected, which narrowed content down to string. In 1.2.2 the props type leaves out the HTML attribute, so content can be a number or any node again. If you worked around the error with String(count) or a type assertion, you can delete that now.

Only TypeScript users were affected. In plain JavaScript the number always rendered correctly.

The MIT license now ships in the package

oks-ui has declared the MIT license in package.json from the start, but the package did not contain a license file. The MIT license asks that its text and the copyright notice travel with the code, so the file was missing where it mattered most. From 1.2.2 the LICENSE file is included in every install, under node_modules/oks-ui/LICENSE. The terms have not changed: you can use oks-ui in personal and commercial projects for free.

The npm page for a package has a link for reporting bugs. For oks-ui it pointed at a GitHub issues page that does not exist, because the source repository is private. It now points at the FAQ page, and the maintainer email is listed alongside it.

Upgrading

Install 1.2.2 and run your type check. If you had a cast or a String(count) around a Badge count, it is no longer needed and is safe to remove. Nothing else needs to change. The full list is in the changelog, and every release from 1.0.4 onward is described the same way.

Advertisement

oks-ui team

We build oks-ui — a React component library in strict TypeScript, themed entirely through CSS custom properties, with no runtime dependencies beyond React. These posts are what we learned building it.

Read the docs · All posts

Was this post helpful?

ShareXLinkedIn