Description
Before You File a Documentation Request Please Confirm You Have Done The Following...
- I have looked for existing open or closed documentation requests that match my proposal.
- I have read the FAQ and my problem is not listed.
Suggested Changes
Following up on #5032 -> #5036, it's still easy to get a dreaded "The inferred type of '...' cannot be named without a reference to '.../node_modules/@typescript-eslint/utils/dist/ts-eslint/Rule.js'. This is likely not portable. A type annotation is necessary." TypeScript type error when using ESLintUtils.RuleCreator
:
import { ESLintUtils } from "@typescript-eslint/utils";
export const createRule = ESLintUtils.RuleCreator((name) => `.../${name}.md`);
// ~~~~~~~~~~
// The inferred type of 'createRule' cannot be named without a reference to
// '../../node_modules/@typescript-eslint/utils/dist/ts-eslint/Rule.js'.
// This is likely not portable. A type annotation is necessary.
How do we recommend third party packages do this?
Also mentioned by @Josh-Cena on the Discord: https://discord.com/channels/1026804805894672454/1130171307909202021/1130171307909202021. And stumbled onto (again) by me in JoshuaKGoldberg/eslint-plugin-expect-type@2660939.
Interestingly, DefinitelyTyped-tools doesn't seem to have this issue... https://github.com/microsoft/DefinitelyTyped-tools/blob/b6b22fc00eebbcfa26120cc314c3f7d2179106ba/packages/eslint-plugin/src/util.ts
I'd consider this issue to be a more specific subset of #5444.