import { type TSESLint } from '@typescript-eslint/utils'; type Options = readonly []; type MessageIds = 'noStringSpread'; /** * Disallow spreading a `string` value with the spread operator `...`. * * ## Why * * Spreading a string iterates it into its individual characters, so * `[...someString]` (or `f(...someString)`) evaluates to a `string[]` — the * *exact same result type* as spreading an actual `string[]`. That makes an * accidental string spread silent: neither the reader nor the type checker can * tell `[...anArray]` from `[...aString]` by the result type alone, so a bug * where an array was expected but a `string` slipped in goes unnoticed. * * ## Why not simply "allow array / object types only" * * The naive framing — "only permit `...` on arrays or objects" — would also * reject perfectly idiomatic spreads of other iterables (`Set`, `Map`, * `Map.prototype.keys()`, generators, `NodeList`, typed arrays, `arguments`, * …), which have no equivalent silent hazard. And TypeScript *already* rejects * spreading a non-iterable primitive such as `number` / `boolean` in an * iterable position. The only case TypeScript accepts yet is genuinely * error-prone is `string`, so that is exactly what this rule targets. * * If a character split is really intended, spell it out with * `Array.from(str)` (identical to the spread, code-point aware) or * `str.split('')`. */ export declare const noStringSpread: TSESLint.RuleModule; export {}; //# sourceMappingURL=no-string-spread.d.mts.map