diff --git a/src/index.js b/src/index.js index aed35b8..a5f7e32 100644 --- a/src/index.js +++ b/src/index.js @@ -23,7 +23,7 @@ const NOOP_PARSE_ERROR = { onParseError: () => {} }; const MATCH_CALC = /^(?:-(?:moz|webkit)-)?calc$/i; /** - * @typedef {object} PluginOptions + * @typedef {object} PostCssCalcOptions * @property {number | false} [precision] * @property {boolean} [preserve] * @property {boolean} [warnWhenCannotResolve] @@ -32,7 +32,7 @@ const MATCH_CALC = /^(?:-(?:moz|webkit)-)?calc$/i; * @property {(error: Error, input: string) => void} [onParseError] Invoked when parse/simplify throws. Replaces the default `result.warn`. */ -/** @typedef {Required> & Pick} ResolvedOptions */ +/** @typedef {Required> & Pick} ResolvedOptions */ /** * Fields threaded unchanged through the recursive `transformList` walk. @@ -153,7 +153,7 @@ function applyTransform(node, current, setProp, options, result) { } /** - * @param {PluginOptions} [opts] + * @param {PostCssCalcOptions} [opts] * @return {import('postcss').Plugin} */ function pluginCreator(opts) { @@ -215,9 +215,10 @@ function pluginCreator(opts) { }; } +/** @type {true} */ pluginCreator.postcss = true; -export default /** @type import('postcss').PluginCreator*/ ( +export default /** @type import('postcss').PluginCreator*/ ( pluginCreator ); export { pluginCreator as 'module.exports' }; diff --git a/types/index.d.ts b/types/index.d.ts index d901194..c52f348 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -1,4 +1,4 @@ -export type PluginOptions = { +export type PostCssCalcOptions = { precision?: number | false; preserve?: boolean; warnWhenCannotResolve?: boolean; @@ -9,7 +9,7 @@ export type PluginOptions = { */ onParseError?: (error: Error, input: string) => void; }; -export type ResolvedOptions = Required> & Pick; +export type ResolvedOptions = Required> & Pick; export type TransformContext = { options: ResolvedOptions; result: import('postcss').Result; @@ -17,13 +17,13 @@ export type TransformContext = { value: string; }; /** - * @param {PluginOptions} [opts] + * @param {PostCssCalcOptions} [opts] * @return {import('postcss').Plugin} */ -declare function pluginCreator(opts?: PluginOptions): import('postcss').Plugin; +declare function pluginCreator(opts?: PostCssCalcOptions): import('postcss').Plugin; declare namespace pluginCreator { - var postcss: boolean; + var postcss: true; } -declare const _default: import('postcss').PluginCreator; +declare const _default: import('postcss').PluginCreator; export default _default; export { pluginCreator as 'module.exports' };