UNPKG

react-classnaming

Version:

Tools to establish CSS classes as an explicit abstraction layer and to handle it as an interface between React and CSSStyleDeclaration

31 lines (30 loc) 970 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.classNamesCheck = void 0; var consts_json_1 = require("./consts.json"); /** * Identical function or returning constant `EMPTY_OBJECT` for keys check of not used classes in components tree * @example * ```tsx * // Dummies shape * <Component classnames={classNamesCheck()} />; * ``` * --- * ```tsx * import type { ClassNamesFrom } from "react-classnaming/types" * import css_module from "./some.css" // With class `.never-used {...}` * * <Component classnames={classNamesCheck( * css_module, * //@ts-expect-error Property 'never-used' is missing * {} as ClassNamesFrom<typeof Component> * )} />; * ``` */ function classNamesCheck(source, _) { if (source === void 0) { source = consts_json_1.EMPTY_OBJECT; } if (_ === void 0) { _ = consts_json_1.EMPTY_OBJECT; } //@ts-expect-error return source; } exports.classNamesCheck = classNamesCheck;