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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@markuplint/types

v4.18.0

Published

Type declaration and value checker

Readme

@markuplint/types

npm version

Type declaration and value checker

Type declaration

API

import { check } from '@markuplint/types';

check('2020-01-01', 'DateTime');
// => { matched: true }

check('2020-02-30', 'DateTime');
// => {
// 	matched: false,
// 	reason: { type: 'out-of-range', gte: 1, lte: 29 },
// 	expects: [],
// 	partName: 'date',
// 	ref: 'https://html.spec.whatwg.org/multipage/text-level-semantics.html#datetime-value',
// 	raw: '30',
// 	offset: 8,
// 	length: 2,
// 	line: 1,
// 	column: 9,
// }

checkBase

Validates a value against a type definition object (enum, list, number, directive, or keyword type).

import { checkBase } from '@markuplint/types';

checkBase('hello', { enum: ['hello', 'world'] }, {});
// => { matched: true }

isCustomElementName

Checks whether a string is a valid custom element name according to the WHATWG specification.

import { isCustomElementName } from '@markuplint/types';

isCustomElementName()('my-element'); // => true
isCustomElementName()('div'); // => false

Type Exports

The package also exports the following types:

| Type | Description | | --------------------- | ---------------------------------------------------------- | | Result | Union type of MatchedResult and UnmatchedResult | | MatchedResult | Represents a successful match ({ matched: true }) | | UnmatchedResult | Represents a failed match with location and reason details | | Type | Union of all type definition shapes (enum, list, etc.) | | Defs | Registry mapping type identifiers to their definitions | | CustomSyntaxChecker | Factory function type for creating value checkers |

Type Identifiers

| Identifier | Use on | Spec | Supported | | ---------------------------------- | ------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------- | | Any | Some attributes | | ✅ | | NoEmptyAny | Some attributes | | ✅ | | OneLineAny | Some attributes | | ✅ | | Zero | Some attributes | | ✅ | | Number | Some attributes | | ✅ | | Uint | Some attributes | | ✅ | | JSON | Attributes on some frameworks etc. | | ✅ | | XMLName | svg\|[attributeName] and more | XML | ✅ | | DOMID | The id attribute and more | WHATWG | ✅ | | FunctionBody | Event handler attributes | | 🚧 | | Pattern | input[pattern] | WHATWG | ✅ | | DateTime | time[datetime] and more | WHATWG | ✅ | | TabIndex | The tabindex attribute | WHATWG | ✅ | | BCP47 | The lang attribute and more | RFC | ✅ | | URL | Some attributes | WHATWG | ✅ | | AbsoluteURL | The itemtype attribute (as list) | WHATWG | ✅ | | HashName | img[usemap] | WHATWG | ✅ | | OneCodePointChar | The accesskey attribute (as list) | WHATWG | ✅ | | CustomElementName | The is attribute | WHATWG | ✅ | | ~~BrowsingContextName~~ | Use NavigableTargetName instead. | Obsoleted | ✅ | | ~~BrowsingContextNameOrKeyword~~ | Use NavigableTargetNameOrKeyword instead. | Obsoleted | ✅ | | NavigableTargetName | iframe[name] and more | WHATWG | ✅ | | NavigableTargetNameOrKeyword | a[target] and more | WHATWG | ✅ | | HTTPSchemaURL | a[ping] (as list) and more | WHATWG | ✅ | | MIMEType | embed[type] and more | WHATWG | ✅ | | ItemProp | The itemprop attribute (as list) | WHATWG | ✅ | | Srcset | img[srcset] and more | WHATWG | ✅ | | SourceSizeList | img[sizes] and more | WHATWG | ✅ | | IconSize | link[sizes] (as list) | WHATWG | ✅ | | AutoComplete | input[autocomplete] and more | WHATWG | ✅ | | Accept | input[accept] | WHATWG | ✅ | | SerializedPermissionsPolicy | iframe[allow] | W3C | ✅ | | LinkTypeForLinkElement | link[rel] | WHATWG microformats | ✅ | | LinkTypeForLinkElementInBody | link[rel] in <body> | WHATWG microformats | ✅ | | LinkTypeForAnchorAndAreaElement | a[rel], area[rel] | WHATWG microformats | ✅ | | LinkTypeForFormElement | form[rel] | WHATWG microformats | ✅ | | <css-declaration-list> | The style attribute | CSS | ✅ | | <class-list> | The class attribute | SVG | ✅ | | <svg-font-size> | Some attributes for SVG | CSS | 🚧 | | <svg-font-size-adjust> | Some attributes for SVG | CSS | 🚧 | | <'color-profile'> | Some attributes for SVG | SVG | 🚧 | | <'color-rendering'> | Some attributes for SVG | SVG | 🚧 | | <'enable-background'> | Some attributes for SVG | SVG | 🚧 | | <list-of-svg-feature-string> | Some attributes for SVG | SVG | 🚧 | | <animatable-value> | Some attributes for SVG | SVG | 🚧 | | <begin-value-list> | Some attributes for SVG | SVG | 🚧 | | <end-value-list> | Some attributes for SVG | SVG | 🚧 | | <list-of-value> | Some attributes for SVG | SVG | 🚧 | | <clock-value> | Some attributes for SVG | SMIL | 🚧 | | <color-matrix> | Some attributes for SVG | W3C | ✅ | | <dasharray> | Some attributes for SVG | SVG | ✅ | | <key-points> | Some attributes for SVG | SVG | ✅ | | <key-splines> | Some attributes for SVG | SVG | ✅ | | <key-times> | Some attributes for SVG | SVG | ✅ | | <system-language> | Some attributes for SVG | SVG | ✅ | | <origin> | Some attributes for SVG | SMIL | ✅ | | <svg-path> | Some attributes for SVG | SVG | 🚧 | | <points> | Some attributes for SVG | SVG | ✅ | | <preserve-aspect-ratio> | Some attributes for SVG | SVG | ✅ | | <view-box> | Some attributes for SVG | SVG | ✅ | | <rotate> | Some attributes for SVG | SVG | ✅ | | <text-coordinate> | Some attributes for SVG | SVG | ✅ | | <list-of-lengths> | Some attributes for SVG | | ✅ | | <list-of-numbers> | Some attributes for SVG | | ✅ | | <list-of-percentages> | Some attributes for SVG | | ✅ | | <number-optional-number> | Some attributes for SVG | | ✅ |

In addition, you can use types CSSTree defined.

Install

$ npm install @markuplint/types

$ yarn add @markuplint/types